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

Unified Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 11469044: Implement new network change notifier that uses NetworkStateHandler (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix clang warning (missing virtual on OVERRIDE) Created 8 years 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 | chromeos/chromeos.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 930d33bb89df90ca212a2533f2362b525ed81c43..97f5f38221b4e687dd180134347df1f8a2ff3301 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -85,6 +85,8 @@
#include "chromeos/dbus/session_manager_client.h"
#include "chromeos/disks/disk_mount_manager.h"
#include "chromeos/display/output_configurator.h"
+#include "chromeos/network/network_change_notifier_chromeos.h"
+#include "chromeos/network/network_change_notifier_factory_chromeos.h"
#include "chromeos/network/network_configuration_handler.h"
#include "chromeos/network/network_event_log.h"
#include "chromeos/network/network_state_handler.h"
@@ -254,7 +256,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.
@@ -287,6 +292,9 @@ class DBusServices {
chromeos::NetworkStateHandler::Initialize();
chromeos::NetworkConfigurationHandler::Initialize();
network_handlers_initialized_ = true;
+ // TODO(gauravsh): This needs re-factoring. NetworkChangeNotifier choice
+ // needs to be made before about:flags are processed.
+ NetworkChangeNotifierFactoryChromeos::GetInstance()->Initialize();
}
~DBusServices() {
@@ -382,9 +390,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(WARNING) << "Using new connection change notifier.";
+ network_change_factory = new NetworkChangeNotifierFactoryChromeos();
+ }
+ net::NetworkChangeNotifier::SetFactory(network_change_factory);
ChromeBrowserMainPartsLinux::PreMainMessageLoopStart();
}
@@ -399,7 +416,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();
@@ -641,6 +657,8 @@ void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() {
// the network manager.
if (CrosNetworkChangeNotifierFactory::GetInstance())
CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown();
+ if (NetworkChangeNotifierFactoryChromeos::GetInstance())
+ NetworkChangeNotifierFactoryChromeos::GetInstance()->Shutdown();
if (chromeos::NetworkPortalDetector::IsEnabled() &&
chromeos::NetworkPortalDetector::GetInstance()) {
« no previous file with comments | « no previous file | chromeos/chromeos.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698