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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 #endif | 123 #endif |
124 | 124 |
125 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 125 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
126 #include "chrome/browser/first_run/upgrade_util_linux.h" | 126 #include "chrome/browser/first_run/upgrade_util_linux.h" |
127 #endif | 127 #endif |
128 | 128 |
129 #if defined(OS_CHROMEOS) | 129 #if defined(OS_CHROMEOS) |
130 #include "chrome/browser/chromeos/audio_handler.h" | 130 #include "chrome/browser/chromeos/audio_handler.h" |
131 #include "chrome/browser/chromeos/boot_times_loader.h" | 131 #include "chrome/browser/chromeos/boot_times_loader.h" |
132 #include "chrome/browser/chromeos/brightness_observer.h" | 132 #include "chrome/browser/chromeos/brightness_observer.h" |
| 133 #include "chrome/browser/chromeos/cros_settings.h" |
133 #include "chrome/browser/chromeos/cros_settings_names.h" | 134 #include "chrome/browser/chromeos/cros_settings_names.h" |
134 #include "chrome/browser/chromeos/cros/cros_library.h" | 135 #include "chrome/browser/chromeos/cros/cros_library.h" |
135 #include "chrome/browser/chromeos/cros/screen_lock_library.h" | 136 #include "chrome/browser/chromeos/cros/screen_lock_library.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_key_event_listener.h" | 145 #include "chrome/browser/chromeos/system_key_event_listener.h" |
145 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | |
146 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" | 146 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" |
147 #include "chrome/browser/oom_priority_manager.h" | 147 #include "chrome/browser/oom_priority_manager.h" |
148 #include "chrome/browser/ui/views/browser_dialogs.h" | 148 #include "chrome/browser/ui/views/browser_dialogs.h" |
149 #endif | 149 #endif |
150 | 150 |
151 // TODO(port): several win-only methods have been pulled out of this, but | 151 // TODO(port): several win-only methods have been pulled out of this, but |
152 // BrowserMain() as a whole needs to be broken apart so that it's usable by | 152 // BrowserMain() as a whole needs to be broken apart so that it's usable by |
153 // other platforms. For now, it's just a stub. This is a serious work in | 153 // other platforms. For now, it's just a stub. This is a serious work in |
154 // progress and should not be taken as an indication of a real refactoring. | 154 // progress and should not be taken as an indication of a real refactoring. |
155 | 155 |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 // through configuration policy or user preference. It must be disabled for | 624 // through configuration policy or user preference. It must be disabled for |
625 // Guest mode on Chrome OS in Stable channel. | 625 // Guest mode on Chrome OS in Stable channel. |
626 // The kHeadless environment variable overrides the decision, but only if the | 626 // The kHeadless environment variable overrides the decision, but only if the |
627 // crash service is under control of the user. It is used by QA testing | 627 // crash service is under control of the user. It is used by QA testing |
628 // infrastructure to switch on generation of crash reports. | 628 // infrastructure to switch on generation of crash reports. |
629 #if defined(OS_CHROMEOS) | 629 #if defined(OS_CHROMEOS) |
630 bool is_guest_session = | 630 bool is_guest_session = |
631 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); | 631 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); |
632 bool is_stable_channel = | 632 bool is_stable_channel = |
633 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; | 633 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; |
| 634 // TODO(pastarmovj): Consider the TrustedGet here. |
| 635 bool reporting_enabled; |
| 636 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
| 637 &reporting_enabled); |
634 bool breakpad_enabled = | 638 bool breakpad_enabled = |
635 !(is_guest_session && is_stable_channel) && | 639 !(is_guest_session && is_stable_channel) && reporting_enabled; |
636 chromeos::UserCrosSettingsProvider::cached_reporting_enabled(); | |
637 if (!breakpad_enabled) | 640 if (!breakpad_enabled) |
638 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 641 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
639 #else | 642 #else |
640 const PrefService::Preference* metrics_reporting_enabled = | 643 const PrefService::Preference* metrics_reporting_enabled = |
641 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 644 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
642 CHECK(metrics_reporting_enabled); | 645 CHECK(metrics_reporting_enabled); |
643 bool breakpad_enabled = | 646 bool breakpad_enabled = |
644 local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 647 local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
645 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) | 648 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) |
646 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 649 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 // on recording, but not reporting, otherwise tests fail. | 1113 // on recording, but not reporting, otherwise tests fail. |
1111 metrics->StartRecordingOnly(); | 1114 metrics->StartRecordingOnly(); |
1112 return metrics; | 1115 return metrics; |
1113 } | 1116 } |
1114 | 1117 |
1115 // If the user permits metrics reporting with the checkbox in the | 1118 // If the user permits metrics reporting with the checkbox in the |
1116 // prefs, we turn on recording. We disable metrics completely for | 1119 // prefs, we turn on recording. We disable metrics completely for |
1117 // non-official builds. | 1120 // non-official builds. |
1118 #if defined(GOOGLE_CHROME_BUILD) | 1121 #if defined(GOOGLE_CHROME_BUILD) |
1119 #if defined(OS_CHROMEOS) | 1122 #if defined(OS_CHROMEOS) |
1120 bool enabled = chromeos::UserCrosSettingsProvider::cached_reporting_enabled(); | 1123 bool enabled; |
| 1124 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
| 1125 &enabled); |
1121 #else | 1126 #else |
1122 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 1127 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
1123 #endif // #if defined(OS_CHROMEOS) | 1128 #endif // #if defined(OS_CHROMEOS) |
1124 if (enabled) { | 1129 if (enabled) { |
1125 metrics->Start(); | 1130 metrics->Start(); |
1126 } | 1131 } |
1127 #endif // defined(GOOGLE_CHROME_BUILD) | 1132 #endif // defined(GOOGLE_CHROME_BUILD) |
1128 | 1133 |
1129 return metrics; | 1134 return metrics; |
1130 } | 1135 } |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2073 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2078 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
2074 (pre_read == "0" || pre_read == "1")) { | 2079 (pre_read == "0" || pre_read == "1")) { |
2075 std::string uma_name(name); | 2080 std::string uma_name(name); |
2076 uma_name += "_PreRead"; | 2081 uma_name += "_PreRead"; |
2077 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2082 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
2078 AddPreReadHistogramTime(uma_name.c_str(), time); | 2083 AddPreReadHistogramTime(uma_name.c_str(), time); |
2079 } | 2084 } |
2080 #endif | 2085 #endif |
2081 #endif | 2086 #endif |
2082 } | 2087 } |
OLD | NEW |