| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 #endif | 124 #endif |
| 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/brightness_observer.h" | 133 #include "chrome/browser/chromeos/brightness_observer.h" |
| 134 #include "chrome/browser/chromeos/cros_settings.h" |
| 134 #include "chrome/browser/chromeos/cros_settings_names.h" | 135 #include "chrome/browser/chromeos/cros_settings_names.h" |
| 135 #include "chrome/browser/chromeos/cros/cros_library.h" | 136 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 136 #include "chrome/browser/chromeos/cros/screen_lock_library.h" | 137 #include "chrome/browser/chromeos/cros/screen_lock_library.h" |
| 137 #include "chrome/browser/chromeos/customization_document.h" | 138 #include "chrome/browser/chromeos/customization_document.h" |
| 138 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 139 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
| 139 #include "chrome/browser/chromeos/external_metrics.h" | 140 #include "chrome/browser/chromeos/external_metrics.h" |
| 140 #include "chrome/browser/chromeos/login/authenticator.h" | 141 #include "chrome/browser/chromeos/login/authenticator.h" |
| 141 #include "chrome/browser/chromeos/login/login_utils.h" | 142 #include "chrome/browser/chromeos/login/login_utils.h" |
| 142 #include "chrome/browser/chromeos/login/ownership_service.h" | 143 #include "chrome/browser/chromeos/login/ownership_service.h" |
| 143 #include "chrome/browser/chromeos/login/screen_locker.h" | 144 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 144 #include "chrome/browser/chromeos/login/user_manager.h" | 145 #include "chrome/browser/chromeos/login/user_manager.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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 // through configuration policy or user preference. It must be disabled for | 627 // through configuration policy or user preference. It must be disabled for |
| 628 // Guest mode on Chrome OS in Stable channel. | 628 // Guest mode on Chrome OS in Stable channel. |
| 629 // The kHeadless environment variable overrides the decision, but only if the | 629 // The kHeadless environment variable overrides the decision, but only if the |
| 630 // crash service is under control of the user. It is used by QA testing | 630 // crash service is under control of the user. It is used by QA testing |
| 631 // infrastructure to switch on generation of crash reports. | 631 // infrastructure to switch on generation of crash reports. |
| 632 #if defined(OS_CHROMEOS) | 632 #if defined(OS_CHROMEOS) |
| 633 bool is_guest_session = | 633 bool is_guest_session = |
| 634 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); | 634 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); |
| 635 bool is_stable_channel = | 635 bool is_stable_channel = |
| 636 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; | 636 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; |
| 637 // TODO(pastarmovj): Consider the TrustedGet here. |
| 638 bool reporting_enabled; |
| 639 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
| 640 &reporting_enabled); |
| 637 bool breakpad_enabled = | 641 bool breakpad_enabled = |
| 638 !(is_guest_session && is_stable_channel) && | 642 !(is_guest_session && is_stable_channel) && reporting_enabled; |
| 639 chromeos::UserCrosSettingsProvider::cached_reporting_enabled(); | |
| 640 if (!breakpad_enabled) | 643 if (!breakpad_enabled) |
| 641 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 644 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
| 642 #else | 645 #else |
| 643 const PrefService::Preference* metrics_reporting_enabled = | 646 const PrefService::Preference* metrics_reporting_enabled = |
| 644 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 647 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 645 CHECK(metrics_reporting_enabled); | 648 CHECK(metrics_reporting_enabled); |
| 646 bool breakpad_enabled = | 649 bool breakpad_enabled = |
| 647 local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 650 local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
| 648 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) | 651 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) |
| 649 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 652 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
| (...skipping 460 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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2100 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
| 2096 (pre_read == "0" || pre_read == "1")) { | 2101 (pre_read == "0" || pre_read == "1")) { |
| 2097 std::string uma_name(name); | 2102 std::string uma_name(name); |
| 2098 uma_name += "_PreRead"; | 2103 uma_name += "_PreRead"; |
| 2099 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2104 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
| 2100 AddPreReadHistogramTime(uma_name.c_str(), time); | 2105 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 2101 } | 2106 } |
| 2102 #endif | 2107 #endif |
| 2103 #endif | 2108 #endif |
| 2104 } | 2109 } |
| OLD | NEW |