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

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: Move to net/base 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/network/managed_state.h » ('j') | net/base/network_change_notifier_chromeos.h » ('J')
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 6df5bd325db2aee599977e87c71eb42c77a064ba..2071583322ba2eb2e7c54c998ec6eaa42dde98a7 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -91,6 +91,8 @@
#include "content/public/common/main_function_params.h"
#include "grit/platform_locale_settings.h"
#include "net/base/network_change_notifier.h"
+#include "net/base/network_change_notifier_chromeos.h"
+#include "net/base/network_change_notifier_factory_chromeos.h"
#include "net/url_request/url_request.h"
namespace chromeos {
@@ -252,7 +254,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.
@@ -285,6 +290,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.
+ net::NetworkChangeNotifierFactoryChromeos::GetInstance()->Initialize();
}
~DBusServices() {
@@ -376,9 +384,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.";
stevenjb 2012/12/13 19:28:22 Let's make this a WARNING instead of an ERROR, it
gauravsh 2012/12/15 00:42:45 Done.
+ network_change_factory = new net::NetworkChangeNotifierFactoryChromeos();
+ }
+ net::NetworkChangeNotifier::SetFactory(network_change_factory);
ChromeBrowserMainPartsLinux::PreMainMessageLoopStart();
}
@@ -393,7 +410,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();
@@ -633,6 +649,8 @@ void ChromeBrowserMainPartsChromeos::PostMainMessageLoopRun() {
// the network manager.
if (CrosNetworkChangeNotifierFactory::GetInstance())
CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown();
+ if (net::NetworkChangeNotifierFactoryChromeos::GetInstance())
+ net::NetworkChangeNotifierFactoryChromeos::GetInstance()->Shutdown();
if (chromeos::NetworkPortalDetector::IsEnabled() &&
chromeos::NetworkPortalDetector::GetInstance()) {
« no previous file with comments | « no previous file | chromeos/network/managed_state.h » ('j') | net/base/network_change_notifier_chromeos.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698