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/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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 126 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
127 #include "chrome/browser/first_run/upgrade_util_linux.h" | 127 #include "chrome/browser/first_run/upgrade_util_linux.h" |
128 #endif | 128 #endif |
129 | 129 |
130 #if defined(OS_CHROMEOS) | 130 #if defined(OS_CHROMEOS) |
131 #include "chrome/browser/chromeos/audio_handler.h" | 131 #include "chrome/browser/chromeos/audio_handler.h" |
132 #include "chrome/browser/chromeos/boot_times_loader.h" | 132 #include "chrome/browser/chromeos/boot_times_loader.h" |
133 #include "chrome/browser/chromeos/cros/cros_library.h" | 133 #include "chrome/browser/chromeos/cros/cros_library.h" |
134 #include "chrome/browser/chromeos/cros/screen_lock_library.h" | 134 #include "chrome/browser/chromeos/cros/screen_lock_library.h" |
| 135 #include "chrome/browser/chromeos/cros_settings.h" |
135 #include "chrome/browser/chromeos/cros_settings_names.h" | 136 #include "chrome/browser/chromeos/cros_settings_names.h" |
136 #include "chrome/browser/chromeos/customization_document.h" | 137 #include "chrome/browser/chromeos/customization_document.h" |
137 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 138 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
138 #include "chrome/browser/chromeos/external_metrics.h" | 139 #include "chrome/browser/chromeos/external_metrics.h" |
139 #include "chrome/browser/chromeos/login/authenticator.h" | 140 #include "chrome/browser/chromeos/login/authenticator.h" |
140 #include "chrome/browser/chromeos/login/login_utils.h" | 141 #include "chrome/browser/chromeos/login/login_utils.h" |
141 #include "chrome/browser/chromeos/login/ownership_service.h" | 142 #include "chrome/browser/chromeos/login/ownership_service.h" |
142 #include "chrome/browser/chromeos/login/screen_locker.h" | 143 #include "chrome/browser/chromeos/login/screen_locker.h" |
143 #include "chrome/browser/chromeos/login/user_manager.h" | 144 #include "chrome/browser/chromeos/login/user_manager.h" |
144 #include "chrome/browser/chromeos/system/runtime_environment.h" | 145 #include "chrome/browser/chromeos/system/runtime_environment.h" |
145 #include "chrome/browser/chromeos/system_key_event_listener.h" | 146 #include "chrome/browser/chromeos/system_key_event_listener.h" |
146 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | |
147 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" | 147 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" |
148 #include "chrome/browser/oom_priority_manager.h" | 148 #include "chrome/browser/oom_priority_manager.h" |
149 #include "chrome/browser/ui/views/browser_dialogs.h" | 149 #include "chrome/browser/ui/views/browser_dialogs.h" |
150 #endif | 150 #endif |
151 | 151 |
152 // TODO(port): several win-only methods have been pulled out of this, but | 152 // 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 | 153 // 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 | 154 // 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. | 155 // progress and should not be taken as an indication of a real refactoring. |
156 | 156 |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 // through configuration policy or user preference. It must be disabled for | 611 // through configuration policy or user preference. It must be disabled for |
612 // Guest mode on Chrome OS in Stable channel. | 612 // Guest mode on Chrome OS in Stable channel. |
613 // The kHeadless environment variable overrides the decision, but only if the | 613 // The kHeadless environment variable overrides the decision, but only if the |
614 // crash service is under control of the user. It is used by QA testing | 614 // crash service is under control of the user. It is used by QA testing |
615 // infrastructure to switch on generation of crash reports. | 615 // infrastructure to switch on generation of crash reports. |
616 #if defined(OS_CHROMEOS) | 616 #if defined(OS_CHROMEOS) |
617 bool is_guest_session = | 617 bool is_guest_session = |
618 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); | 618 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); |
619 bool is_stable_channel = | 619 bool is_stable_channel = |
620 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; | 620 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; |
| 621 // TODO(pastarmovj): Consider the TrustedGet here. |
| 622 bool reporting_enabled; |
| 623 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
| 624 &reporting_enabled); |
621 bool breakpad_enabled = | 625 bool breakpad_enabled = |
622 !(is_guest_session && is_stable_channel) && | 626 !(is_guest_session && is_stable_channel) && reporting_enabled; |
623 chromeos::UserCrosSettingsProvider::cached_reporting_enabled(); | |
624 if (!breakpad_enabled) | 627 if (!breakpad_enabled) |
625 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 628 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
626 #else | 629 #else |
627 const PrefService::Preference* metrics_reporting_enabled = | 630 const PrefService::Preference* metrics_reporting_enabled = |
628 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 631 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
629 CHECK(metrics_reporting_enabled); | 632 CHECK(metrics_reporting_enabled); |
630 bool breakpad_enabled = | 633 bool breakpad_enabled = |
631 local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 634 local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
632 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) | 635 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) |
633 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 636 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 // on recording, but not reporting, otherwise tests fail. | 1102 // on recording, but not reporting, otherwise tests fail. |
1100 metrics->StartRecordingOnly(); | 1103 metrics->StartRecordingOnly(); |
1101 return metrics; | 1104 return metrics; |
1102 } | 1105 } |
1103 | 1106 |
1104 // If the user permits metrics reporting with the checkbox in the | 1107 // If the user permits metrics reporting with the checkbox in the |
1105 // prefs, we turn on recording. We disable metrics completely for | 1108 // prefs, we turn on recording. We disable metrics completely for |
1106 // non-official builds. | 1109 // non-official builds. |
1107 #if defined(GOOGLE_CHROME_BUILD) | 1110 #if defined(GOOGLE_CHROME_BUILD) |
1108 #if defined(OS_CHROMEOS) | 1111 #if defined(OS_CHROMEOS) |
1109 bool enabled = chromeos::UserCrosSettingsProvider::cached_reporting_enabled(); | 1112 bool enabled; |
| 1113 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
| 1114 &enabled); |
1110 #else | 1115 #else |
1111 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 1116 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
1112 #endif // #if defined(OS_CHROMEOS) | 1117 #endif // #if defined(OS_CHROMEOS) |
1113 if (enabled) { | 1118 if (enabled) { |
1114 metrics->Start(); | 1119 metrics->Start(); |
1115 } | 1120 } |
1116 #endif // defined(GOOGLE_CHROME_BUILD) | 1121 #endif // defined(GOOGLE_CHROME_BUILD) |
1117 | 1122 |
1118 return metrics; | 1123 return metrics; |
1119 } | 1124 } |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2101 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
2097 (pre_read == "0" || pre_read == "1")) { | 2102 (pre_read == "0" || pre_read == "1")) { |
2098 std::string uma_name(name); | 2103 std::string uma_name(name); |
2099 uma_name += "_PreRead"; | 2104 uma_name += "_PreRead"; |
2100 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2105 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
2101 AddPreReadHistogramTime(uma_name.c_str(), time); | 2106 AddPreReadHistogramTime(uma_name.c_str(), time); |
2102 } | 2107 } |
2103 #endif | 2108 #endif |
2104 #endif | 2109 #endif |
2105 } | 2110 } |
OLD | NEW |