Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/chromeos/chromeos_version.h" | 13 #include "base/chromeos/chromeos_version.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
| 18 #include "base/string_split.h" | 18 #include "base/string_split.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/chromeos/audio/audio_handler.h" | 20 #include "chrome/browser/chromeos/audio/audio_handler.h" |
| 21 #include "chrome/browser/chromeos/boot_times_loader.h" | 21 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 22 #include "chrome/browser/chromeos/contacts/contact_manager.h" | 22 #include "chrome/browser/chromeos/contacts/contact_manager.h" |
| 23 #include "chrome/browser/chromeos/cros/cros_library.h" | 23 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 24 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" | 24 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" |
| 25 #include "chrome/browser/chromeos/display/display_preferences.h" | 25 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 26 #include "chrome/browser/chromeos/display/primary_display_switch_observer.h" | 26 #include "chrome/browser/chromeos/display/primary_display_switch_observer.h" |
| 27 #include "chrome/browser/chromeos/external_metrics.h" | 27 #include "chrome/browser/chromeos/external_metrics.h" |
| 28 #include "chrome/browser/chromeos/extensions/default_app_order.h" | |
| 28 #include "chrome/browser/chromeos/imageburner/burn_manager.h" | 29 #include "chrome/browser/chromeos/imageburner/burn_manager.h" |
| 29 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 30 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 30 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 31 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
| 31 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" | 32 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" |
| 32 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" | 33 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" |
| 33 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 34 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 34 #include "chrome/browser/chromeos/login/authenticator.h" | 35 #include "chrome/browser/chromeos/login/authenticator.h" |
| 35 #include "chrome/browser/chromeos/login/login_utils.h" | 36 #include "chrome/browser/chromeos/login/login_utils.h" |
| 36 #include "chrome/browser/chromeos/login/login_wizard.h" | 37 #include "chrome/browser/chromeos/login/login_wizard.h" |
| 37 #include "chrome/browser/chromeos/login/screen_locker.h" | 38 #include "chrome/browser/chromeos/login/screen_locker.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 } | 323 } |
| 323 | 324 |
| 324 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); | 325 ChromeBrowserMainPartsLinux::PostMainMessageLoopStart(); |
| 325 } | 326 } |
| 326 | 327 |
| 327 // Threads are initialized MainMessageLoopStart and MainMessageLoopRun. | 328 // Threads are initialized MainMessageLoopStart and MainMessageLoopRun. |
| 328 | 329 |
| 329 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { | 330 void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { |
| 330 chromeos::AudioHandler::Initialize(); | 331 chromeos::AudioHandler::Initialize(); |
| 331 chromeos::imageburner::BurnManager::Initialize(); | 332 chromeos::imageburner::BurnManager::Initialize(); |
| 333 app_order_loader_.reset(new chromeos::default_app_order::ExternalLoader); | |
| 332 | 334 |
| 333 // Listen for system key events so that the user will be able to adjust the | 335 // Listen for system key events so that the user will be able to adjust the |
| 334 // volume on the login screen, if Chrome is running on Chrome OS | 336 // volume on the login screen, if Chrome is running on Chrome OS |
| 335 // (i.e. not Linux desktop), and in non-test mode. | 337 // (i.e. not Linux desktop), and in non-test mode. |
| 336 // Note: SystemKeyEventListener depends on the DBus thread. | 338 // Note: SystemKeyEventListener depends on the DBus thread. |
| 337 if (base::chromeos::IsRunningOnChromeOS() && | 339 if (base::chromeos::IsRunningOnChromeOS() && |
| 338 !parameters().ui_task) { // ui_task is non-NULL when running tests. | 340 !parameters().ui_task) { // ui_task is non-NULL when running tests. |
| 339 chromeos::SystemKeyEventListener::Initialize(); | 341 chromeos::SystemKeyEventListener::Initialize(); |
| 340 } | 342 } |
| 341 | 343 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 // Redirects Chrome logging to the user data dir. | 394 // Redirects Chrome logging to the user data dir. |
| 393 logging::RedirectChromeLogging(parsed_command_line()); | 395 logging::RedirectChromeLogging(parsed_command_line()); |
| 394 | 396 |
| 395 // Initialize user policy before creating the profile so the profile | 397 // Initialize user policy before creating the profile so the profile |
| 396 // initialization code sees policy settings. | 398 // initialization code sees policy settings. |
| 397 // Guest accounts are not subject to user policy. | 399 // Guest accounts are not subject to user policy. |
| 398 if (!chromeos::UserManager::Get()->IsLoggedInAsGuest()) { | 400 if (!chromeos::UserManager::Get()->IsLoggedInAsGuest()) { |
| 399 g_browser_process->browser_policy_connector()->InitializeUserPolicy( | 401 g_browser_process->browser_policy_connector()->InitializeUserPolicy( |
| 400 username, false /* wait_for_policy_fetch */); | 402 username, false /* wait_for_policy_fetch */); |
| 401 } | 403 } |
| 404 | |
| 405 // Ensures the default app order is loaded before profile load. | |
| 406 // This is only needed for user already signed-in case. In normal | |
| 407 // chromeos session, the loading happens asynchronously and should be | |
| 408 // finished before user signs in. | |
| 409 app_order_loader_->WaitForLoad(); | |
|
tbarzic
2012/10/26 21:56:28
Is there any way to get rid of this?
looks so ugly
xiyuan
2012/10/26 22:39:25
I removed the wait call but we still have to do a
| |
| 410 | |
| 402 chromeos::UserManager::Get()->SessionStarted(); | 411 chromeos::UserManager::Get()->SessionStarted(); |
| 403 } | 412 } |
| 404 | 413 |
| 405 // In Aura builds this will initialize ash::Shell. | 414 // In Aura builds this will initialize ash::Shell. |
| 406 ChromeBrowserMainPartsLinux::PreProfileInit(); | 415 ChromeBrowserMainPartsLinux::PreProfileInit(); |
| 407 } | 416 } |
| 408 | 417 |
| 409 void ChromeBrowserMainPartsChromeos::PostProfileInit() { | 418 void ChromeBrowserMainPartsChromeos::PostProfileInit() { |
| 410 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 419 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 411 // -- just after CreateProfile(). | 420 // -- just after CreateProfile(). |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 LOG(WARNING) << "low_mem: Part of '100MB' experiment"; | 621 LOG(WARNING) << "low_mem: Part of '100MB' experiment"; |
| 613 chromeos::LowMemoryObserver::SetLowMemoryMargin(100); | 622 chromeos::LowMemoryObserver::SetLowMemoryMargin(100); |
| 614 } else if (trial->group() == margin_200mb) { | 623 } else if (trial->group() == margin_200mb) { |
| 615 LOG(WARNING) << "low_mem: Part of '200MB' experiment"; | 624 LOG(WARNING) << "low_mem: Part of '200MB' experiment"; |
| 616 chromeos::LowMemoryObserver::SetLowMemoryMargin(200); | 625 chromeos::LowMemoryObserver::SetLowMemoryMargin(200); |
| 617 } else { | 626 } else { |
| 618 LOG(WARNING) << "low_mem: Part of 'default' experiment"; | 627 LOG(WARNING) << "low_mem: Part of 'default' experiment"; |
| 619 } | 628 } |
| 620 } | 629 } |
| 621 } | 630 } |
| OLD | NEW |