| 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 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "base/threading/platform_thread.h" | 27 #include "base/threading/platform_thread.h" |
| 28 #include "base/time.h" | 28 #include "base/time.h" |
| 29 #include "base/utf_string_conversions.h" | 29 #include "base/utf_string_conversions.h" |
| 30 #include "base/values.h" | 30 #include "base/values.h" |
| 31 #include "build/build_config.h" | 31 #include "build/build_config.h" |
| 32 #include "chrome/browser/about_flags.h" | 32 #include "chrome/browser/about_flags.h" |
| 33 #include "chrome/browser/browser_process.h" | 33 #include "chrome/browser/browser_process.h" |
| 34 #include "chrome/browser/browser_process_impl.h" | 34 #include "chrome/browser/browser_process_impl.h" |
| 35 #include "chrome/browser/browser_shutdown.h" | 35 #include "chrome/browser/browser_shutdown.h" |
| 36 #include "chrome/browser/chrome_browser_main_extra_parts.h" | 36 #include "chrome/browser/chrome_browser_main_extra_parts.h" |
| 37 #include "chrome/browser/chrome_gpu_util.h" |
| 37 #include "chrome/browser/defaults.h" | 38 #include "chrome/browser/defaults.h" |
| 38 #include "chrome/browser/extensions/extension_protocols.h" | 39 #include "chrome/browser/extensions/extension_protocols.h" |
| 39 #include "chrome/browser/extensions/extension_service.h" | 40 #include "chrome/browser/extensions/extension_service.h" |
| 40 #include "chrome/browser/extensions/startup_helper.h" | 41 #include "chrome/browser/extensions/startup_helper.h" |
| 41 #include "chrome/browser/first_run/upgrade_util.h" | 42 #include "chrome/browser/first_run/upgrade_util.h" |
| 42 #include "chrome/browser/google/google_search_counter.h" | 43 #include "chrome/browser/google/google_search_counter.h" |
| 43 #include "chrome/browser/google/google_util.h" | 44 #include "chrome/browser/google/google_util.h" |
| 44 #include "chrome/browser/jankometer.h" | 45 #include "chrome/browser/jankometer.h" |
| 45 #include "chrome/browser/language_usage_metrics.h" | 46 #include "chrome/browser/language_usage_metrics.h" |
| 46 #include "chrome/browser/managed_mode.h" | 47 #include "chrome/browser/managed_mode.h" |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 } | 923 } |
| 923 | 924 |
| 924 void ChromeBrowserMainParts::PostProfileInit() { | 925 void ChromeBrowserMainParts::PostProfileInit() { |
| 925 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 926 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 926 chrome_extra_parts_[i]->PostProfileInit(); | 927 chrome_extra_parts_[i]->PostProfileInit(); |
| 927 } | 928 } |
| 928 | 929 |
| 929 void ChromeBrowserMainParts::PreBrowserStart() { | 930 void ChromeBrowserMainParts::PreBrowserStart() { |
| 930 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 931 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 931 chrome_extra_parts_[i]->PreBrowserStart(); | 932 chrome_extra_parts_[i]->PreBrowserStart(); |
| 933 #if !defined(OS_ANDROID) |
| 934 gpu_util::InstallBrowserMonitor(); |
| 935 #endif |
| 932 } | 936 } |
| 933 | 937 |
| 934 void ChromeBrowserMainParts::PostBrowserStart() { | 938 void ChromeBrowserMainParts::PostBrowserStart() { |
| 935 #if !defined(OS_ANDROID) | 939 #if !defined(OS_ANDROID) |
| 936 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kVisitURLs)) | 940 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kVisitURLs)) |
| 937 RunPageCycler(); | 941 RunPageCycler(); |
| 938 #endif | 942 #endif |
| 939 | 943 |
| 940 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 944 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 941 chrome_extra_parts_[i]->PostBrowserStart(); | 945 chrome_extra_parts_[i]->PostBrowserStart(); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 int result_code; | 1391 int result_code; |
| 1388 #if defined(OS_CHROMEOS) | 1392 #if defined(OS_CHROMEOS) |
| 1389 // On ChromeOS multiple profiles doesn't apply, and will break if we load | 1393 // On ChromeOS multiple profiles doesn't apply, and will break if we load |
| 1390 // them this early as the cryptohome hasn't yet been mounted (which happens | 1394 // them this early as the cryptohome hasn't yet been mounted (which happens |
| 1391 // only once we log in. | 1395 // only once we log in. |
| 1392 std::vector<Profile*> last_opened_profiles; | 1396 std::vector<Profile*> last_opened_profiles; |
| 1393 #else | 1397 #else |
| 1394 std::vector<Profile*> last_opened_profiles = | 1398 std::vector<Profile*> last_opened_profiles = |
| 1395 g_browser_process->profile_manager()->GetLastOpenedProfiles(); | 1399 g_browser_process->profile_manager()->GetLastOpenedProfiles(); |
| 1396 #endif | 1400 #endif |
| 1401 |
| 1397 if (browser_creator_->Start(parsed_command_line(), FilePath(), | 1402 if (browser_creator_->Start(parsed_command_line(), FilePath(), |
| 1398 profile_, last_opened_profiles, &result_code)) { | 1403 profile_, last_opened_profiles, &result_code)) { |
| 1399 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 1404 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 1400 // Initialize autoupdate timer. Timer callback costs basically nothing | 1405 // Initialize autoupdate timer. Timer callback costs basically nothing |
| 1401 // when browser is not in persistent mode, so it's OK to let it ride on | 1406 // when browser is not in persistent mode, so it's OK to let it ride on |
| 1402 // the main thread. This needs to be done here because we don't want | 1407 // the main thread. This needs to be done here because we don't want |
| 1403 // to start the timer when Chrome is run inside a test harness. | 1408 // to start the timer when Chrome is run inside a test harness. |
| 1404 browser_process_->StartAutoupdateTimer(); | 1409 browser_process_->StartAutoupdateTimer(); |
| 1405 #endif | 1410 #endif |
| 1406 | 1411 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1519 // Start watching for jank during shutdown. It gets disarmed when | 1524 // Start watching for jank during shutdown. It gets disarmed when |
| 1520 // |shutdown_watcher_| object is destructed. | 1525 // |shutdown_watcher_| object is destructed. |
| 1521 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(300)); | 1526 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(300)); |
| 1522 | 1527 |
| 1523 // Disarm the startup hang detector time bomb if it is still Arm'ed. | 1528 // Disarm the startup hang detector time bomb if it is still Arm'ed. |
| 1524 startup_watcher_->Disarm(); | 1529 startup_watcher_->Disarm(); |
| 1525 | 1530 |
| 1526 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1531 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1527 chrome_extra_parts_[i]->PostMainMessageLoopRun(); | 1532 chrome_extra_parts_[i]->PostMainMessageLoopRun(); |
| 1528 | 1533 |
| 1534 #if !defined(OS_ANDROID) |
| 1535 gpu_util::UninstallBrowserMonitor(); |
| 1536 #endif |
| 1537 |
| 1529 #if defined(OS_WIN) | 1538 #if defined(OS_WIN) |
| 1530 // Log the search engine chosen on first run. Do this at shutdown, after any | 1539 // Log the search engine chosen on first run. Do this at shutdown, after any |
| 1531 // changes are made from the first run bubble link, etc. | 1540 // changes are made from the first run bubble link, etc. |
| 1532 if (record_search_engine_) { | 1541 if (record_search_engine_) { |
| 1533 TemplateURLService* url_service = | 1542 TemplateURLService* url_service = |
| 1534 TemplateURLServiceFactory::GetForProfile(profile_); | 1543 TemplateURLServiceFactory::GetForProfile(profile_); |
| 1535 const TemplateURL* default_search_engine = | 1544 const TemplateURL* default_search_engine = |
| 1536 url_service->GetDefaultSearchProvider(); | 1545 url_service->GetDefaultSearchProvider(); |
| 1537 // The default engine can be NULL if the administrator has disabled | 1546 // The default engine can be NULL if the administrator has disabled |
| 1538 // default search. | 1547 // default search. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1642 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 1634 uma_name += "_XP"; | 1643 uma_name += "_XP"; |
| 1635 | 1644 |
| 1636 uma_name += "_PreRead_"; | 1645 uma_name += "_PreRead_"; |
| 1637 uma_name += pre_read_percentage; | 1646 uma_name += pre_read_percentage; |
| 1638 AddPreReadHistogramTime(uma_name.c_str(), time); | 1647 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 1639 } | 1648 } |
| 1640 #endif | 1649 #endif |
| 1641 #endif | 1650 #endif |
| 1642 } | 1651 } |
| OLD | NEW |