| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/browser_init.h" | 5 #include "chrome/browser/ui/browser_init.h" |
| 6 | 6 |
| 7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| 11 #include "base/event_recorder.h" | 11 #include "base/event_recorder.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 17 #include "base/string_split.h" | 17 #include "base/string_split.h" |
| 18 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "chrome/browser/automation/automation_provider.h" | 20 #include "chrome/browser/automation/automation_provider.h" |
| 21 #include "chrome/browser/automation/automation_provider_list.h" | 21 #include "chrome/browser/automation/automation_provider_list.h" |
| 22 #include "chrome/browser/automation/chrome_frame_automation_provider.h" | 22 #include "chrome/browser/automation/chrome_frame_automation_provider.h" |
| 23 #include "chrome/browser/automation/testing_automation_provider.h" | 23 #include "chrome/browser/automation/testing_automation_provider.h" |
| 24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/component_updater/component_updater_service.h" |
| 26 #include "chrome/browser/component_updater/pepper_flash_component_installer.h" |
| 27 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 25 #include "chrome/browser/defaults.h" | 28 #include "chrome/browser/defaults.h" |
| 26 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | |
| 27 #include "chrome/browser/extensions/extension_creator.h" | 29 #include "chrome/browser/extensions/extension_creator.h" |
| 28 #include "chrome/browser/extensions/extension_service.h" | 30 #include "chrome/browser/extensions/extension_service.h" |
| 29 #include "chrome/browser/extensions/pack_extension_job.h" | 31 #include "chrome/browser/extensions/pack_extension_job.h" |
| 30 #include "chrome/browser/first_run/first_run.h" | 32 #include "chrome/browser/first_run/first_run.h" |
| 31 #include "chrome/browser/net/predictor_api.h" | 33 #include "chrome/browser/net/predictor_api.h" |
| 32 #include "chrome/browser/net/url_fixer_upper.h" | 34 #include "chrome/browser/net/url_fixer_upper.h" |
| 33 #include "chrome/browser/notifications/desktop_notification_service.h" | 35 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 34 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 36 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 35 #include "chrome/browser/prefs/pref_service.h" | 37 #include "chrome/browser/prefs/pref_service.h" |
| 36 #include "chrome/browser/prefs/session_startup_pref.h" | 38 #include "chrome/browser/prefs/session_startup_pref.h" |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 } | 504 } |
| 503 for (size_t i = 0; i < autolaunch_tabs.size(); ++i) { | 505 for (size_t i = 0; i < autolaunch_tabs.size(); ++i) { |
| 504 if (extension_service->IsInstalledApp(autolaunch_tabs.at(i).url)) { | 506 if (extension_service->IsInstalledApp(autolaunch_tabs.at(i).url)) { |
| 505 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, | 507 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, |
| 506 extension_misc::APP_LAUNCH_AUTOLAUNCH, | 508 extension_misc::APP_LAUNCH_AUTOLAUNCH, |
| 507 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); | 509 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); |
| 508 } | 510 } |
| 509 } | 511 } |
| 510 } | 512 } |
| 511 | 513 |
| 514 void RegisterComponentsForUpdate() { |
| 515 ComponentUpdateService* cus = g_browser_process->component_updater(); |
| 516 if (!cus) |
| 517 return; |
| 518 // Registration can be before of after cus->Start() so it is ok to post |
| 519 // a task to the UI thread to do registration once you done the necessary |
| 520 // file IO to know your current version. |
| 521 RegisterPepperFlashComponent(cus); |
| 522 cus->Start(); |
| 523 } |
| 524 |
| 512 } // namespace | 525 } // namespace |
| 513 | 526 |
| 514 | 527 |
| 515 // BrowserInit ---------------------------------------------------------------- | 528 // BrowserInit ---------------------------------------------------------------- |
| 516 | 529 |
| 517 BrowserInit::BrowserInit() {} | 530 BrowserInit::BrowserInit() {} |
| 518 | 531 |
| 519 BrowserInit::~BrowserInit() {} | 532 BrowserInit::~BrowserInit() {} |
| 520 | 533 |
| 521 void BrowserInit::AddFirstRunTab(const GURL& url) { | 534 void BrowserInit::AddFirstRunTab(const GURL& url) { |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 const FilePath& cur_dir, | 1326 const FilePath& cur_dir, |
| 1314 bool process_startup, | 1327 bool process_startup, |
| 1315 Profile* profile, | 1328 Profile* profile, |
| 1316 int* return_code, | 1329 int* return_code, |
| 1317 BrowserInit* browser_init) { | 1330 BrowserInit* browser_init) { |
| 1318 DCHECK(profile); | 1331 DCHECK(profile); |
| 1319 if (process_startup) { | 1332 if (process_startup) { |
| 1320 if (command_line.HasSwitch(switches::kDisablePromptOnRepost)) | 1333 if (command_line.HasSwitch(switches::kDisablePromptOnRepost)) |
| 1321 NavigationController::DisablePromptOnRepost(); | 1334 NavigationController::DisablePromptOnRepost(); |
| 1322 | 1335 |
| 1336 RegisterComponentsForUpdate(); |
| 1337 |
| 1323 // Look for the testing channel ID ONLY during process startup | 1338 // Look for the testing channel ID ONLY during process startup |
| 1324 if (command_line.HasSwitch(switches::kTestingChannelID)) { | 1339 if (command_line.HasSwitch(switches::kTestingChannelID)) { |
| 1325 std::string testing_channel_id = command_line.GetSwitchValueASCII( | 1340 std::string testing_channel_id = command_line.GetSwitchValueASCII( |
| 1326 switches::kTestingChannelID); | 1341 switches::kTestingChannelID); |
| 1327 // TODO(sanjeevr) Check if we need to make this a singleton for | 1342 // TODO(sanjeevr) Check if we need to make this a singleton for |
| 1328 // compatibility with the old testing code | 1343 // compatibility with the old testing code |
| 1329 // If there are any extra parameters, we expect each one to generate a | 1344 // If there are any extra parameters, we expect each one to generate a |
| 1330 // new tab; if there are none then we get one homepage tab. | 1345 // new tab; if there are none then we get one homepage tab. |
| 1331 int expected_tab_count = 1; | 1346 int expected_tab_count = 1; |
| 1332 if (command_line.HasSwitch(switches::kNoStartupWindow)) { | 1347 if (command_line.HasSwitch(switches::kNoStartupWindow)) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 return false; | 1467 return false; |
| 1453 automation->SetExpectedTabCount(expected_tabs); | 1468 automation->SetExpectedTabCount(expected_tabs); |
| 1454 | 1469 |
| 1455 AutomationProviderList* list = | 1470 AutomationProviderList* list = |
| 1456 g_browser_process->InitAutomationProviderList(); | 1471 g_browser_process->InitAutomationProviderList(); |
| 1457 DCHECK(list); | 1472 DCHECK(list); |
| 1458 list->AddProvider(automation); | 1473 list->AddProvider(automation); |
| 1459 | 1474 |
| 1460 return true; | 1475 return true; |
| 1461 } | 1476 } |
| OLD | NEW |