Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5283)

Unified Diff: chrome/browser/io_thread.cc

Issue 11270039: Add NetworkChangeNotifier connectivity events to the NetLog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/net_log_event_type_list.h » ('j') | net/base/net_log_event_type_list.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 08ed80c0562ac423e339c5c43af3ed34bd55f5b2..5ae0edbc224d739d922cc4d9f5ff937c237967e3 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -244,16 +244,19 @@ ConstructSystemRequestContext(IOThread::Globals* globals,
} // namespace
class IOThread::LoggingNetworkChangeObserver
- : public net::NetworkChangeNotifier::IPAddressObserver {
+ : public net::NetworkChangeNotifier::IPAddressObserver,
+ public net::NetworkChangeNotifier::ConnectionTypeObserver {
public:
// |net_log| must remain valid throughout our lifetime.
explicit LoggingNetworkChangeObserver(net::NetLog* net_log)
: net_log_(net_log) {
net::NetworkChangeNotifier::AddIPAddressObserver(this);
+ net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
}
~LoggingNetworkChangeObserver() {
net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
+ net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
}
virtual void OnIPAddressChanged() {
@@ -262,6 +265,19 @@ class IOThread::LoggingNetworkChangeObserver
net_log_->AddGlobalEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED);
}
+ virtual void OnConnectionTypeChanged(
mmenke 2012/10/25 16:25:31 While you're here, could you make this and OnIPAdd
+ net::NetworkChangeNotifier::ConnectionType type) {
+ std::string type_as_string =
+ net::NetworkChangeNotifier::ConnectionTypeToString(type);
+
+ VLOG(1) << "Observed a change to network connectivity state "
+ << type_as_string;
+
+ net_log_->AddGlobalEntry(
+ net::NetLog::TYPE_NETWORK_CONNECTIVITY_CHANGED,
+ net::NetLog::StringCallback("new_type", &type_as_string));
+ }
+
private:
net::NetLog* net_log_;
DISALLOW_COPY_AND_ASSIGN(LoggingNetworkChangeObserver);
« no previous file with comments | « no previous file | net/base/net_log_event_type_list.h » ('j') | net/base/net_log_event_type_list.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698