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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 #include "chrome/app/breakpad_linux.h" | 122 #include "chrome/app/breakpad_linux.h" |
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/cros_settings.h" | |
Mattias Nissler (ping if slow)
2011/11/18 14:12:00
cros_settings.h and cros_settings_names.h should b
pastarmovj
2011/11/18 15:01:38
Done.
| |
132 #include "chrome/browser/chromeos/cros/cros_library.h" | 133 #include "chrome/browser/chromeos/cros/cros_library.h" |
133 #include "chrome/browser/chromeos/cros/screen_lock_library.h" | 134 #include "chrome/browser/chromeos/cros/screen_lock_library.h" |
134 #include "chrome/browser/chromeos/cros_settings_names.h" | 135 #include "chrome/browser/chromeos/cros_settings_names.h" |
135 #include "chrome/browser/chromeos/customization_document.h" | 136 #include "chrome/browser/chromeos/customization_document.h" |
136 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 137 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
137 #include "chrome/browser/chromeos/external_metrics.h" | 138 #include "chrome/browser/chromeos/external_metrics.h" |
138 #include "chrome/browser/chromeos/login/authenticator.h" | 139 #include "chrome/browser/chromeos/login/authenticator.h" |
139 #include "chrome/browser/chromeos/login/login_utils.h" | 140 #include "chrome/browser/chromeos/login/login_utils.h" |
140 #include "chrome/browser/chromeos/login/ownership_service.h" | 141 #include "chrome/browser/chromeos/login/ownership_service.h" |
141 #include "chrome/browser/chromeos/login/screen_locker.h" | 142 #include "chrome/browser/chromeos/login/screen_locker.h" |
142 #include "chrome/browser/chromeos/login/user_manager.h" | 143 #include "chrome/browser/chromeos/login/user_manager.h" |
143 #include "chrome/browser/chromeos/system/runtime_environment.h" | 144 #include "chrome/browser/chromeos/system/runtime_environment.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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
617 // through configuration policy or user preference. It must be disabled for | 617 // through configuration policy or user preference. It must be disabled for |
618 // Guest mode on Chrome OS in Stable channel. | 618 // Guest mode on Chrome OS in Stable channel. |
619 // The kHeadless environment variable overrides the decision, but only if the | 619 // The kHeadless environment variable overrides the decision, but only if the |
620 // crash service is under control of the user. It is used by QA testing | 620 // crash service is under control of the user. It is used by QA testing |
621 // infrastructure to switch on generation of crash reports. | 621 // infrastructure to switch on generation of crash reports. |
622 #if defined(OS_CHROMEOS) | 622 #if defined(OS_CHROMEOS) |
623 bool is_guest_session = | 623 bool is_guest_session = |
624 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); | 624 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); |
625 bool is_stable_channel = | 625 bool is_stable_channel = |
626 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; | 626 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; |
627 // TODO(pastarmovj): Consider the TrustedGet here. | |
628 bool reporting_enabled; | |
629 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, | |
630 &reporting_enabled); | |
627 bool breakpad_enabled = | 631 bool breakpad_enabled = |
628 !(is_guest_session && is_stable_channel) && | 632 !(is_guest_session && is_stable_channel) && reporting_enabled; |
629 chromeos::UserCrosSettingsProvider::cached_reporting_enabled(); | |
630 if (!breakpad_enabled) | 633 if (!breakpad_enabled) |
631 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 634 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
632 #else | 635 #else |
633 const PrefService::Preference* metrics_reporting_enabled = | 636 const PrefService::Preference* metrics_reporting_enabled = |
634 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 637 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
635 CHECK(metrics_reporting_enabled); | 638 CHECK(metrics_reporting_enabled); |
636 bool breakpad_enabled = | 639 bool breakpad_enabled = |
637 local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 640 local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
638 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) | 641 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) |
639 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 642 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1102 // on recording, but not reporting, otherwise tests fail. | 1105 // on recording, but not reporting, otherwise tests fail. |
1103 metrics->StartRecordingOnly(); | 1106 metrics->StartRecordingOnly(); |
1104 return metrics; | 1107 return metrics; |
1105 } | 1108 } |
1106 | 1109 |
1107 // If the user permits metrics reporting with the checkbox in the | 1110 // If the user permits metrics reporting with the checkbox in the |
1108 // prefs, we turn on recording. We disable metrics completely for | 1111 // prefs, we turn on recording. We disable metrics completely for |
1109 // non-official builds. | 1112 // non-official builds. |
1110 #if defined(GOOGLE_CHROME_BUILD) | 1113 #if defined(GOOGLE_CHROME_BUILD) |
1111 #if defined(OS_CHROMEOS) | 1114 #if defined(OS_CHROMEOS) |
1112 bool enabled = chromeos::UserCrosSettingsProvider::cached_reporting_enabled(); | 1115 bool enabled; |
1116 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, | |
1117 &enabled); | |
1113 #else | 1118 #else |
1114 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 1119 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
1115 #endif // #if defined(OS_CHROMEOS) | 1120 #endif // #if defined(OS_CHROMEOS) |
1116 if (enabled) { | 1121 if (enabled) { |
1117 metrics->Start(); | 1122 metrics->Start(); |
1118 } | 1123 } |
1119 #endif // defined(GOOGLE_CHROME_BUILD) | 1124 #endif // defined(GOOGLE_CHROME_BUILD) |
1120 | 1125 |
1121 return metrics; | 1126 return metrics; |
1122 } | 1127 } |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2086 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2091 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
2087 (pre_read == "0" || pre_read == "1")) { | 2092 (pre_read == "0" || pre_read == "1")) { |
2088 std::string uma_name(name); | 2093 std::string uma_name(name); |
2089 uma_name += "_PreRead"; | 2094 uma_name += "_PreRead"; |
2090 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2095 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
2091 AddPreReadHistogramTime(uma_name.c_str(), time); | 2096 AddPreReadHistogramTime(uma_name.c_str(), time); |
2092 } | 2097 } |
2093 #endif | 2098 #endif |
2094 #endif | 2099 #endif |
2095 } | 2100 } |
OLD | NEW |