Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 8596015: Revert 110710 - Add ChromeBrowserMainExtraParts for non main parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chrome_browser_main.h ('k') | chrome/browser/chrome_browser_main_extra_parts.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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 14 matching lines...) Expand all
25 #include "base/sys_string_conversions.h" 25 #include "base/sys_string_conversions.h"
26 #include "base/threading/platform_thread.h" 26 #include "base/threading/platform_thread.h"
27 #include "base/time.h" 27 #include "base/time.h"
28 #include "base/utf_string_conversions.h" 28 #include "base/utf_string_conversions.h"
29 #include "base/values.h" 29 #include "base/values.h"
30 #include "build/build_config.h" 30 #include "build/build_config.h"
31 #include "chrome/browser/about_flags.h" 31 #include "chrome/browser/about_flags.h"
32 #include "chrome/browser/background/background_mode_manager.h" 32 #include "chrome/browser/background/background_mode_manager.h"
33 #include "chrome/browser/browser_process_impl.h" 33 #include "chrome/browser/browser_process_impl.h"
34 #include "chrome/browser/browser_shutdown.h" 34 #include "chrome/browser/browser_shutdown.h"
35 #include "chrome/browser/chrome_browser_main_extra_parts.h"
36 #include "chrome/browser/defaults.h" 35 #include "chrome/browser/defaults.h"
37 #include "chrome/browser/extensions/default_apps_trial.h" 36 #include "chrome/browser/extensions/default_apps_trial.h"
38 #include "chrome/browser/extensions/extension_protocols.h" 37 #include "chrome/browser/extensions/extension_protocols.h"
39 #include "chrome/browser/extensions/extension_service.h" 38 #include "chrome/browser/extensions/extension_service.h"
40 #include "chrome/browser/extensions/extensions_startup.h" 39 #include "chrome/browser/extensions/extensions_startup.h"
41 #include "chrome/browser/first_run/first_run_browser_process.h" 40 #include "chrome/browser/first_run/first_run_browser_process.h"
42 #include "chrome/browser/first_run/upgrade_util.h" 41 #include "chrome/browser/first_run/upgrade_util.h"
43 #include "chrome/browser/google/google_url_tracker.h" 42 #include "chrome/browser/google/google_url_tracker.h"
44 #include "chrome/browser/google/google_util.h" 43 #include "chrome/browser/google/google_util.h"
45 #include "chrome/browser/instant/instant_field_trial.h" 44 #include "chrome/browser/instant/instant_field_trial.h"
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } else { 551 } else {
553 if (!parsed_command_line.HasSwitch(switches::kTestName)) { 552 if (!parsed_command_line.HasSwitch(switches::kTestName)) {
554 // We did not log in (we crashed or are debugging), so we need to 553 // We did not log in (we crashed or are debugging), so we need to
555 // set the user name for sync. 554 // set the user name for sync.
556 chromeos::LoginUtils::Get()->RestoreAuthenticationSession( 555 chromeos::LoginUtils::Get()->RestoreAuthenticationSession(
557 chromeos::UserManager::Get()->logged_in_user().email(), profile); 556 chromeos::UserManager::Get()->logged_in_user().email(), profile);
558 } 557 }
559 } 558 }
560 } 559 }
561 560
561 #else
562
563 void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line,
564 Profile* profile) {
565 // Dummy empty function for non-ChromeOS builds to avoid extra ifdefs below.
566 }
567
562 #endif // defined(OS_CHROMEOS) 568 #endif // defined(OS_CHROMEOS)
563 569
564 #if defined(OS_MACOSX) 570 #if defined(OS_MACOSX)
565 OSStatus KeychainCallback(SecKeychainEvent keychain_event, 571 OSStatus KeychainCallback(SecKeychainEvent keychain_event,
566 SecKeychainCallbackInfo *info, void *context) { 572 SecKeychainCallbackInfo *info, void *context) {
567 return noErr; 573 return noErr;
568 } 574 }
569 #endif 575 #endif
570 576
571 #if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK) 577 #if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK)
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 translate_manager_(NULL), 678 translate_manager_(NULL),
673 profile_(NULL), 679 profile_(NULL),
674 run_message_loop_(true), 680 run_message_loop_(true),
675 notify_result_(ProcessSingleton::PROCESS_NONE) { 681 notify_result_(ProcessSingleton::PROCESS_NONE) {
676 // If we're running tests (ui_task is non-null). 682 // If we're running tests (ui_task is non-null).
677 if (parameters.ui_task) 683 if (parameters.ui_task)
678 browser_defaults::enable_help_app = false; 684 browser_defaults::enable_help_app = false;
679 } 685 }
680 686
681 ChromeBrowserMainParts::~ChromeBrowserMainParts() { 687 ChromeBrowserMainParts::~ChromeBrowserMainParts() {
682 for (int i = static_cast<int>(chrome_extra_parts_.size())-1; i >= 0; --i)
683 delete chrome_extra_parts_[i];
684 chrome_extra_parts_.clear();
685 } 688 }
686 689
687 // This will be called after the command-line has been mutated by about:flags 690 // This will be called after the command-line has been mutated by about:flags
688 MetricsService* ChromeBrowserMainParts::SetupMetricsAndFieldTrials( 691 MetricsService* ChromeBrowserMainParts::SetupMetricsAndFieldTrials(
689 PrefService* local_state) { 692 PrefService* local_state) {
690 // Must initialize metrics after labs have been converted into switches, 693 // Must initialize metrics after labs have been converted into switches,
691 // but before field trials are set up (so that client ID is available for 694 // but before field trials are set up (so that client ID is available for
692 // one-time randomized field trials). 695 // one-time randomized field trials).
693 MetricsService* metrics = InitializeMetrics( 696 MetricsService* metrics = InitializeMetrics(
694 parsed_command_line_, local_state); 697 parsed_command_line_, local_state);
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 1159
1157 DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded() { 1160 DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded() {
1158 // Need an instance of AtExitManager to handle singleton creations and 1161 // Need an instance of AtExitManager to handle singleton creations and
1159 // deletions. We need this new instance because, the old instance created 1162 // deletions. We need this new instance because, the old instance created
1160 // in ChromeMain() got destructed when the function returned. 1163 // in ChromeMain() got destructed when the function returned.
1161 base::AtExitManager exit_manager; 1164 base::AtExitManager exit_manager;
1162 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); 1165 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded();
1163 } 1166 }
1164 #endif 1167 #endif
1165 1168
1166 // content::BrowserMainParts implementation ------------------------------------
1167
1168 void ChromeBrowserMainParts::PreEarlyInitialization() { 1169 void ChromeBrowserMainParts::PreEarlyInitialization() {
1169 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1170 chrome_extra_parts_[i]->PreEarlyInitialization();
1171 } 1170 }
1172 1171
1173 void ChromeBrowserMainParts::PostEarlyInitialization() { 1172 void ChromeBrowserMainParts::PostEarlyInitialization() {
1174 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1175 chrome_extra_parts_[i]->PostEarlyInitialization();
1176 } 1173 }
1177 1174
1178 void ChromeBrowserMainParts::ToolkitInitialized() { 1175 void ChromeBrowserMainParts::ToolkitInitialized() {
1179 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1180 chrome_extra_parts_[i]->ToolkitInitialized();
1181 } 1176 }
1182 1177
1183 void ChromeBrowserMainParts::PreMainMessageLoopStart() { 1178 void ChromeBrowserMainParts::PreMainMessageLoopStart() {
1184 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1185 chrome_extra_parts_[i]->PreMainMessageLoopStart();
1186 } 1179 }
1187 1180
1188 void ChromeBrowserMainParts::PostMainMessageLoopStart() { 1181 void ChromeBrowserMainParts::PostMainMessageLoopStart() {
1189 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1190 chrome_extra_parts_[i]->PostMainMessageLoopStart();
1191 } 1182 }
1192 1183
1193 void ChromeBrowserMainParts::PreMainMessageLoopRun() { 1184 void ChromeBrowserMainParts::PreMainMessageLoopRun() {
1194 result_code_ = PreMainMessageLoopRunImpl(); 1185 result_code_ = PreMainMessageLoopRunImpl();
1195
1196 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1197 chrome_extra_parts_[i]->PreMainMessageLoopRun();
1198 } 1186 }
1199 1187
1200 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { 1188 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
1201 run_message_loop_ = false; 1189 run_message_loop_ = false;
1202 FilePath user_data_dir; 1190 FilePath user_data_dir;
1203 #if defined(OS_WIN) 1191 #if defined(OS_WIN)
1204 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); 1192 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
1205 #else 1193 #else
1206 // Getting the user data dir can fail if the directory isn't 1194 // Getting the user data dir can fail if the directory isn't
1207 // creatable, for example; on Windows in code below we bring up a 1195 // creatable, for example; on Windows in code below we bring up a
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 NOTREACHED(); 1498 NOTREACHED();
1511 } 1499 }
1512 #if !defined(OS_MACOSX) // closing brace for if 1500 #if !defined(OS_MACOSX) // closing brace for if
1513 } 1501 }
1514 #endif 1502 #endif
1515 1503
1516 #if defined(USE_X11) 1504 #if defined(USE_X11)
1517 SetBrowserX11ErrorHandlers(); 1505 SetBrowserX11ErrorHandlers();
1518 #endif 1506 #endif
1519 1507
1520 // Desktop construction occurs here, (required before profile creation).
1521 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1522 chrome_extra_parts_[i]->PostBrowserProcessInit();
1523
1524 // Profile creation ---------------------------------------------------------- 1508 // Profile creation ----------------------------------------------------------
1525 1509
1526 #if defined(OS_CHROMEOS) 1510 #if defined(OS_CHROMEOS)
1527 // Initialize the screen locker now so that it can receive 1511 // Initialize the screen locker now so that it can receive
1528 // LOGIN_USER_CHANGED notification from UserManager. 1512 // LOGIN_USER_CHANGED notification from UserManager.
1529 chromeos::ScreenLocker::InitClass(); 1513 chromeos::ScreenLocker::InitClass();
1530 1514
1531 // This forces the ProfileManager to be created and register for the 1515 // This forces the ProfileManager to be created and register for the
1532 // notification it needs to track the logged in user. 1516 // notification it needs to track the logged in user.
1533 g_browser_process->profile_manager(); 1517 g_browser_process->profile_manager();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 1563
1580 #if defined(OS_CHROMEOS) 1564 #if defined(OS_CHROMEOS)
1581 // Pass the TokenService pointer to the policy connector so user policy can 1565 // Pass the TokenService pointer to the policy connector so user policy can
1582 // grab a token and register with the policy server. 1566 // grab a token and register with the policy server.
1583 // TODO(mnissler): Remove once OAuth is the only authentication mechanism. 1567 // TODO(mnissler): Remove once OAuth is the only authentication mechanism.
1584 if (parsed_command_line().HasSwitch(switches::kLoginUser) && 1568 if (parsed_command_line().HasSwitch(switches::kLoginUser) &&
1585 !parsed_command_line().HasSwitch(switches::kLoginPassword)) { 1569 !parsed_command_line().HasSwitch(switches::kLoginPassword)) {
1586 g_browser_process->browser_policy_connector()->SetUserPolicyTokenService( 1570 g_browser_process->browser_policy_connector()->SetUserPolicyTokenService(
1587 profile_->GetTokenService()); 1571 profile_->GetTokenService());
1588 } 1572 }
1589
1590 // Tests should be able to tune login manager before showing it.
1591 // Thus only show login manager in normal (non-testing) mode.
1592 if (!parameters().ui_task)
1593 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile_);
1594 #endif 1573 #endif
1595 1574
1596 #if !defined(OS_MACOSX) 1575 #if !defined(OS_MACOSX)
1597 // Importing other browser settings is done in a browser-like process 1576 // Importing other browser settings is done in a browser-like process
1598 // that exits when this task has finished. 1577 // that exits when this task has finished.
1599 // TODO(port): Port the Mac's IPC-based implementation to other platforms to 1578 // TODO(port): Port the Mac's IPC-based implementation to other platforms to
1600 // replace this implementation. http://crbug.com/22142 1579 // replace this implementation. http://crbug.com/22142
1601 if (parsed_command_line().HasSwitch(switches::kImport) || 1580 if (parsed_command_line().HasSwitch(switches::kImport) ||
1602 parsed_command_line().HasSwitch(switches::kImportFromFile)) { 1581 parsed_command_line().HasSwitch(switches::kImportFromFile)) {
1603 return FirstRun::ImportNow(profile_, parsed_command_line()); 1582 return FirstRun::ImportNow(profile_, parsed_command_line());
(...skipping 28 matching lines...) Expand all
1632 // Disk image installation is sort of a first-run task, so it shares the 1611 // Disk image installation is sort of a first-run task, so it shares the
1633 // kNoFirstRun switch. 1612 // kNoFirstRun switch.
1634 if (MaybeInstallFromDiskImage()) { 1613 if (MaybeInstallFromDiskImage()) {
1635 // The application was installed and the installed copy has been 1614 // The application was installed and the installed copy has been
1636 // launched. This process is now obsolete. Exit. 1615 // launched. This process is now obsolete. Exit.
1637 return content::RESULT_CODE_NORMAL_EXIT; 1616 return content::RESULT_CODE_NORMAL_EXIT;
1638 } 1617 }
1639 } 1618 }
1640 #endif 1619 #endif
1641 1620
1642 // TODO(stevenjb): Move ChromeOS login code into PostProfileInitialized().
1643 // (Requires making ChromeBrowserMainPartsChromeos a non "main" Parts).
1644 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1645 chrome_extra_parts_[i]->PostProfileInitialized();
1646
1647 // Show the First Run UI if this is the first time Chrome has been run on 1621 // Show the First Run UI if this is the first time Chrome has been run on
1648 // this computer, or we're being compelled to do so by a command line flag. 1622 // this computer, or we're being compelled to do so by a command line flag.
1649 // Note that this be done _after_ the PrefService is initialized and all 1623 // Note that this be done _after_ the PrefService is initialized and all
1650 // preferences are registered, since some of the code that the importer 1624 // preferences are registered, since some of the code that the importer
1651 // touches reads preferences. 1625 // touches reads preferences.
1652 if (is_first_run) { 1626 if (is_first_run) {
1653 if (!first_run_ui_bypass) { 1627 if (!first_run_ui_bypass) {
1654 FirstRun::AutoImport(profile_, 1628 FirstRun::AutoImport(profile_,
1655 master_prefs_->homepage_defined, 1629 master_prefs_->homepage_defined,
1656 master_prefs_->do_import_items, 1630 master_prefs_->do_import_items,
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 BrowserThread::FILE, FROM_HERE, 1836 BrowserThread::FILE, FROM_HERE,
1863 base::Bind(&GpuBlacklistUpdater::SetupOnFileThread)); 1837 base::Bind(&GpuBlacklistUpdater::SetupOnFileThread));
1864 1838
1865 // Start watching all browser threads for responsiveness. 1839 // Start watching all browser threads for responsiveness.
1866 ThreadWatcherList::StartWatchingAll(parsed_command_line()); 1840 ThreadWatcherList::StartWatchingAll(parsed_command_line());
1867 1841
1868 #if !defined(DISABLE_NACL) 1842 #if !defined(DISABLE_NACL)
1869 NaClProcessHost::EarlyStartup(); 1843 NaClProcessHost::EarlyStartup();
1870 #endif 1844 #endif
1871 1845
1846 run_message_loop_ = true;
1847 return content::RESULT_CODE_NORMAL_EXIT;
1848 }
1849
1850 // Called from MainMessageLoopRun().
1851 void ChromeBrowserMainParts::StartBrowserOrUITask() {
1852 // Still initializing, so need to allow IO.
1853 base::ThreadRestrictions::ScopedAllowIO allow_io;
1854
1855 // Set the notification UI manager after any desktop initialization in
1856 // PreMainMessageLoopRun() is complete, and before starting the browser.
1857 DesktopNotificationServiceFactory::GetForProfile(profile_)->SetUIManager(
1858 g_browser_process->notification_ui_manager());
1859
1860 // Tests should be able to tune login manager before showing it.
1861 // Thus only show login manager in normal (non-testing) mode.
1862 if (!parameters().ui_task)
1863 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile_);
1864
1872 if (parameters().ui_task) { 1865 if (parameters().ui_task) {
1873 // We are in test mode. Run one task and enter the main message loop. 1866 // We are in test mode. Run one task and enter the main message loop.
1874 #if defined(OS_MACOSX) 1867 #if defined(OS_MACOSX)
1875 if (parameters().autorelease_pool) 1868 if (parameters().autorelease_pool)
1876 parameters().autorelease_pool->Recycle(); 1869 parameters().autorelease_pool->Recycle();
1877 #endif 1870 #endif
1878 parameters().ui_task->Run(); 1871 parameters().ui_task->Run();
1879 delete parameters().ui_task; 1872 delete parameters().ui_task;
1880 run_message_loop_ = false; 1873 run_message_loop_ = false;
1881 } else { 1874 } else {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 profile_->GetPrefs()); 1924 profile_->GetPrefs());
1932 } 1925 }
1933 #endif 1926 #endif
1934 1927
1935 run_message_loop_ = true; 1928 run_message_loop_ = true;
1936 } else { 1929 } else {
1937 run_message_loop_ = false; 1930 run_message_loop_ = false;
1938 } 1931 }
1939 } 1932 }
1940 browser_init_.reset(); 1933 browser_init_.reset();
1941 return result_code_;
1942 } 1934 }
1943 1935
1944 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { 1936 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) {
1945 // Set the result code set in PreMainMessageLoopRun or set above. 1937 // Set the result code set in PreMainMessageLoopRun or set above.
1946 *result_code = result_code_; 1938 *result_code = result_code_;
1947 1939
1940 // TODO(stevenjb): Move this to another phase, and/or clean up
1941 // PreMainMessageLoopRun() so that this can happen after desktop
1942 // initilaization and before running the main loop.
1943 if (run_message_loop_)
1944 StartBrowserOrUITask();
1945
1948 if (!run_message_loop_) 1946 if (!run_message_loop_)
1949 return true; // Don't run the default message loop. 1947 return true; // Don't run the default message loop.
1950 1948
1951 // This should be invoked as close to the start of the browser's 1949 // This should be invoked as close to the start of the browser's
1952 // UI thread message loop as possible to get a stable measurement 1950 // UI thread message loop as possible to get a stable measurement
1953 // across versions. 1951 // across versions.
1954 RecordBrowserStartupTime(); 1952 RecordBrowserStartupTime();
1955 1953
1956 #if defined(USE_AURA) 1954 #if defined(USE_AURA)
1957 aura::Desktop::GetInstance()->Run(); 1955 aura::Desktop::GetInstance()->Run();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2059 browser_shutdown::Shutdown(); 2057 browser_shutdown::Shutdown();
2060 master_prefs_.reset(); 2058 master_prefs_.reset();
2061 process_singleton_.reset(); 2059 process_singleton_.reset();
2062 2060
2063 // We need to do this check as late as possible, but due to modularity, this 2061 // We need to do this check as late as possible, but due to modularity, this
2064 // may be the last point in Chrome. This would be more effective if done at 2062 // may be the last point in Chrome. This would be more effective if done at
2065 // a higher level on the stack, so that it is impossible for an early return 2063 // a higher level on the stack, so that it is impossible for an early return
2066 // to bypass this code. Perhaps we need a *final* hook that is called on all 2064 // to bypass this code. Perhaps we need a *final* hook that is called on all
2067 // paths from content/browser/browser_main. 2065 // paths from content/browser/browser_main.
2068 CHECK(MetricsService::UmaMetricsProperlyShutdown()); 2066 CHECK(MetricsService::UmaMetricsProperlyShutdown());
2069
2070 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
2071 chrome_extra_parts_[i]->PostMainMessageLoopRun();
2072 } 2067 }
2073 2068
2074 // Public members:
2075
2076 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
2077 chrome_extra_parts_.push_back(parts);
2078 }
2079
2080 // Misc ------------------------------------------------------------------------
2081
2082 // This code is specific to the Windows-only PreReadExperiment field-trial. 2069 // This code is specific to the Windows-only PreReadExperiment field-trial.
2083 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time) { 2070 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time) {
2084 DCHECK(name != NULL); 2071 DCHECK(name != NULL);
2085 2072
2086 // This gets called with different histogram names, so we don't want to use 2073 // This gets called with different histogram names, so we don't want to use
2087 // the UMA_HISTOGRAM_CUSTOM_TIMES macro--it uses a static variable, and the 2074 // the UMA_HISTOGRAM_CUSTOM_TIMES macro--it uses a static variable, and the
2088 // first call wins. 2075 // first call wins.
2089 AddPreReadHistogramTime(name, time); 2076 AddPreReadHistogramTime(name, time);
2090 2077
2091 #if defined(OS_WIN) 2078 #if defined(OS_WIN)
2092 #if defined(GOOGLE_CHROME_BUILD) 2079 #if defined(GOOGLE_CHROME_BUILD)
2093 // The pre-read experiment is Windows and Google Chrome specific. 2080 // The pre-read experiment is Windows and Google Chrome specific.
2094 scoped_ptr<base::Environment> env(base::Environment::Create()); 2081 scoped_ptr<base::Environment> env(base::Environment::Create());
2095 2082
2096 // Only record the sub-histogram result if the experiment is running 2083 // Only record the sub-histogram result if the experiment is running
2097 // (environment variable is set, and valid). 2084 // (environment variable is set, and valid).
2098 std::string pre_read; 2085 std::string pre_read;
2099 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && 2086 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) &&
2100 (pre_read == "0" || pre_read == "1")) { 2087 (pre_read == "0" || pre_read == "1")) {
2101 std::string uma_name(name); 2088 std::string uma_name(name);
2102 uma_name += "_PreRead"; 2089 uma_name += "_PreRead";
2103 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; 2090 uma_name += pre_read == "1" ? "Enabled" : "Disabled";
2104 AddPreReadHistogramTime(uma_name.c_str(), time); 2091 AddPreReadHistogramTime(uma_name.c_str(), time);
2105 } 2092 }
2106 #endif 2093 #endif
2107 #endif 2094 #endif
2108 } 2095 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.h ('k') | chrome/browser/chrome_browser_main_extra_parts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698