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

Unified Diff: chrome/browser/io_thread.cc

Issue 1971853002: Move IOThread::LoggingNetworkChangeObserver to net/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 7 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 | « chrome/browser/io_thread.h ('k') | net/base/logging_network_change_observer.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 51c6ff2123e390f98497d0f857527163f197301f..11a9dc7f11a5064fe503b938fe1de95ee76a5471 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -63,6 +63,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/user_agent.h"
#include "net/base/host_mapping_rules.h"
+#include "net/base/logging_network_change_observer.h"
#include "net/base/sdch_manager.h"
#include "net/cert/cert_verifier.h"
#include "net/cert/cert_verify_proc.h"
@@ -307,64 +308,6 @@ const std::string& GetVariationParam(
} // namespace
-class IOThread::LoggingNetworkChangeObserver
- : public net::NetworkChangeNotifier::IPAddressObserver,
- public net::NetworkChangeNotifier::ConnectionTypeObserver,
- public net::NetworkChangeNotifier::NetworkChangeObserver {
- 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);
- net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
- }
-
- ~LoggingNetworkChangeObserver() override {
- net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
- net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
- net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
- }
-
- // NetworkChangeNotifier::IPAddressObserver implementation.
- void OnIPAddressChanged() override {
- VLOG(1) << "Observed a change to the network IP addresses";
-
- net_log_->AddGlobalEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED);
- }
-
- // NetworkChangeNotifier::ConnectionTypeObserver implementation.
- 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));
- }
-
- // NetworkChangeNotifier::NetworkChangeObserver implementation.
- void OnNetworkChanged(
- net::NetworkChangeNotifier::ConnectionType type) override {
- std::string type_as_string =
- net::NetworkChangeNotifier::ConnectionTypeToString(type);
-
- VLOG(1) << "Observed a network change to state " << type_as_string;
-
- net_log_->AddGlobalEntry(
- net::NetLog::TYPE_NETWORK_CHANGED,
- net::NetLog::StringCallback("new_connection_type", &type_as_string));
- }
-
- private:
- net::NetLog* net_log_;
- DISALLOW_COPY_AND_ASSIGN(LoggingNetworkChangeObserver);
-};
-
class SystemURLRequestContextGetter : public net::URLRequestContextGetter {
public:
explicit SystemURLRequestContextGetter(IOThread* io_thread);
@@ -599,7 +542,7 @@ void IOThread::Init() {
// Assuming NetworkChangeNotifier dispatches in FIFO order, we should be
// logging the network change before other IO thread consumers respond to it.
network_change_observer_.reset(
- new LoggingNetworkChangeObserver(net_log_));
+ new net::LoggingNetworkChangeObserver(net_log_));
// Setup the HistogramWatcher to run on the IO thread.
net::NetworkChangeNotifier::InitHistogramWatcher();
« no previous file with comments | « chrome/browser/io_thread.h ('k') | net/base/logging_network_change_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698