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/browser_main.h" | 5 #include "chrome/browser/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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 #include "chrome/browser/ui/gtk/gtk_util.h" | 131 #include "chrome/browser/ui/gtk/gtk_util.h" |
132 #endif | 132 #endif |
133 | 133 |
134 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 134 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
135 #include "chrome/browser/first_run/upgrade_util_linux.h" | 135 #include "chrome/browser/first_run/upgrade_util_linux.h" |
136 #endif | 136 #endif |
137 | 137 |
138 #if defined(OS_CHROMEOS) | 138 #if defined(OS_CHROMEOS) |
139 #include "chrome/browser/chromeos/boot_times_loader.h" | 139 #include "chrome/browser/chromeos/boot_times_loader.h" |
140 #include "chrome/browser/chromeos/brightness_observer.h" | 140 #include "chrome/browser/chromeos/brightness_observer.h" |
| 141 #include "chrome/browser/chromeos/cros_settings_names.h" |
141 #include "chrome/browser/chromeos/cros/cros_library.h" | 142 #include "chrome/browser/chromeos/cros/cros_library.h" |
142 #include "chrome/browser/chromeos/cros/screen_lock_library.h" | 143 #include "chrome/browser/chromeos/cros/screen_lock_library.h" |
143 #include "chrome/browser/chromeos/customization_document.h" | 144 #include "chrome/browser/chromeos/customization_document.h" |
144 #include "chrome/browser/chromeos/external_metrics.h" | 145 #include "chrome/browser/chromeos/external_metrics.h" |
145 #include "chrome/browser/chromeos/login/authenticator.h" | 146 #include "chrome/browser/chromeos/login/authenticator.h" |
146 #include "chrome/browser/chromeos/login/login_utils.h" | 147 #include "chrome/browser/chromeos/login/login_utils.h" |
147 #include "chrome/browser/chromeos/login/ownership_service.h" | 148 #include "chrome/browser/chromeos/login/ownership_service.h" |
148 #include "chrome/browser/chromeos/login/screen_locker.h" | 149 #include "chrome/browser/chromeos/login/screen_locker.h" |
149 #include "chrome/browser/chromeos/login/user_manager.h" | 150 #include "chrome/browser/chromeos/login/user_manager.h" |
150 #include "chrome/browser/chromeos/metrics_cros_settings_provider.h" | |
151 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h" | 151 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h" |
152 #include "chrome/browser/chromeos/system_key_event_listener.h" | 152 #include "chrome/browser/chromeos/system_key_event_listener.h" |
| 153 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
153 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" | 154 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" |
154 #include "chrome/browser/oom_priority_manager.h" | 155 #include "chrome/browser/oom_priority_manager.h" |
155 #include "chrome/browser/ui/views/browser_dialogs.h" | 156 #include "chrome/browser/ui/views/browser_dialogs.h" |
156 #endif | 157 #endif |
157 | 158 |
158 // TODO(port): several win-only methods have been pulled out of this, but | 159 // TODO(port): several win-only methods have been pulled out of this, but |
159 // BrowserMain() as a whole needs to be broken apart so that it's usable by | 160 // BrowserMain() as a whole needs to be broken apart so that it's usable by |
160 // other platforms. For now, it's just a stub. This is a serious work in | 161 // other platforms. For now, it's just a stub. This is a serious work in |
161 // progress and should not be taken as an indication of a real refactoring. | 162 // progress and should not be taken as an indication of a real refactoring. |
162 | 163 |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 // on recording, but not reporting, otherwise tests fail. | 612 // on recording, but not reporting, otherwise tests fail. |
612 metrics->StartRecordingOnly(); | 613 metrics->StartRecordingOnly(); |
613 return metrics; | 614 return metrics; |
614 } | 615 } |
615 | 616 |
616 // If the user permits metrics reporting with the checkbox in the | 617 // If the user permits metrics reporting with the checkbox in the |
617 // prefs, we turn on recording. We disable metrics completely for | 618 // prefs, we turn on recording. We disable metrics completely for |
618 // non-official builds. | 619 // non-official builds. |
619 #if defined(GOOGLE_CHROME_BUILD) | 620 #if defined(GOOGLE_CHROME_BUILD) |
620 #if defined(OS_CHROMEOS) | 621 #if defined(OS_CHROMEOS) |
621 bool enabled = chromeos::MetricsCrosSettingsProvider::GetMetricsStatus(); | 622 bool enabled = chromeos::UserCrosSettingsProvider::cached_reporting_enabled(); |
622 #else | 623 #else |
623 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 624 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
624 #endif // #if defined(OS_CHROMEOS) | 625 #endif // #if defined(OS_CHROMEOS) |
625 if (enabled) { | 626 if (enabled) { |
626 metrics->Start(); | 627 metrics->Start(); |
627 } | 628 } |
628 #endif // defined(GOOGLE_CHROME_BUILD) | 629 #endif // defined(GOOGLE_CHROME_BUILD) |
629 | 630 |
630 return metrics; | 631 return metrics; |
631 } | 632 } |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 // The kHeadless environment variable overrides the decision, but only if the | 1241 // The kHeadless environment variable overrides the decision, but only if the |
1241 // crash service is under control of the user. It is used by QA testing | 1242 // crash service is under control of the user. It is used by QA testing |
1242 // infrastructure to switch on generation of crash reports. | 1243 // infrastructure to switch on generation of crash reports. |
1243 #if defined(OS_CHROMEOS) | 1244 #if defined(OS_CHROMEOS) |
1244 bool is_guest_session = | 1245 bool is_guest_session = |
1245 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); | 1246 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); |
1246 bool is_stable_channel = | 1247 bool is_stable_channel = |
1247 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; | 1248 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; |
1248 bool breakpad_enabled = | 1249 bool breakpad_enabled = |
1249 !(is_guest_session && is_stable_channel) && | 1250 !(is_guest_session && is_stable_channel) && |
1250 chromeos::MetricsCrosSettingsProvider::GetMetricsStatus(); | 1251 chromeos::UserCrosSettingsProvider::cached_reporting_enabled(); |
1251 if (!breakpad_enabled) | 1252 if (!breakpad_enabled) |
1252 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 1253 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
1253 #else | 1254 #else |
1254 const PrefService::Preference* metrics_reporting_enabled = | 1255 const PrefService::Preference* metrics_reporting_enabled = |
1255 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1256 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1256 CHECK(metrics_reporting_enabled); | 1257 CHECK(metrics_reporting_enabled); |
1257 bool breakpad_enabled = | 1258 bool breakpad_enabled = |
1258 local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 1259 local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
1259 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) | 1260 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) |
1260 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 1261 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2103 #if defined(OS_CHROMEOS) | 2104 #if defined(OS_CHROMEOS) |
2104 // To be precise, logout (browser shutdown) is not yet done, but the | 2105 // To be precise, logout (browser shutdown) is not yet done, but the |
2105 // remaining work is negligible, hence we say LogoutDone here. | 2106 // remaining work is negligible, hence we say LogoutDone here. |
2106 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 2107 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
2107 false); | 2108 false); |
2108 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 2109 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
2109 #endif | 2110 #endif |
2110 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 2111 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
2111 return result_code; | 2112 return result_code; |
2112 } | 2113 } |
OLD | NEW |