Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 7867044: PART1: Initiated the SignedSettings refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments and issues. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 #include "chrome/browser/ui/gtk/gtk_util.h" 121 #include "chrome/browser/ui/gtk/gtk_util.h"
122 #endif 122 #endif
123 123
124 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 124 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
125 #include "chrome/browser/first_run/upgrade_util_linux.h" 125 #include "chrome/browser/first_run/upgrade_util_linux.h"
126 #endif 126 #endif
127 127
128 #if defined(OS_CHROMEOS) 128 #if defined(OS_CHROMEOS)
129 #include "chrome/browser/chromeos/boot_times_loader.h" 129 #include "chrome/browser/chromeos/boot_times_loader.h"
130 #include "chrome/browser/chromeos/brightness_observer.h" 130 #include "chrome/browser/chromeos/brightness_observer.h"
131 #include "chrome/browser/chromeos/cros_settings.h"
131 #include "chrome/browser/chromeos/cros_settings_names.h" 132 #include "chrome/browser/chromeos/cros_settings_names.h"
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/customization_document.h" 135 #include "chrome/browser/chromeos/customization_document.h"
135 #include "chrome/browser/chromeos/external_metrics.h" 136 #include "chrome/browser/chromeos/external_metrics.h"
136 #include "chrome/browser/chromeos/login/authenticator.h" 137 #include "chrome/browser/chromeos/login/authenticator.h"
137 #include "chrome/browser/chromeos/login/login_utils.h" 138 #include "chrome/browser/chromeos/login/login_utils.h"
138 #include "chrome/browser/chromeos/login/ownership_service.h" 139 #include "chrome/browser/chromeos/login/ownership_service.h"
139 #include "chrome/browser/chromeos/login/screen_locker.h" 140 #include "chrome/browser/chromeos/login/screen_locker.h"
140 #include "chrome/browser/chromeos/login/user_manager.h" 141 #include "chrome/browser/chromeos/login/user_manager.h"
141 #include "chrome/browser/chromeos/system_key_event_listener.h" 142 #include "chrome/browser/chromeos/system_key_event_listener.h"
142 #include "chrome/browser/chromeos/user_cros_settings_provider.h"
143 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h" 143 #include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h"
144 #include "chrome/browser/oom_priority_manager.h" 144 #include "chrome/browser/oom_priority_manager.h"
145 #include "chrome/browser/ui/views/browser_dialogs.h" 145 #include "chrome/browser/ui/views/browser_dialogs.h"
146 #endif 146 #endif
147 147
148 // TODO(port): several win-only methods have been pulled out of this, but 148 // TODO(port): several win-only methods have been pulled out of this, but
149 // BrowserMain() as a whole needs to be broken apart so that it's usable by 149 // BrowserMain() as a whole needs to be broken apart so that it's usable by
150 // other platforms. For now, it's just a stub. This is a serious work in 150 // other platforms. For now, it's just a stub. This is a serious work in
151 // progress and should not be taken as an indication of a real refactoring. 151 // progress and should not be taken as an indication of a real refactoring.
152 152
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 // through configuration policy or user preference. It must be disabled for 620 // through configuration policy or user preference. It must be disabled for
621 // Guest mode on Chrome OS in Stable channel. 621 // Guest mode on Chrome OS in Stable channel.
622 // The kHeadless environment variable overrides the decision, but only if the 622 // The kHeadless environment variable overrides the decision, but only if the
623 // crash service is under control of the user. It is used by QA testing 623 // crash service is under control of the user. It is used by QA testing
624 // infrastructure to switch on generation of crash reports. 624 // infrastructure to switch on generation of crash reports.
625 #if defined(OS_CHROMEOS) 625 #if defined(OS_CHROMEOS)
626 bool is_guest_session = 626 bool is_guest_session =
627 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); 627 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession);
628 bool is_stable_channel = 628 bool is_stable_channel =
629 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; 629 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE;
630 // TODO(pastarmovj): Consider the TrustedGet here.
631 bool reporting_enabled;
632 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
633 &reporting_enabled);
630 bool breakpad_enabled = 634 bool breakpad_enabled =
631 !(is_guest_session && is_stable_channel) && 635 !(is_guest_session && is_stable_channel) && reporting_enabled;
632 chromeos::UserCrosSettingsProvider::cached_reporting_enabled();
633 if (!breakpad_enabled) 636 if (!breakpad_enabled)
634 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; 637 breakpad_enabled = getenv(env_vars::kHeadless) != NULL;
635 #else 638 #else
636 const PrefService::Preference* metrics_reporting_enabled = 639 const PrefService::Preference* metrics_reporting_enabled =
637 local_state->FindPreference(prefs::kMetricsReportingEnabled); 640 local_state->FindPreference(prefs::kMetricsReportingEnabled);
638 CHECK(metrics_reporting_enabled); 641 CHECK(metrics_reporting_enabled);
639 bool breakpad_enabled = 642 bool breakpad_enabled =
640 local_state->GetBoolean(prefs::kMetricsReportingEnabled); 643 local_state->GetBoolean(prefs::kMetricsReportingEnabled);
641 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) 644 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable())
642 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; 645 breakpad_enabled = getenv(env_vars::kHeadless) != NULL;
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 // on recording, but not reporting, otherwise tests fail. 1103 // on recording, but not reporting, otherwise tests fail.
1101 metrics->StartRecordingOnly(); 1104 metrics->StartRecordingOnly();
1102 return metrics; 1105 return metrics;
1103 } 1106 }
1104 1107
1105 // If the user permits metrics reporting with the checkbox in the 1108 // If the user permits metrics reporting with the checkbox in the
1106 // prefs, we turn on recording. We disable metrics completely for 1109 // prefs, we turn on recording. We disable metrics completely for
1107 // non-official builds. 1110 // non-official builds.
1108 #if defined(GOOGLE_CHROME_BUILD) 1111 #if defined(GOOGLE_CHROME_BUILD)
1109 #if defined(OS_CHROMEOS) 1112 #if defined(OS_CHROMEOS)
1110 bool enabled = chromeos::UserCrosSettingsProvider::cached_reporting_enabled(); 1113 bool enabled;
1114 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
1115 &enabled);
1111 #else 1116 #else
1112 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); 1117 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled);
1113 #endif // #if defined(OS_CHROMEOS) 1118 #endif // #if defined(OS_CHROMEOS)
1114 if (enabled) { 1119 if (enabled) {
1115 metrics->Start(); 1120 metrics->Start();
1116 } 1121 }
1117 #endif // defined(GOOGLE_CHROME_BUILD) 1122 #endif // defined(GOOGLE_CHROME_BUILD)
1118 1123
1119 return metrics; 1124 return metrics;
1120 } 1125 }
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && 2046 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) &&
2042 (pre_read == "0" || pre_read == "1")) { 2047 (pre_read == "0" || pre_read == "1")) {
2043 std::string uma_name(name); 2048 std::string uma_name(name);
2044 uma_name += "_PreRead"; 2049 uma_name += "_PreRead";
2045 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; 2050 uma_name += pre_read == "1" ? "Enabled" : "Disabled";
2046 AddPreReadHistogramTime(uma_name.c_str(), time); 2051 AddPreReadHistogramTime(uma_name.c_str(), time);
2047 } 2052 }
2048 #endif 2053 #endif
2049 #endif 2054 #endif
2050 } 2055 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698