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