| Index: chrome/browser/chromeos/chrome_browser_main_chromeos.cc
|
| diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
|
| index 2e3799a7d0c71136a7b669e8657e7d98cf0306ed..183e1ae6b8f9d2236d35b76818fd99b10e010976 100644
|
| --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
|
| +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
|
| @@ -82,6 +82,7 @@
|
| #include "chromeos/dbus/session_manager_client.h"
|
| #include "chromeos/disks/disk_mount_manager.h"
|
| #include "chromeos/display/output_configurator.h"
|
| +#include "chromeos/network/connection_change_notifier_factory.h"
|
| #include "chromeos/network/network_event_log.h"
|
| #include "chromeos/network/network_state_handler.h"
|
| #include "chromeos/power/power_state_override.h"
|
| @@ -243,7 +244,10 @@ class DBusServices {
|
| // Initialize the network change notifier for Chrome OS. The network
|
| // change notifier starts to monitor changes from the power manager and
|
| // the network manager.
|
| - CrosNetworkChangeNotifierFactory::GetInstance()->Init();
|
| + if (!CommandLine::ForCurrentProcess()->HasSwitch(
|
| + chromeos::switches::kEnableNewNetworkHandlers)) {
|
| + CrosNetworkChangeNotifierFactory::GetInstance()->Init();
|
| + }
|
|
|
| // Likewise, initialize the upgrade detector for Chrome OS. The upgrade
|
| // detector starts to monitor changes from the update engine.
|
| @@ -275,6 +279,9 @@ class DBusServices {
|
| chromeos::network_event_log::Initialize();
|
| chromeos::NetworkStateHandler::Initialize();
|
| network_handlers_initialized_ = true;
|
| + // TODO(gauravsh): This needs re-factoring. NetworkChangeNotifier choice
|
| + // needs to be made before about:flags are processed.
|
| + ConnectionChangeNotifierFactory::GetInstance()->Initialize();
|
| }
|
|
|
| ~DBusServices() {
|
| @@ -365,9 +372,18 @@ void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() {
|
| // Replace the default NetworkChangeNotifierFactory with ChromeOS specific
|
| // implementation. This must be done before BrowserMainLoop calls
|
| // net::NetworkChangeNotifier::Create() in MainMessageLoopStart().
|
| - net::NetworkChangeNotifier::SetFactory(
|
| - new CrosNetworkChangeNotifierFactory());
|
| -
|
| + net::NetworkChangeNotifierFactory* network_change_factory;
|
| + // Note: At the time this is called, we have not processed about:flags
|
| + // so this requires that the network handler flag was passed in at the command
|
| + // line.
|
| + if (!CommandLine::ForCurrentProcess()->HasSwitch(
|
| + chromeos::switches::kEnableNewNetworkHandlers)) {
|
| + network_change_factory = new CrosNetworkChangeNotifierFactory();
|
| + } else {
|
| + LOG(ERROR) << "Using new connection change notifier.";
|
| + network_change_factory = new ConnectionChangeNotifierFactory();
|
| + }
|
| + net::NetworkChangeNotifier::SetFactory(network_change_factory);
|
| ChromeBrowserMainPartsLinux::PreMainMessageLoopStart();
|
| }
|
|
|
| @@ -382,7 +398,6 @@ void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() {
|
|
|
| // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun.
|
| // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads.
|
| -
|
| void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() {
|
| // Must be called after about_flags settings are applied (see note above).
|
| dbus_services_->InitializeNetworkHandlers();
|
| @@ -612,6 +627,8 @@ void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() {
|
| // the network manager.
|
| if (CrosNetworkChangeNotifierFactory::GetInstance())
|
| CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown();
|
| + if (ConnectionChangeNotifierFactory::GetInstance())
|
| + ConnectionChangeNotifierFactory::GetInstance()->Shutdown();
|
|
|
| if (chromeos::NetworkPortalDetector::IsEnabled() &&
|
| chromeos::NetworkPortalDetector::GetInstance()) {
|
|
|