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

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

Issue 8302016: Make GTK and Aura parts orthogonal to OS parts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 2 months 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
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_gtk.h"
36 #include "chrome/browser/chrome_browser_main_win.h"
37 #include "chrome/browser/defaults.h" 35 #include "chrome/browser/defaults.h"
38 #include "chrome/browser/extensions/default_apps_trial.h" 36 #include "chrome/browser/extensions/default_apps_trial.h"
39 #include "chrome/browser/extensions/extension_protocols.h" 37 #include "chrome/browser/extensions/extension_protocols.h"
40 #include "chrome/browser/extensions/extension_service.h" 38 #include "chrome/browser/extensions/extension_service.h"
41 #include "chrome/browser/extensions/extensions_startup.h" 39 #include "chrome/browser/extensions/extensions_startup.h"
42 #include "chrome/browser/first_run/first_run_browser_process.h" 40 #include "chrome/browser/first_run/first_run_browser_process.h"
43 #include "chrome/browser/first_run/upgrade_util.h" 41 #include "chrome/browser/first_run/upgrade_util.h"
44 #include "chrome/browser/google/google_url_tracker.h" 42 #include "chrome/browser/google/google_url_tracker.h"
45 #include "chrome/browser/google/google_util.h" 43 #include "chrome/browser/google/google_util.h"
46 #include "chrome/browser/instant/instant_field_trial.h" 44 #include "chrome/browser/instant/instant_field_trial.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 #include "net/url_request/url_request_throttler_manager.h" 111 #include "net/url_request/url_request_throttler_manager.h"
114 #include "net/websockets/websocket_job.h" 112 #include "net/websockets/websocket_job.h"
115 #include "ui/base/l10n/l10n_util.h" 113 #include "ui/base/l10n/l10n_util.h"
116 #include "ui/base/resource/resource_bundle.h" 114 #include "ui/base/resource/resource_bundle.h"
117 115
118 #if defined(USE_LINUX_BREAKPAD) 116 #if defined(USE_LINUX_BREAKPAD)
119 #include "base/linux_util.h" 117 #include "base/linux_util.h"
120 #include "chrome/app/breakpad_linux.h" 118 #include "chrome/app/breakpad_linux.h"
121 #endif 119 #endif
122 120
123 #if defined(TOOLKIT_USES_GTK)
124 #include "chrome/browser/ui/gtk/gtk_util.h"
125 #endif
126
127 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 121 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
128 #include "chrome/browser/first_run/upgrade_util_linux.h" 122 #include "chrome/browser/first_run/upgrade_util_linux.h"
129 #endif 123 #endif
130 124
131 #if defined(OS_CHROMEOS) 125 #if defined(OS_CHROMEOS)
132 #include "chrome/browser/chromeos/audio_handler.h" 126 #include "chrome/browser/chromeos/audio_handler.h"
133 #include "chrome/browser/chromeos/boot_times_loader.h" 127 #include "chrome/browser/chromeos/boot_times_loader.h"
134 #include "chrome/browser/chromeos/cros_settings_names.h" 128 #include "chrome/browser/chromeos/cros_settings_names.h"
135 #include "chrome/browser/chromeos/cros/cros_library.h" 129 #include "chrome/browser/chromeos/cros/cros_library.h"
136 #include "chrome/browser/chromeos/cros/screen_lock_library.h" 130 #include "chrome/browser/chromeos/cros/screen_lock_library.h"
(...skipping 15 matching lines...) Expand all
152 // TODO(port): several win-only methods have been pulled out of this, but 146 // TODO(port): several win-only methods have been pulled out of this, but
153 // BrowserMain() as a whole needs to be broken apart so that it's usable by 147 // BrowserMain() as a whole needs to be broken apart so that it's usable by
154 // other platforms. For now, it's just a stub. This is a serious work in 148 // other platforms. For now, it's just a stub. This is a serious work in
155 // progress and should not be taken as an indication of a real refactoring. 149 // progress and should not be taken as an indication of a real refactoring.
156 150
157 #if defined(OS_WIN) 151 #if defined(OS_WIN)
158 #include "base/environment.h" // For PreRead experiment. 152 #include "base/environment.h" // For PreRead experiment.
159 #include "base/win/windows_version.h" 153 #include "base/win/windows_version.h"
160 #include "chrome/browser/browser_trial.h" 154 #include "chrome/browser/browser_trial.h"
161 #include "chrome/browser/browser_util_win.h" 155 #include "chrome/browser/browser_util_win.h"
156 #include "chrome/browser/chrome_browser_main_win.h"
162 #include "chrome/browser/first_run/try_chrome_dialog_view.h" 157 #include "chrome/browser/first_run/try_chrome_dialog_view.h"
163 #include "chrome/browser/first_run/upgrade_util_win.h" 158 #include "chrome/browser/first_run/upgrade_util_win.h"
164 #include "chrome/browser/fragmentation_checker_win.h" 159 #include "chrome/browser/fragmentation_checker_win.h"
165 #include "chrome/browser/net/url_fixer_upper.h" 160 #include "chrome/browser/net/url_fixer_upper.h"
166 #include "chrome/browser/rlz/rlz.h" 161 #include "chrome/browser/rlz/rlz.h"
167 #include "chrome/browser/ui/views/user_data_dir_dialog.h" 162 #include "chrome/browser/ui/views/user_data_dir_dialog.h"
168 #include "chrome/installer/util/helper.h" 163 #include "chrome/installer/util/helper.h"
169 #include "chrome/installer/util/install_util.h" 164 #include "chrome/installer/util/install_util.h"
170 #include "chrome/installer/util/shell_util.h" 165 #include "chrome/installer/util/shell_util.h"
171 #include "content/browser/user_metrics.h" 166 #include "content/browser/user_metrics.h"
(...skipping 14 matching lines...) Expand all
186 #include "chrome/browser/ui/views/chrome_views_delegate.h" 181 #include "chrome/browser/ui/views/chrome_views_delegate.h"
187 #include "views/desktop/desktop_window_view.h" 182 #include "views/desktop/desktop_window_view.h"
188 #include "views/focus/accelerator_handler.h" 183 #include "views/focus/accelerator_handler.h"
189 #include "views/widget/widget.h" 184 #include "views/widget/widget.h"
190 #if defined(TOOLKIT_USES_GTK) 185 #if defined(TOOLKIT_USES_GTK)
191 #include "views/widget/native_widget_gtk.h" 186 #include "views/widget/native_widget_gtk.h"
192 #endif 187 #endif
193 #endif 188 #endif
194 189
195 #if defined(TOOLKIT_USES_GTK) 190 #if defined(TOOLKIT_USES_GTK)
191 #include "chrome/browser/chrome_browser_main_gtk.h"
192 #include "chrome/browser/ui/gtk/gtk_util.h"
196 #include "ui/gfx/gtk_util.h" 193 #include "ui/gfx/gtk_util.h"
197 #endif 194 #endif
198 195
199 #if defined(TOUCH_UI) 196 #if defined(TOUCH_UI)
200 #include "ui/base/touch/touch_factory.h" 197 #include "ui/base/touch/touch_factory.h"
201 #endif 198 #endif
202 199
200 #if defined(USE_X11)
201 #include "chrome/browser/chrome_browser_main_x11.h"
202 #endif
203
203 #if defined(USE_AURA) 204 #if defined(USE_AURA)
205 #include "chrome/browser/chrome_browser_main_aura.h"
204 #include "ui/aura/desktop.h" 206 #include "ui/aura/desktop.h"
205 #include "ui/aura_shell/shell.h" 207 #include "ui/aura_shell/shell.h"
206 #endif 208 #endif
207 209
208 namespace net { 210 namespace net {
209 class NetLog; 211 class NetLog;
210 } // namespace net 212 } // namespace net
211 213
212 namespace { 214 namespace {
213 215
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 : BrowserMainParts(parameters), 685 : BrowserMainParts(parameters),
684 shutdown_watcher_(new ShutdownWatcherHelper()), 686 shutdown_watcher_(new ShutdownWatcherHelper()),
685 record_search_engine_(false), 687 record_search_engine_(false),
686 translate_manager_(NULL), 688 translate_manager_(NULL),
687 profile_(NULL), 689 profile_(NULL),
688 run_message_loop_(true), 690 run_message_loop_(true),
689 notify_result_(ProcessSingleton::PROCESS_NONE) { 691 notify_result_(ProcessSingleton::PROCESS_NONE) {
690 // If we're running tests (ui_task is non-null). 692 // If we're running tests (ui_task is non-null).
691 if (parameters.ui_task) 693 if (parameters.ui_task)
692 browser_defaults::enable_help_app = false; 694 browser_defaults::enable_help_app = false;
695 #if defined(USE_AURA)
696 extra_parts_.push_back(new ChromeBrowserPartsAura(this));
697 #endif
698 #if defined(TOOLKIT_USES_GTK)
699 extra_parts_.push_back(new ChromeBrowserPartsGtk(this));
700 #endif
693 } 701 }
694 702
695 ChromeBrowserMainParts::~ChromeBrowserMainParts() { 703 ChromeBrowserMainParts::~ChromeBrowserMainParts() {
704 // Release and destroy ExtraParts in reverse order.
705 while (!extra_parts_.empty())
706 extra_parts_.pop_back();
696 } 707 }
697 708
698 // This will be called after the command-line has been mutated by about:flags 709 // This will be called after the command-line has been mutated by about:flags
699 MetricsService* ChromeBrowserMainParts::SetupMetricsAndFieldTrials( 710 MetricsService* ChromeBrowserMainParts::SetupMetricsAndFieldTrials(
700 const CommandLine& parsed_command_line, 711 const CommandLine& parsed_command_line,
701 PrefService* local_state) { 712 PrefService* local_state) {
702 // Must initialize metrics after labs have been converted into switches, 713 // Must initialize metrics after labs have been converted into switches,
703 // but before field trials are set up (so that client ID is available for 714 // but before field trials are set up (so that client ID is available for
704 // one-time randomized field trials). 715 // one-time randomized field trials).
705 MetricsService* metrics = InitializeMetrics(parsed_command_line, local_state); 716 MetricsService* metrics = InitializeMetrics(parsed_command_line, local_state);
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 1178
1168 DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded() { 1179 DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded() {
1169 // Need an instance of AtExitManager to handle singleton creations and 1180 // Need an instance of AtExitManager to handle singleton creations and
1170 // deletions. We need this new instance because, the old instance created 1181 // deletions. We need this new instance because, the old instance created
1171 // in ChromeMain() got destructed when the function returned. 1182 // in ChromeMain() got destructed when the function returned.
1172 base::AtExitManager exit_manager; 1183 base::AtExitManager exit_manager;
1173 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); 1184 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded();
1174 } 1185 }
1175 #endif 1186 #endif
1176 1187
1188 void ChromeBrowserMainParts::PreEarlyInitialization() {
1189 for (PartsList::iterator iter = extra_parts_.begin();
1190 iter != extra_parts_.end(); ++iter) {
1191 (*iter)->PreEarlyInitialization();
1192 }
1193 }
1194
1195 void ChromeBrowserMainParts::PostEarlyInitialization() {
1196 for (PartsList::iterator iter = extra_parts_.begin();
1197 iter != extra_parts_.end(); ++iter) {
1198 (*iter)->PostEarlyInitialization();
1199 }
1200 }
1201
1177 void ChromeBrowserMainParts::PreMainMessageLoopRun() { 1202 void ChromeBrowserMainParts::PreMainMessageLoopRun() {
1203 for (PartsList::iterator iter = extra_parts_.begin();
1204 iter != extra_parts_.end(); ++iter) {
1205 (*iter)->PreMainMessageLoopRun();
1206 }
1178 set_result_code(PreMainMessageLoopRunInternal()); 1207 set_result_code(PreMainMessageLoopRunInternal());
1179 } 1208 }
1180 1209
1181 int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { 1210 int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() {
1182 run_message_loop_ = false; 1211 run_message_loop_ = false;
1183 FilePath user_data_dir; 1212 FilePath user_data_dir;
1184 #if defined(OS_WIN) 1213 #if defined(OS_WIN)
1185 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); 1214 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
1186 #else 1215 #else
1187 // Getting the user data dir can fail if the directory isn't 1216 // Getting the user data dir can fail if the directory isn't
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 1486
1458 // If the command line specifies 'uninstall' then we need to work here 1487 // If the command line specifies 'uninstall' then we need to work here
1459 // unless we detect another chrome browser running. 1488 // unless we detect another chrome browser running.
1460 if (parsed_command_line().HasSwitch(switches::kUninstall)) { 1489 if (parsed_command_line().HasSwitch(switches::kUninstall)) {
1461 return DoUninstallTasks(already_running); 1490 return DoUninstallTasks(already_running);
1462 } 1491 }
1463 #endif 1492 #endif
1464 1493
1465 if (parsed_command_line().HasSwitch(switches::kHideIcons) || 1494 if (parsed_command_line().HasSwitch(switches::kHideIcons) ||
1466 parsed_command_line().HasSwitch(switches::kShowIcons)) { 1495 parsed_command_line().HasSwitch(switches::kShowIcons)) {
1467 return HandleIconsCommands(parsed_command_line()); 1496 return HandleIconsCommands();
1468 } 1497 }
1469 if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) { 1498 if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) {
1470 return ShellIntegration::SetAsDefaultBrowser() ? 1499 return ShellIntegration::SetAsDefaultBrowser() ?
1471 static_cast<int>(content::RESULT_CODE_NORMAL_EXIT) : 1500 static_cast<int>(content::RESULT_CODE_NORMAL_EXIT) :
1472 static_cast<int>(chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED); 1501 static_cast<int>(chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED);
1473 } 1502 }
1474 1503
1475 // If the command line specifies --pack-extension, attempt the pack extension 1504 // If the command line specifies --pack-extension, attempt the pack extension
1476 // startup action and exit. 1505 // startup action and exit.
1477 if (parsed_command_line().HasSwitch(switches::kPackExtension)) { 1506 if (parsed_command_line().HasSwitch(switches::kPackExtension)) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 #endif // OS_POSIX 1704 #endif // OS_POSIX
1676 } // if (!first_run_ui_bypass) 1705 } // if (!first_run_ui_bypass)
1677 1706
1678 Browser::SetNewHomePagePrefs(user_prefs); 1707 Browser::SetNewHomePagePrefs(user_prefs);
1679 g_browser_process->profile_manager()->OnImportFinished(profile_); 1708 g_browser_process->profile_manager()->OnImportFinished(profile_);
1680 } // if (is_first_run) 1709 } // if (is_first_run)
1681 1710
1682 // Sets things up so that if we crash from this point on, a dialog will 1711 // Sets things up so that if we crash from this point on, a dialog will
1683 // popup asking the user to restart chrome. It is done this late to avoid 1712 // popup asking the user to restart chrome. It is done this late to avoid
1684 // testing against a bunch of special cases that are taken care early on. 1713 // testing against a bunch of special cases that are taken care early on.
1685 PrepareRestartOnCrashEnviroment(parsed_command_line()); 1714 PrepareRestartOnCrashEnviroment();
1686 1715
1687 // Start watching for hangs during startup. We disarm this hang detector when 1716 // Start watching for hangs during startup. We disarm this hang detector when
1688 // ThreadWatcher takes over or when browser is shutdown. 1717 // ThreadWatcher takes over or when browser is shutdown.
1689 StartupTimeBomb::Arm(base::TimeDelta::FromSeconds(300)); 1718 StartupTimeBomb::Arm(base::TimeDelta::FromSeconds(300));
1690 1719
1691 #if defined(OS_WIN) 1720 #if defined(OS_WIN)
1692 // Registers Chrome with the Windows Restart Manager, which will restore the 1721 // Registers Chrome with the Windows Restart Manager, which will restore the
1693 // Chrome session when the computer is restarted after a system update. 1722 // Chrome session when the computer is restarted after a system update.
1694 // This could be run as late as WM_QUERYENDSESSION for system update reboots, 1723 // This could be run as late as WM_QUERYENDSESSION for system update reboots,
1695 // but should run on startup if extended to handle crashes/hangs/patches. 1724 // but should run on startup if extended to handle crashes/hangs/patches.
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1951 #elif defined(OS_POSIX) 1980 #elif defined(OS_POSIX)
1952 MessageLoopForUI::current()->Run(); 1981 MessageLoopForUI::current()->Run();
1953 #endif 1982 #endif
1954 #if defined(OS_CHROMEOS) 1983 #if defined(OS_CHROMEOS)
1955 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", 1984 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded",
1956 true); 1985 true);
1957 #endif 1986 #endif
1958 } 1987 }
1959 1988
1960 void ChromeBrowserMainParts::PostMainMessageLoopRun() { 1989 void ChromeBrowserMainParts::PostMainMessageLoopRun() {
1961 // Start watching for jank during shutdown. It gets disarmed when 1990 for (PartsList::iterator iter = extra_parts_.begin();
1991 iter != extra_parts_.end(); ++iter) {
1992 (*iter)->PostMainMessageLoopRun();
1993 }
1994 // Start watching for jank during shutdown. It gets disarmed when
1962 // |shutdown_watcher_| object is destructed. 1995 // |shutdown_watcher_| object is destructed.
1963 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(90)); 1996 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(90));
1964 1997
1965 // Disarm the startup hang detector time bomb if it is still Arm'ed. 1998 // Disarm the startup hang detector time bomb if it is still Arm'ed.
1966 StartupTimeBomb::Disarm(); 1999 StartupTimeBomb::Disarm();
1967 2000
1968 #if defined(OS_WIN) 2001 #if defined(OS_WIN)
1969 // If it's the first run, log the search engine chosen. We wait until 2002 // If it's the first run, log the search engine chosen. We wait until
1970 // shutdown because otherwise we can't be sure the user has finished 2003 // shutdown because otherwise we can't be sure the user has finished
1971 // selecting a search engine through the dialog reached from the first run 2004 // selecting a search engine through the dialog reached from the first run
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 if (parameters().command_line_.HasSwitch(switches::kDebugViewsPaint)) 2096 if (parameters().command_line_.HasSwitch(switches::kDebugViewsPaint))
2064 views::Widget::SetDebugPaintEnabled(true); 2097 views::Widget::SetDebugPaintEnabled(true);
2065 #endif 2098 #endif
2066 2099
2067 #if defined(OS_WIN) 2100 #if defined(OS_WIN)
2068 gfx::PlatformFontWin::adjust_font_callback = &AdjustUIFont; 2101 gfx::PlatformFontWin::adjust_font_callback = &AdjustUIFont;
2069 gfx::PlatformFontWin::get_minimum_font_size_callback = &GetMinimumFontSize; 2102 gfx::PlatformFontWin::get_minimum_font_size_callback = &GetMinimumFontSize;
2070 #endif 2103 #endif
2071 } 2104 }
2072 2105
2106 // ExtraParts ----------------------------------------------------------------
2107
2108 ChromeBrowserMainParts::ExtraParts::ExtraParts(
2109 ChromeBrowserMainParts* main_parts) :
2110 main_parts_(main_parts) {
2111 }
2112
2113 ChromeBrowserMainParts::ExtraParts::~ExtraParts() {
2114 }
2115
2116 void ChromeBrowserMainParts::ExtraParts::PreEarlyInitialization() {
2117 }
2118
2119 void ChromeBrowserMainParts::ExtraParts::PostEarlyInitialization() {
2120 }
2121
2122 void ChromeBrowserMainParts::ExtraParts::PreMainMessageLoopRun() {
2123 }
2124
2125 void ChromeBrowserMainParts::ExtraParts::PostMainMessageLoopRun() {
2126 }
2127
2128 // -----------------------------------------------------------------------------
2129
2073 // This code is specific to the Windows-only PreReadExperiment field-trial. 2130 // This code is specific to the Windows-only PreReadExperiment field-trial.
2074 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time) { 2131 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time) {
2075 DCHECK(name != NULL); 2132 DCHECK(name != NULL);
2076 2133
2077 // This gets called with different histogram names, so we don't want to use 2134 // This gets called with different histogram names, so we don't want to use
2078 // the UMA_HISTOGRAM_CUSTOM_TIMES macro--it uses a static variable, and the 2135 // the UMA_HISTOGRAM_CUSTOM_TIMES macro--it uses a static variable, and the
2079 // first call wins. 2136 // first call wins.
2080 AddPreReadHistogramTime(name, time); 2137 AddPreReadHistogramTime(name, time);
2081 2138
2082 #if defined(OS_WIN) 2139 #if defined(OS_WIN)
2083 #if defined(GOOGLE_CHROME_BUILD) 2140 #if defined(GOOGLE_CHROME_BUILD)
2084 // The pre-read experiment is Windows and Google Chrome specific. 2141 // The pre-read experiment is Windows and Google Chrome specific.
2085 scoped_ptr<base::Environment> env(base::Environment::Create()); 2142 scoped_ptr<base::Environment> env(base::Environment::Create());
2086 2143
2087 // Only record the sub-histogram result if the experiment is running 2144 // Only record the sub-histogram result if the experiment is running
2088 // (environment variable is set, and valid). 2145 // (environment variable is set, and valid).
2089 std::string pre_read; 2146 std::string pre_read;
2090 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && 2147 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) &&
2091 (pre_read == "0" || pre_read == "1")) { 2148 (pre_read == "0" || pre_read == "1")) {
2092 std::string uma_name(name); 2149 std::string uma_name(name);
2093 uma_name += "_PreRead"; 2150 uma_name += "_PreRead";
2094 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; 2151 uma_name += pre_read == "1" ? "Enabled" : "Disabled";
2095 AddPreReadHistogramTime(uma_name.c_str(), time); 2152 AddPreReadHistogramTime(uma_name.c_str(), time);
2096 } 2153 }
2097 #endif 2154 #endif
2098 #endif 2155 #endif
2099 } 2156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698