| OLD | NEW |
| 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" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/chromeos/chromeos_version.h" | |
| 15 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 16 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 17 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 18 #include "base/linux_util.h" | 17 #include "base/linux_util.h" |
| 19 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 20 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 21 #include "base/prefs/pref_service.h" | 20 #include "base/prefs/pref_service.h" |
| 22 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
| 23 #include "base/strings/string_split.h" | 22 #include "base/strings/string_split.h" |
| 24 #include "base/sys_info.h" | 23 #include "base/sys_info.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } // namespace | 251 } // namespace |
| 253 | 252 |
| 254 namespace internal { | 253 namespace internal { |
| 255 | 254 |
| 256 // Wrapper class for initializing dbus related services and shutting them | 255 // Wrapper class for initializing dbus related services and shutting them |
| 257 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the | 256 // down. This gets instantiated in a scoped_ptr so that shutdown methods in the |
| 258 // destructor will get called if and only if this has been instantiated. | 257 // destructor will get called if and only if this has been instantiated. |
| 259 class DBusServices { | 258 class DBusServices { |
| 260 public: | 259 public: |
| 261 explicit DBusServices(const content::MainFunctionParams& parameters) { | 260 explicit DBusServices(const content::MainFunctionParams& parameters) { |
| 262 if (!base::chromeos::IsRunningOnChromeOS()) { | 261 if (!base::SysInfo::IsRunningOnChromeOS()) { |
| 263 // Override this path on the desktop, so that the user policy key can be | 262 // Override this path on the desktop, so that the user policy key can be |
| 264 // stored by the stub SessionManagerClient. | 263 // stored by the stub SessionManagerClient. |
| 265 base::FilePath user_data_dir; | 264 base::FilePath user_data_dir; |
| 266 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { | 265 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { |
| 267 PathService::Override(chromeos::DIR_USER_POLICY_KEYS, | 266 PathService::Override(chromeos::DIR_USER_POLICY_KEYS, |
| 268 user_data_dir.AppendASCII("stub_user_policy")); | 267 user_data_dir.AppendASCII("stub_user_policy")); |
| 269 } | 268 } |
| 270 } | 269 } |
| 271 | 270 |
| 272 // Initialize DBusThreadManager for the browser. This must be done after | 271 // Initialize DBusThreadManager for the browser. This must be done after |
| (...skipping 19 matching lines...) Expand all Loading... |
| 292 | 291 |
| 293 // Initialize the network change notifier for Chrome OS. The network | 292 // Initialize the network change notifier for Chrome OS. The network |
| 294 // change notifier starts to monitor changes from the power manager and | 293 // change notifier starts to monitor changes from the power manager and |
| 295 // the network manager. | 294 // the network manager. |
| 296 NetworkChangeNotifierFactoryChromeos::GetInstance()->Initialize(); | 295 NetworkChangeNotifierFactoryChromeos::GetInstance()->Initialize(); |
| 297 | 296 |
| 298 // Likewise, initialize the upgrade detector for Chrome OS. The upgrade | 297 // Likewise, initialize the upgrade detector for Chrome OS. The upgrade |
| 299 // detector starts to monitor changes from the update engine. | 298 // detector starts to monitor changes from the update engine. |
| 300 UpgradeDetectorChromeos::GetInstance()->Init(); | 299 UpgradeDetectorChromeos::GetInstance()->Init(); |
| 301 | 300 |
| 302 if (base::chromeos::IsRunningOnChromeOS()) { | 301 if (base::SysInfo::IsRunningOnChromeOS()) { |
| 303 // Disable Num Lock on X start up for http://crosbug.com/29169. | 302 // Disable Num Lock on X start up for http://crosbug.com/29169. |
| 304 input_method::InputMethodManager::Get()->GetXKeyboard()-> | 303 input_method::InputMethodManager::Get()->GetXKeyboard()-> |
| 305 SetNumLockEnabled(false); | 304 SetNumLockEnabled(false); |
| 306 } | 305 } |
| 307 | 306 |
| 308 // Initialize the device settings service so that we'll take actions per | 307 // Initialize the device settings service so that we'll take actions per |
| 309 // signals sent from the session manager. This needs to happen before | 308 // signals sent from the session manager. This needs to happen before |
| 310 // g_browser_process initializes BrowserPolicyConnector. | 309 // g_browser_process initializes BrowserPolicyConnector. |
| 311 DeviceSettingsService::Initialize(); | 310 DeviceSettingsService::Initialize(); |
| 312 DeviceSettingsService::Get()->SetSessionManager( | 311 DeviceSettingsService::Get()->SetSessionManager( |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 if (parsed_command_line().HasSwitch(switches::kGuestSession)) { | 362 if (parsed_command_line().HasSwitch(switches::kGuestSession)) { |
| 364 // Disable sync and extensions if we're in "browse without sign-in" mode. | 363 // Disable sync and extensions if we're in "browse without sign-in" mode. |
| 365 singleton_command_line->AppendSwitch(::switches::kDisableSync); | 364 singleton_command_line->AppendSwitch(::switches::kDisableSync); |
| 366 singleton_command_line->AppendSwitch(::switches::kDisableExtensions); | 365 singleton_command_line->AppendSwitch(::switches::kDisableExtensions); |
| 367 browser_defaults::bookmarks_enabled = false; | 366 browser_defaults::bookmarks_enabled = false; |
| 368 } | 367 } |
| 369 | 368 |
| 370 // If we're not running on real ChromeOS hardware (or under VM), and are not | 369 // If we're not running on real ChromeOS hardware (or under VM), and are not |
| 371 // showing the login manager or attempting a command line login, login with a | 370 // showing the login manager or attempting a command line login, login with a |
| 372 // stub user. | 371 // stub user. |
| 373 if (!base::chromeos::IsRunningOnChromeOS() && | 372 if (!base::SysInfo::IsRunningOnChromeOS() && |
| 374 !parsed_command_line().HasSwitch(switches::kLoginManager) && | 373 !parsed_command_line().HasSwitch(switches::kLoginManager) && |
| 375 !parsed_command_line().HasSwitch(switches::kLoginUser) && | 374 !parsed_command_line().HasSwitch(switches::kLoginUser) && |
| 376 !parsed_command_line().HasSwitch(switches::kGuestSession)) { | 375 !parsed_command_line().HasSwitch(switches::kGuestSession)) { |
| 377 singleton_command_line->AppendSwitchASCII( | 376 singleton_command_line->AppendSwitchASCII( |
| 378 switches::kLoginUser, UserManager::kStubUser); | 377 switches::kLoginUser, UserManager::kStubUser); |
| 379 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { | 378 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { |
| 380 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, | 379 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, |
| 381 chrome::kTestUserProfileDir); | 380 chrome::kTestUserProfileDir); |
| 382 } | 381 } |
| 383 LOG(INFO) << "Running as stub user with profile dir: " | 382 LOG(INFO) << "Running as stub user with profile dir: " |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 | 432 |
| 434 base::FilePath downloads_directory; | 433 base::FilePath downloads_directory; |
| 435 CHECK(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory)); | 434 CHECK(PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_directory)); |
| 436 imageburner::BurnManager::Initialize( | 435 imageburner::BurnManager::Initialize( |
| 437 downloads_directory, g_browser_process->system_request_context()); | 436 downloads_directory, g_browser_process->system_request_context()); |
| 438 | 437 |
| 439 // Listen for system key events so that the user will be able to adjust the | 438 // Listen for system key events so that the user will be able to adjust the |
| 440 // volume on the login screen, if Chrome is running on Chrome OS | 439 // volume on the login screen, if Chrome is running on Chrome OS |
| 441 // (i.e. not Linux desktop), and in non-test mode. | 440 // (i.e. not Linux desktop), and in non-test mode. |
| 442 // Note: SystemKeyEventListener depends on the DBus thread. | 441 // Note: SystemKeyEventListener depends on the DBus thread. |
| 443 if (base::chromeos::IsRunningOnChromeOS() && | 442 if (base::SysInfo::IsRunningOnChromeOS() && |
| 444 !parameters().ui_task) { // ui_task is non-NULL when running tests. | 443 !parameters().ui_task) { // ui_task is non-NULL when running tests. |
| 445 SystemKeyEventListener::Initialize(); | 444 SystemKeyEventListener::Initialize(); |
| 446 } | 445 } |
| 447 | 446 |
| 448 DeviceOAuth2TokenServiceFactory::Initialize(); | 447 DeviceOAuth2TokenServiceFactory::Initialize(); |
| 449 | 448 |
| 450 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); | 449 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); |
| 451 } | 450 } |
| 452 | 451 |
| 453 void ChromeBrowserMainPartsChromeos::PreProfileInit() { | 452 void ChromeBrowserMainPartsChromeos::PreProfileInit() { |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 | 789 |
| 791 // Destroy DeviceSettingsService after g_browser_process. | 790 // Destroy DeviceSettingsService after g_browser_process. |
| 792 DeviceSettingsService::Shutdown(); | 791 DeviceSettingsService::Shutdown(); |
| 793 } | 792 } |
| 794 | 793 |
| 795 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { | 794 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { |
| 796 default_pinned_apps_field_trial::SetupTrial(); | 795 default_pinned_apps_field_trial::SetupTrial(); |
| 797 } | 796 } |
| 798 | 797 |
| 799 } // namespace chromeos | 798 } // namespace chromeos |
| OLD | NEW |