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

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: Address comments 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') | no next file with comments »
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..ddfdcb3da4a1a334e5d15f8f89b10abc26059b6e 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -244,24 +244,40 @@ 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() {
+ virtual void OnIPAddressChanged() OVERRIDE {
VLOG(1) << "Observed a change to the network IP addresses";
net_log_->AddGlobalEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED);
}
+ virtual void OnConnectionTypeChanged(
+ net::NetworkChangeNotifier::ConnectionType type) OVERRIDE {
+ 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_connection_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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698