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

Side by Side Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 258743005: Enable Enterprise enrollment on desktop builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linkage visibility of policy protobufs Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } // namespace 238 } // namespace
239 239
240 namespace internal { 240 namespace internal {
241 241
242 // Wrapper class for initializing dbus related services and shutting them 242 // Wrapper class for initializing dbus related services and shutting them
243 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the 243 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the
244 // destructor will get called if and only if this has been instantiated. 244 // destructor will get called if and only if this has been instantiated.
245 class DBusServices { 245 class DBusServices {
246 public: 246 public:
247 explicit DBusServices(const content::MainFunctionParams& parameters) { 247 explicit DBusServices(const content::MainFunctionParams& parameters) {
248 if (!base::SysInfo::IsRunningOnChromeOS()) {
249 // Override this path on the desktop, so that the user policy key can be
250 // stored by the stub SessionManagerClient.
251 base::FilePath user_data_dir;
252 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) {
253 PathService::Override(chromeos::DIR_USER_POLICY_KEYS,
254 user_data_dir.AppendASCII("stub_user_policy"));
255 }
256 }
257
258 // Initialize DBusThreadManager for the browser. This must be done after 248 // Initialize DBusThreadManager for the browser. This must be done after
259 // the main message loop is started, as it uses the message loop. 249 // the main message loop is started, as it uses the message loop.
260 DBusThreadManager::Initialize(); 250 DBusThreadManager::Initialize();
261 CrosDBusService::Initialize(); 251 CrosDBusService::Initialize();
262 252
263 // Initialize PowerDataCollector after DBusThreadManager is initialized. 253 // Initialize PowerDataCollector after DBusThreadManager is initialized.
264 PowerDataCollector::Initialize(); 254 PowerDataCollector::Initialize();
265 255
266 LoginState::Initialize(); 256 LoginState::Initialize();
267 SystemSaltGetter::Initialize(); 257 SystemSaltGetter::Initialize();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { 385 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() {
396 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific 386 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific
397 // implementation. This must be done before BrowserMainLoop calls 387 // implementation. This must be done before BrowserMainLoop calls
398 // net::NetworkChangeNotifier::Create() in MainMessageLoopStart(). 388 // net::NetworkChangeNotifier::Create() in MainMessageLoopStart().
399 net::NetworkChangeNotifier::SetFactory( 389 net::NetworkChangeNotifier::SetFactory(
400 new NetworkChangeNotifierFactoryChromeos()); 390 new NetworkChangeNotifierFactoryChromeos());
401 ChromeBrowserMainPartsLinux::PreMainMessageLoopStart(); 391 ChromeBrowserMainPartsLinux::PreMainMessageLoopStart();
402 } 392 }
403 393
404 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { 394 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() {
395 base::FilePath user_data_dir;
396 if (!base::SysInfo::IsRunningOnChromeOS() &&
397 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) {
398 // Override some paths with stub locations so that cloud policy and
399 // enterprise enrollment work on desktop builds, for ease of
400 // development.
401 chromeos::RegisterStubPathOverrides(user_data_dir);
402 }
403
405 dbus_services_.reset(new internal::DBusServices(parameters())); 404 dbus_services_.reset(new internal::DBusServices(parameters()));
406 405
407 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); 406 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart();
408 } 407 }
409 408
410 // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun. 409 // Threads are initialized between MainMessageLoopStart and MainMessageLoopRun.
411 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads. 410 // about_flags settings are applied in ChromeBrowserMainParts::PreCreateThreads.
412 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { 411 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() {
413 // Set the crypto thread after the IO thread has been created/started. 412 // Set the crypto thread after the IO thread has been created/started.
414 TPMTokenLoader::Get()->SetCryptoTaskRunner( 413 TPMTokenLoader::Get()->SetCryptoTaskRunner(
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 // Destroy DBus services immediately after threads are stopped. 850 // Destroy DBus services immediately after threads are stopped.
852 dbus_services_.reset(); 851 dbus_services_.reset();
853 852
854 ChromeBrowserMainPartsLinux::PostDestroyThreads(); 853 ChromeBrowserMainPartsLinux::PostDestroyThreads();
855 854
856 // Destroy DeviceSettingsService after g_browser_process. 855 // Destroy DeviceSettingsService after g_browser_process.
857 DeviceSettingsService::Shutdown(); 856 DeviceSettingsService::Shutdown();
858 } 857 }
859 858
860 } // namespace chromeos 859 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698