Wade Guthrie | 5020b57 | 2012-10-12 15:51:14 -0700 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // This class is a callback object that observes all nl80211 events that come |
| 6 | // up from the kernel. |
| 7 | |
| 8 | #ifndef SHILL_CALLBACK80211_METRICS_H |
| 9 | #define SHILL_CALLBACK80211_METRICS_H |
| 10 | |
| 11 | #include <iomanip> |
| 12 | #include <map> |
| 13 | #include <string> |
| 14 | |
| 15 | #include <base/basictypes.h> |
| 16 | #include <base/bind.h> |
| 17 | #include <base/memory/weak_ptr.h> |
| 18 | |
| 19 | #include "shill/callback80211_object.h" |
| 20 | |
| 21 | namespace shill { |
| 22 | |
| 23 | class Config80211; |
| 24 | class Metrics; |
| 25 | class UserBoundNlMessage; |
| 26 | |
| 27 | // Config80211 callback object that sends stuff to UMA metrics. |
| 28 | class Callback80211Metrics : public Callback80211Object { |
| 29 | public: |
| 30 | Callback80211Metrics(Config80211 *config80211, Metrics *metrics); |
| 31 | |
Wade Guthrie | b1ec860 | 2012-10-18 17:26:14 -0700 | [diff] [blame] | 32 | // Install ourselves as a callback. |
| 33 | virtual bool InstallAsBroadcastCallback(); |
Wade Guthrie | 5020b57 | 2012-10-12 15:51:14 -0700 | [diff] [blame] | 34 | |
| 35 | private: |
| 36 | // When installed, this is the method Config80211 will call when it gets a |
| 37 | // message from the mac80211 drivers. |
| 38 | virtual void Config80211MessageCallback(const UserBoundNlMessage &msg); |
| 39 | |
| 40 | static const char kMetricLinkDisconnectCount[]; |
| 41 | |
| 42 | Metrics *metrics_; |
| 43 | |
| 44 | // Config80211MessageCallback method bound to this object to install as a |
| 45 | // callback. |
| 46 | base::WeakPtrFactory<Callback80211Metrics> weak_ptr_factory_; |
| 47 | |
| 48 | DISALLOW_COPY_AND_ASSIGN(Callback80211Metrics); |
| 49 | }; |
| 50 | |
| 51 | } // namespace shill |
| 52 | |
| 53 | #endif // SHILL_CALLBACK80211_METRICS_H |