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/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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 #include "chrome/browser/prefs/pref_metrics_service.h" | 84 #include "chrome/browser/prefs/pref_metrics_service.h" |
| 85 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 85 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 86 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" | 86 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" |
| 87 #include "chrome/browser/process_singleton.h" | 87 #include "chrome/browser/process_singleton.h" |
| 88 #include "chrome/browser/profiles/profile.h" | 88 #include "chrome/browser/profiles/profile.h" |
| 89 #include "chrome/browser/profiles/profile_manager.h" | 89 #include "chrome/browser/profiles/profile_manager.h" |
| 90 #include "chrome/browser/profiles/profiles_state.h" | 90 #include "chrome/browser/profiles/profiles_state.h" |
| 91 #include "chrome/browser/shell_integration.h" | 91 #include "chrome/browser/shell_integration.h" |
| 92 #include "chrome/browser/three_d_api_observer.h" | 92 #include "chrome/browser/three_d_api_observer.h" |
| 93 #include "chrome/browser/translate/translate_manager.h" | 93 #include "chrome/browser/translate/translate_manager.h" |
| 94 #include "chrome/browser/translate/translate_service.h" | |
| 94 #include "chrome/browser/ui/app_list/app_list_service.h" | 95 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 95 #include "chrome/browser/ui/browser.h" | 96 #include "chrome/browser/ui/browser.h" |
| 96 #include "chrome/browser/ui/browser_finder.h" | 97 #include "chrome/browser/ui/browser_finder.h" |
| 97 #include "chrome/browser/ui/host_desktop.h" | 98 #include "chrome/browser/ui/host_desktop.h" |
| 98 #include "chrome/browser/ui/startup/default_browser_prompt.h" | 99 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 99 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 100 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 100 #include "chrome/browser/ui/uma_browsing_activity_observer.h" | 101 #include "chrome/browser/ui/uma_browsing_activity_observer.h" |
| 101 #include "chrome/browser/ui/user_data_dir_dialog.h" | 102 #include "chrome/browser/ui/user_data_dir_dialog.h" |
| 102 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 103 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
| 103 #include "chrome/browser/user_data_dir_extractor.h" | 104 #include "chrome/browser/user_data_dir_extractor.h" |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 | 529 |
| 529 ChromeBrowserMainParts::ChromeBrowserMainParts( | 530 ChromeBrowserMainParts::ChromeBrowserMainParts( |
| 530 const content::MainFunctionParams& parameters) | 531 const content::MainFunctionParams& parameters) |
| 531 : parameters_(parameters), | 532 : parameters_(parameters), |
| 532 parsed_command_line_(parameters.command_line), | 533 parsed_command_line_(parameters.command_line), |
| 533 result_code_(content::RESULT_CODE_NORMAL_EXIT), | 534 result_code_(content::RESULT_CODE_NORMAL_EXIT), |
| 534 startup_watcher_(new StartupTimeBomb()), | 535 startup_watcher_(new StartupTimeBomb()), |
| 535 shutdown_watcher_(new ShutdownWatcherHelper()), | 536 shutdown_watcher_(new ShutdownWatcherHelper()), |
| 536 startup_timer_(new performance_monitor::StartupTimer()), | 537 startup_timer_(new performance_monitor::StartupTimer()), |
| 537 browser_field_trials_(parameters.command_line), | 538 browser_field_trials_(parameters.command_line), |
| 538 translate_manager_(NULL), | |
| 539 profile_(NULL), | 539 profile_(NULL), |
| 540 run_message_loop_(true), | 540 run_message_loop_(true), |
| 541 notify_result_(ProcessSingleton::PROCESS_NONE), | 541 notify_result_(ProcessSingleton::PROCESS_NONE), |
| 542 local_state_(NULL), | 542 local_state_(NULL), |
| 543 restart_last_session_(false) { | 543 restart_last_session_(false) { |
| 544 // If we're running tests (ui_task is non-null). | 544 // If we're running tests (ui_task is non-null). |
| 545 if (parameters.ui_task) | 545 if (parameters.ui_task) |
| 546 browser_defaults::enable_help_app = false; | 546 browser_defaults::enable_help_app = false; |
| 547 | 547 |
| 548 // Chrome disallows cookies by default. All code paths that want to use | 548 // Chrome disallows cookies by default. All code paths that want to use |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1259 // machine. If yes and the current Chrome process is user level, we do not | 1259 // machine. If yes and the current Chrome process is user level, we do not |
| 1260 // allow the user level Chrome to run. So we notify the user and uninstall | 1260 // allow the user level Chrome to run. So we notify the user and uninstall |
| 1261 // user level Chrome. | 1261 // user level Chrome. |
| 1262 // Note this check should only happen here, after all the checks above | 1262 // Note this check should only happen here, after all the checks above |
| 1263 // (uninstall, resource bundle initialization, other chrome browser | 1263 // (uninstall, resource bundle initialization, other chrome browser |
| 1264 // processes etc). | 1264 // processes etc). |
| 1265 if (ChromeBrowserMainPartsWin::CheckMachineLevelInstall()) | 1265 if (ChromeBrowserMainPartsWin::CheckMachineLevelInstall()) |
| 1266 return chrome::RESULT_CODE_MACHINE_LEVEL_INSTALL_EXISTS; | 1266 return chrome::RESULT_CODE_MACHINE_LEVEL_INSTALL_EXISTS; |
| 1267 #endif | 1267 #endif |
| 1268 | 1268 |
| 1269 // Create the TranslateManager singleton. | 1269 TranslateService::Initialize(); |
| 1270 translate_manager_ = TranslateManager::GetInstance(); | |
| 1271 DCHECK(translate_manager_ != NULL); | |
| 1272 | 1270 |
| 1273 // Needs to be done before PostProfileInit, since login manager on CrOS is | 1271 // Needs to be done before PostProfileInit, since login manager on CrOS is |
| 1274 // called inside PostProfileInit. | 1272 // called inside PostProfileInit. |
| 1275 content::WebUIControllerFactory::RegisterFactory( | 1273 content::WebUIControllerFactory::RegisterFactory( |
| 1276 ChromeWebUIControllerFactory::GetInstance()); | 1274 ChromeWebUIControllerFactory::GetInstance()); |
| 1277 | 1275 |
| 1278 // NaClBrowserDelegateImpl is accessed inside PostProfileInit(). | 1276 // NaClBrowserDelegateImpl is accessed inside PostProfileInit(). |
| 1279 // So make sure to create it before that. | 1277 // So make sure to create it before that. |
| 1280 #if !defined(DISABLE_NACL) | 1278 #if !defined(DISABLE_NACL) |
| 1281 NaClBrowserDelegateImpl* delegate = new NaClBrowserDelegateImpl( | 1279 NaClBrowserDelegateImpl* delegate = new NaClBrowserDelegateImpl( |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1542 chrome_variations::VariationsService* variations_service = | 1540 chrome_variations::VariationsService* variations_service = |
| 1543 browser_process_->variations_service(); | 1541 browser_process_->variations_service(); |
| 1544 if (variations_service) { | 1542 if (variations_service) { |
| 1545 variations_service->StartRepeatedVariationsSeedFetch(); | 1543 variations_service->StartRepeatedVariationsSeedFetch(); |
| 1546 | 1544 |
| 1547 #if defined(OS_WIN) | 1545 #if defined(OS_WIN) |
| 1548 variations_service->StartGoogleUpdateRegistrySync(); | 1546 variations_service->StartGoogleUpdateRegistrySync(); |
| 1549 #endif | 1547 #endif |
| 1550 } | 1548 } |
| 1551 | 1549 |
| 1552 if (translate_manager_ != NULL) { | 1550 TranslateManager::GetInstance()->FetchLanguageListFromTranslateServer( |
|
blundell
2014/01/24 17:52:43
So this will become a call on TranslateDownloadMan
droger
2014/01/27 14:13:43
Yes.
| |
| 1553 translate_manager_->FetchLanguageListFromTranslateServer( | 1551 profile_->GetPrefs()); |
| 1554 profile_->GetPrefs()); | |
| 1555 } | |
| 1556 } | 1552 } |
| 1557 | 1553 |
| 1558 run_message_loop_ = true; | 1554 run_message_loop_ = true; |
| 1559 } else { | 1555 } else { |
| 1560 run_message_loop_ = false; | 1556 run_message_loop_ = false; |
| 1561 } | 1557 } |
| 1562 browser_creator_.reset(); | 1558 browser_creator_.reset(); |
| 1563 #endif // !defined(OS_ANDROID) | 1559 #endif // !defined(OS_ANDROID) |
| 1564 | 1560 |
| 1565 performance_monitor::PerformanceMonitor::GetInstance()->Initialize(); | 1561 performance_monitor::PerformanceMonitor::GetInstance()->Initialize(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1638 | 1634 |
| 1639 // Disarm the startup hang detector time bomb if it is still Arm'ed. | 1635 // Disarm the startup hang detector time bomb if it is still Arm'ed. |
| 1640 startup_watcher_->Disarm(); | 1636 startup_watcher_->Disarm(); |
| 1641 | 1637 |
| 1642 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1638 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1643 chrome_extra_parts_[i]->PostMainMessageLoopRun(); | 1639 chrome_extra_parts_[i]->PostMainMessageLoopRun(); |
| 1644 | 1640 |
| 1645 // Some tests don't set parameters.ui_task, so they started translate | 1641 // Some tests don't set parameters.ui_task, so they started translate |
| 1646 // language fetch that was never completed so we need to cleanup here | 1642 // language fetch that was never completed so we need to cleanup here |
| 1647 // otherwise it will be done by the destructor in a wrong thread. | 1643 // otherwise it will be done by the destructor in a wrong thread. |
| 1648 if (parameters().ui_task == NULL && translate_manager_ != NULL) | 1644 TranslateService::Shutdown(parameters().ui_task == NULL); |
| 1649 translate_manager_->CleanupPendingUlrFetcher(); | |
| 1650 | 1645 |
| 1651 if (notify_result_ == ProcessSingleton::PROCESS_NONE) | 1646 if (notify_result_ == ProcessSingleton::PROCESS_NONE) |
| 1652 process_singleton_->Cleanup(); | 1647 process_singleton_->Cleanup(); |
| 1653 | 1648 |
| 1654 // Stop all tasks that might run on WatchDogThread. | 1649 // Stop all tasks that might run on WatchDogThread. |
| 1655 ThreadWatcherList::StopWatchingAll(); | 1650 ThreadWatcherList::StopWatchingAll(); |
| 1656 | 1651 |
| 1657 browser_process_->metrics_service()->Stop(); | 1652 browser_process_->metrics_service()->Stop(); |
| 1658 | 1653 |
| 1659 restart_last_session_ = browser_shutdown::ShutdownPreThreadsStop(); | 1654 restart_last_session_ = browser_shutdown::ShutdownPreThreadsStop(); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1686 chromeos::CrosSettings::Shutdown(); | 1681 chromeos::CrosSettings::Shutdown(); |
| 1687 #endif | 1682 #endif |
| 1688 #endif | 1683 #endif |
| 1689 } | 1684 } |
| 1690 | 1685 |
| 1691 // Public members: | 1686 // Public members: |
| 1692 | 1687 |
| 1693 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1688 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 1694 chrome_extra_parts_.push_back(parts); | 1689 chrome_extra_parts_.push_back(parts); |
| 1695 } | 1690 } |
| OLD | NEW |