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" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 chromeos::SystemKeyEventListener::Initialize(); | 343 chromeos::SystemKeyEventListener::Initialize(); |
| 344 } | 344 } |
| 345 | 345 |
| 346 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); | 346 ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); |
| 347 } | 347 } |
| 348 | 348 |
| 349 void ChromeBrowserMainPartsChromeos::PreProfileInit() { | 349 void ChromeBrowserMainPartsChromeos::PreProfileInit() { |
| 350 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 350 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 351 // -- immediately before Profile creation(). | 351 // -- immediately before Profile creation(). |
| 352 | 352 |
| 353 // In Aura builds this will initialize ash::Shell. Call it first so that | |
| 354 // the device scale factor is available when loading images. | |
|
oshima
2012/10/10 16:21:28
// Call it first before performing UI related task
stevenjb
2012/10/10 17:07:27
How this initializes Ash is not entirely obvious,
| |
| 355 ChromeBrowserMainPartsLinux::PreProfileInit(); | |
| 356 | |
| 353 // Now that the file thread exists we can record our stats. | 357 // Now that the file thread exists we can record our stats. |
| 354 chromeos::BootTimesLoader::Get()->RecordChromeMainStats(); | 358 chromeos::BootTimesLoader::Get()->RecordChromeMainStats(); |
|
stevenjb
2012/10/10 17:07:27
This should probably still be first.
| |
| 355 | 359 |
| 356 // Trigger prefetching of ownership status. | 360 // Trigger prefetching of ownership status. |
| 357 chromeos::DeviceSettingsService::Get()->Load(); | 361 chromeos::DeviceSettingsService::Get()->Load(); |
| 358 | 362 |
| 359 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 363 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 360 // -- just before CreateProfile(). | 364 // -- just before CreateProfile(). |
| 361 | 365 |
| 362 // Initialize the screen locker now so that it can receive | 366 // Initialize the screen locker now so that it can receive |
| 363 // LOGIN_USER_CHANGED notification from UserManager. | 367 // LOGIN_USER_CHANGED notification from UserManager. |
| 364 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { | 368 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { |
| 365 chromeos::KioskModeIdleLogout::Initialize(); | 369 chromeos::KioskModeIdleLogout::Initialize(); |
| 366 } else { | 370 } else { |
| 367 chromeos::ScreenLocker::InitClass(); | 371 chromeos::ScreenLocker::InitClass(); |
| 368 } | 372 } |
| 369 | 373 |
| 370 // This forces the ProfileManager to be created and register for the | 374 // This forces the ProfileManager to be created and register for the |
| 371 // notification it needs to track the logged in user. | 375 // notification it needs to track the logged in user. |
| 372 g_browser_process->profile_manager(); | 376 g_browser_process->profile_manager(); |
|
stevenjb
2012/10/10 17:07:27
I assume this has been carefully tested? I'd worry
| |
| 373 | 377 |
| 374 // TODO(abarth): Should this move to InitializeNetworkOptions()? | 378 // TODO(abarth): Should this move to InitializeNetworkOptions()? |
| 375 // Allow access to file:// on ChromeOS for tests. | 379 // Allow access to file:// on ChromeOS for tests. |
| 376 if (parsed_command_line().HasSwitch(switches::kAllowFileAccess)) | 380 if (parsed_command_line().HasSwitch(switches::kAllowFileAccess)) |
| 377 ChromeNetworkDelegate::AllowAccessToAllFiles(); | 381 ChromeNetworkDelegate::AllowAccessToAllFiles(); |
| 378 | 382 |
| 379 if (parsed_command_line().HasSwitch(switches::kEnableContacts)) { | 383 if (parsed_command_line().HasSwitch(switches::kEnableContacts)) { |
| 380 contact_manager_.reset(new contacts::ContactManager()); | 384 contact_manager_.reset(new contacts::ContactManager()); |
| 381 contact_manager_->Init(); | 385 contact_manager_->Init(); |
| 382 } | 386 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 398 | 402 |
| 399 // Initialize user policy before creating the profile so the profile | 403 // Initialize user policy before creating the profile so the profile |
| 400 // initialization code sees policy settings. | 404 // initialization code sees policy settings. |
| 401 // Guest accounts are not subject to user policy. | 405 // Guest accounts are not subject to user policy. |
| 402 if (!chromeos::UserManager::Get()->IsLoggedInAsGuest()) { | 406 if (!chromeos::UserManager::Get()->IsLoggedInAsGuest()) { |
| 403 g_browser_process->browser_policy_connector()->InitializeUserPolicy( | 407 g_browser_process->browser_policy_connector()->InitializeUserPolicy( |
| 404 username, false /* wait_for_policy_fetch */); | 408 username, false /* wait_for_policy_fetch */); |
| 405 } | 409 } |
| 406 chromeos::UserManager::Get()->SessionStarted(); | 410 chromeos::UserManager::Get()->SessionStarted(); |
| 407 } | 411 } |
| 408 | |
| 409 // In Aura builds this will initialize ash::Shell. | |
| 410 ChromeBrowserMainPartsLinux::PreProfileInit(); | |
| 411 } | 412 } |
| 412 | 413 |
| 413 void ChromeBrowserMainPartsChromeos::PostProfileInit() { | 414 void ChromeBrowserMainPartsChromeos::PostProfileInit() { |
| 414 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 415 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 415 // -- just after CreateProfile(). | 416 // -- just after CreateProfile(). |
| 416 | 417 |
| 417 policy::BrowserPolicyConnector* connector = | 418 policy::BrowserPolicyConnector* connector = |
| 418 g_browser_process->browser_policy_connector(); | 419 g_browser_process->browser_policy_connector(); |
| 419 | 420 |
| 420 if (parsed_command_line().HasSwitch(switches::kLoginUser) && | 421 if (parsed_command_line().HasSwitch(switches::kLoginUser) && |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 LOG(WARNING) << "low_mem: Part of '100MB' experiment"; | 618 LOG(WARNING) << "low_mem: Part of '100MB' experiment"; |
| 618 chromeos::LowMemoryObserver::SetLowMemoryMargin(100); | 619 chromeos::LowMemoryObserver::SetLowMemoryMargin(100); |
| 619 } else if (trial->group() == margin_200mb) { | 620 } else if (trial->group() == margin_200mb) { |
| 620 LOG(WARNING) << "low_mem: Part of '200MB' experiment"; | 621 LOG(WARNING) << "low_mem: Part of '200MB' experiment"; |
| 621 chromeos::LowMemoryObserver::SetLowMemoryMargin(200); | 622 chromeos::LowMemoryObserver::SetLowMemoryMargin(200); |
| 622 } else { | 623 } else { |
| 623 LOG(WARNING) << "low_mem: Part of 'default' experiment"; | 624 LOG(WARNING) << "low_mem: Part of 'default' experiment"; |
| 624 } | 625 } |
| 625 } | 626 } |
| 626 } | 627 } |
| OLD | NEW |