| 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 return NULL; | 381 return NULL; |
| 382 } | 382 } |
| 383 | 383 |
| 384 #if defined(OS_MACOSX) | 384 #if defined(OS_MACOSX) |
| 385 OSStatus KeychainCallback(SecKeychainEvent keychain_event, | 385 OSStatus KeychainCallback(SecKeychainEvent keychain_event, |
| 386 SecKeychainCallbackInfo* info, void* context) { | 386 SecKeychainCallbackInfo* info, void* context) { |
| 387 return noErr; | 387 return noErr; |
| 388 } | 388 } |
| 389 #endif | 389 #endif |
| 390 | 390 |
| 391 #if !defined(OS_ANDROID) | |
| 392 void RegisterComponentsForUpdate(const CommandLine& command_line) { | 391 void RegisterComponentsForUpdate(const CommandLine& command_line) { |
| 393 ComponentUpdateService* cus = g_browser_process->component_updater(); | 392 ComponentUpdateService* cus = g_browser_process->component_updater(); |
| 394 | 393 |
| 395 // Registration can be before or after cus->Start() so it is ok to post | 394 // Registration can be before or after cus->Start() so it is ok to post |
| 396 // a task to the UI thread to do registration once you done the necessary | 395 // a task to the UI thread to do registration once you done the necessary |
| 397 // file IO to know you existing component version. | 396 // file IO to know you existing component version. |
| 398 #if !defined(OS_CHROMEOS) | 397 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
| 399 RegisterRecoveryComponent(cus, g_browser_process->local_state()); | 398 RegisterRecoveryComponent(cus, g_browser_process->local_state()); |
| 400 RegisterPepperFlashComponent(cus); | 399 RegisterPepperFlashComponent(cus); |
| 401 RegisterSwiftShaderComponent(cus); | 400 RegisterSwiftShaderComponent(cus); |
| 402 #endif | 401 #endif |
| 403 | 402 |
| 403 #if !defined(OS_ANDROID) |
| 404 g_browser_process->pnacl_component_installer()->RegisterPnaclComponent( | 404 g_browser_process->pnacl_component_installer()->RegisterPnaclComponent( |
| 405 cus, command_line); | 405 cus, command_line); |
| 406 #endif |
| 407 |
| 408 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
| 409 RegisterWidevineCdmComponent(cus); |
| 410 #endif |
| 406 | 411 |
| 407 #if !defined(OS_CHROMEOS) | 412 #if !defined(OS_CHROMEOS) |
| 408 RegisterWidevineCdmComponent(cus); | |
| 409 | |
| 410 // CRLSetFetcher attempts to load a CRL set from either the local disk or | 413 // CRLSetFetcher attempts to load a CRL set from either the local disk or |
| 411 // network. | 414 // network. |
| 412 if (!command_line.HasSwitch(switches::kDisableCRLSets)) | 415 if (!command_line.HasSwitch(switches::kDisableCRLSets)) |
| 413 g_browser_process->crl_set_fetcher()->StartInitialLoad(cus); | 416 g_browser_process->crl_set_fetcher()->StartInitialLoad(cus); |
| 414 #endif | 417 #endif |
| 415 | 418 |
| 416 cus->Start(); | 419 cus->Start(); |
| 417 } | 420 } |
| 418 | 421 |
| 422 #if !defined(OS_ANDROID) |
| 419 bool ProcessSingletonNotificationCallback( | 423 bool ProcessSingletonNotificationCallback( |
| 420 const CommandLine& command_line, | 424 const CommandLine& command_line, |
| 421 const base::FilePath& current_directory) { | 425 const base::FilePath& current_directory) { |
| 422 // Drop the request if the browser process is already in shutdown path. | 426 // Drop the request if the browser process is already in shutdown path. |
| 423 if (!g_browser_process || g_browser_process->IsShuttingDown()) | 427 if (!g_browser_process || g_browser_process->IsShuttingDown()) |
| 424 return false; | 428 return false; |
| 425 | 429 |
| 426 if (command_line.HasSwitch(switches::kOriginalProcessStartTime)) { | 430 if (command_line.HasSwitch(switches::kOriginalProcessStartTime)) { |
| 427 std::string start_time_string = | 431 std::string start_time_string = |
| 428 command_line.GetSwitchValueASCII(switches::kOriginalProcessStartTime); | 432 command_line.GetSwitchValueASCII(switches::kOriginalProcessStartTime); |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 PrefMetricsService::Factory::GetForProfile(profile_); | 1473 PrefMetricsService::Factory::GetForProfile(profile_); |
| 1470 | 1474 |
| 1471 PreBrowserStart(); | 1475 PreBrowserStart(); |
| 1472 | 1476 |
| 1473 // Instantiate the notification UI manager, as this triggers a perf timer | 1477 // Instantiate the notification UI manager, as this triggers a perf timer |
| 1474 // used to measure startup time. TODO(stevenjb): Figure out what is actually | 1478 // used to measure startup time. TODO(stevenjb): Figure out what is actually |
| 1475 // triggering the timer and call that explicitly in the approprate place. | 1479 // triggering the timer and call that explicitly in the approprate place. |
| 1476 // http://crbug.com/105065. | 1480 // http://crbug.com/105065. |
| 1477 browser_process_->notification_ui_manager(); | 1481 browser_process_->notification_ui_manager(); |
| 1478 | 1482 |
| 1483 if (!parsed_command_line().HasSwitch(switches::kDisableComponentUpdate)) |
| 1484 RegisterComponentsForUpdate(parsed_command_line()); |
| 1485 |
| 1479 #if defined(OS_ANDROID) | 1486 #if defined(OS_ANDROID) |
| 1480 chrome_variations::VariationsService* variations_service = | 1487 chrome_variations::VariationsService* variations_service = |
| 1481 browser_process_->variations_service(); | 1488 browser_process_->variations_service(); |
| 1482 if (variations_service) | 1489 if (variations_service) |
| 1483 variations_service->StartRepeatedVariationsSeedFetch(); | 1490 variations_service->StartRepeatedVariationsSeedFetch(); |
| 1484 #else | 1491 #else |
| 1485 // Most general initialization is behind us, but opening a | 1492 // Most general initialization is behind us, but opening a |
| 1486 // tab and/or session restore and such is still to be done. | 1493 // tab and/or session restore and such is still to be done. |
| 1487 base::TimeTicks browser_open_start = base::TimeTicks::Now(); | 1494 base::TimeTicks browser_open_start = base::TimeTicks::Now(); |
| 1488 | 1495 |
| 1489 // We are in regular browser boot sequence. Open initial tabs and enter the | 1496 // We are in regular browser boot sequence. Open initial tabs and enter the |
| 1490 // main message loop. | 1497 // main message loop. |
| 1491 int result_code; | 1498 int result_code; |
| 1492 #if defined(OS_CHROMEOS) | 1499 #if defined(OS_CHROMEOS) |
| 1493 // On ChromeOS multiple profiles doesn't apply, and will break if we load | 1500 // On ChromeOS multiple profiles doesn't apply, and will break if we load |
| 1494 // them this early as the cryptohome hasn't yet been mounted (which happens | 1501 // them this early as the cryptohome hasn't yet been mounted (which happens |
| 1495 // only once we log in. | 1502 // only once we log in. |
| 1496 std::vector<Profile*> last_opened_profiles; | 1503 std::vector<Profile*> last_opened_profiles; |
| 1497 #else | 1504 #else |
| 1498 std::vector<Profile*> last_opened_profiles = | 1505 std::vector<Profile*> last_opened_profiles = |
| 1499 g_browser_process->profile_manager()->GetLastOpenedProfiles(); | 1506 g_browser_process->profile_manager()->GetLastOpenedProfiles(); |
| 1500 #endif | 1507 #endif |
| 1501 | 1508 |
| 1502 if (!parsed_command_line().HasSwitch(switches::kDisableComponentUpdate)) | |
| 1503 RegisterComponentsForUpdate(parsed_command_line()); | |
| 1504 | |
| 1505 if (browser_creator_->Start(parsed_command_line(), base::FilePath(), | 1509 if (browser_creator_->Start(parsed_command_line(), base::FilePath(), |
| 1506 profile_, last_opened_profiles, &result_code)) { | 1510 profile_, last_opened_profiles, &result_code)) { |
| 1507 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 1511 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 1508 // Initialize autoupdate timer. Timer callback costs basically nothing | 1512 // Initialize autoupdate timer. Timer callback costs basically nothing |
| 1509 // when browser is not in persistent mode, so it's OK to let it ride on | 1513 // when browser is not in persistent mode, so it's OK to let it ride on |
| 1510 // the main thread. This needs to be done here because we don't want | 1514 // the main thread. This needs to be done here because we don't want |
| 1511 // to start the timer when Chrome is run inside a test harness. | 1515 // to start the timer when Chrome is run inside a test harness. |
| 1512 browser_process_->StartAutoupdateTimer(); | 1516 browser_process_->StartAutoupdateTimer(); |
| 1513 #endif | 1517 #endif |
| 1514 | 1518 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 chromeos::CrosSettings::Shutdown(); | 1689 chromeos::CrosSettings::Shutdown(); |
| 1686 #endif | 1690 #endif |
| 1687 #endif | 1691 #endif |
| 1688 } | 1692 } |
| 1689 | 1693 |
| 1690 // Public members: | 1694 // Public members: |
| 1691 | 1695 |
| 1692 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1696 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 1693 chrome_extra_parts_.push_back(parts); | 1697 chrome_extra_parts_.push_back(parts); |
| 1694 } | 1698 } |
| OLD | NEW |