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

Side by Side Diff: chrome/browser/chromeos/login/startup_utils.cc

Issue 1083683003: Speculative revert by sheriff (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed an unrelated commit that had accidentally slipped in. Created 5 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/login/startup_utils.h" 5 #include "chrome/browser/chromeos/login/startup_utils.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/prefs/pref_registry_simple.h" 11 #include "base/prefs/pref_registry_simple.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/sys_info.h" 13 #include "base/sys_info.h"
14 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
17 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
18 #include "chrome/common/extensions/features/feature_channel.h" 17 #include "chrome/common/extensions/features/feature_channel.h"
19 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
20 #include "chromeos/chromeos_switches.h" 19 #include "chromeos/chromeos_switches.h"
21 #include "components/web_resource/web_resource_pref_names.h" 20 #include "components/web_resource/web_resource_pref_names.h"
22 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
23 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
24 23
25 using content::BrowserThread; 24 using content::BrowserThread;
26 25
(...skipping 26 matching lines...) Expand all
53 namespace chromeos { 52 namespace chromeos {
54 53
55 // static 54 // static
56 void StartupUtils::RegisterPrefs(PrefRegistrySimple* registry) { 55 void StartupUtils::RegisterPrefs(PrefRegistrySimple* registry) {
57 registry->RegisterBooleanPref(prefs::kOobeComplete, false); 56 registry->RegisterBooleanPref(prefs::kOobeComplete, false);
58 registry->RegisterStringPref(prefs::kOobeScreenPending, ""); 57 registry->RegisterStringPref(prefs::kOobeScreenPending, "");
59 registry->RegisterIntegerPref(prefs::kDeviceRegistered, -1); 58 registry->RegisterIntegerPref(prefs::kDeviceRegistered, -1);
60 registry->RegisterBooleanPref(prefs::kEnrollmentRecoveryRequired, false); 59 registry->RegisterBooleanPref(prefs::kEnrollmentRecoveryRequired, false);
61 registry->RegisterStringPref(prefs::kInitialLocale, "en-US"); 60 registry->RegisterStringPref(prefs::kInitialLocale, "en-US");
62 registry->RegisterBooleanPref(prefs::kNewOobe, false); 61 registry->RegisterBooleanPref(prefs::kNewOobe, false);
63 registry->RegisterBooleanPref(prefs::kWebviewSigninDisabled, false); 62 registry->RegisterBooleanPref(prefs::kWebviewSigninEnabled, false);
64 } 63 }
65 64
66 // static 65 // static
67 bool StartupUtils::IsEulaAccepted() { 66 bool StartupUtils::IsEulaAccepted() {
68 return g_browser_process->local_state()->GetBoolean(prefs::kEulaAccepted); 67 return g_browser_process->local_state()->GetBoolean(prefs::kEulaAccepted);
69 } 68 }
70 69
71 // static 70 // static
72 bool StartupUtils::IsOobeCompleted() { 71 bool StartupUtils::IsOobeCompleted() {
73 return g_browser_process->local_state()->GetBoolean(prefs::kOobeComplete); 72 return g_browser_process->local_state()->GetBoolean(prefs::kOobeComplete);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 std::string StartupUtils::GetInitialLocale() { 172 std::string StartupUtils::GetInitialLocale() {
174 std::string locale = 173 std::string locale =
175 g_browser_process->local_state()->GetString(prefs::kInitialLocale); 174 g_browser_process->local_state()->GetString(prefs::kInitialLocale);
176 if (!l10n_util::IsValidLocaleSyntax(locale)) 175 if (!l10n_util::IsValidLocaleSyntax(locale))
177 locale = "en-US"; 176 locale = "en-US";
178 return locale; 177 return locale;
179 } 178 }
180 179
181 // static 180 // static
182 bool StartupUtils::IsWebviewSigninAllowed() { 181 bool StartupUtils::IsWebviewSigninAllowed() {
183 return !base::CommandLine::ForCurrentProcess()->HasSwitch( 182 return extensions::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV &&
184 switches::kDisableWebviewSigninFlow); 183 !base::CommandLine::ForCurrentProcess()->HasSwitch(
184 switches::kDisableWebviewSigninFlow);
185 } 185 }
186 186
187 // static 187 // static
188 bool StartupUtils::IsWebviewSigninEnabled() { 188 bool StartupUtils::IsWebviewSigninEnabled() {
189 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = 189 return IsWebviewSigninAllowed() &&
190 g_browser_process 190 g_browser_process->local_state()->GetBoolean(
191 ? g_browser_process->platform_part() 191 prefs::kWebviewSigninEnabled);
192 ->browser_policy_connector_chromeos()
193 ->GetDeviceCloudPolicyManager()
194 : nullptr;
195
196 bool is_remora_or_shark_requisition =
197 policy_manager
198 ? policy_manager->IsRemoraRequisition() ||
199 policy_manager->IsSharkRequisition()
200 : false;
201
202 bool is_webview_disabled_pref = g_browser_process->local_state()->GetBoolean(
203 prefs::kWebviewSigninDisabled);
204
205 // TODO(dzhioev): Re-enable webview signin for remora/shark requisition
206 // http://crbug.com/464049
207 return !is_remora_or_shark_requisition && IsWebviewSigninAllowed() &&
208 !is_webview_disabled_pref;
209 } 192 }
210 193
211 // static 194 // static
212 bool StartupUtils::EnableWebviewSignin(bool is_enabled) { 195 bool StartupUtils::EnableWebviewSignin(bool is_enabled) {
213 if (is_enabled && !IsWebviewSigninAllowed()) 196 if (!IsWebviewSigninAllowed())
214 return false; 197 return false;
215 198
216 g_browser_process->local_state()->SetBoolean(prefs::kWebviewSigninDisabled, 199 g_browser_process->local_state()->SetBoolean(prefs::kWebviewSigninEnabled,
217 !is_enabled); 200 is_enabled);
218 return true; 201 return true;
219 } 202 }
220 203
221 // static 204 // static
222 void StartupUtils::SetInitialLocale(const std::string& locale) { 205 void StartupUtils::SetInitialLocale(const std::string& locale) {
223 if (l10n_util::IsValidLocaleSyntax(locale)) 206 if (l10n_util::IsValidLocaleSyntax(locale))
224 SaveStringPreferenceForced(prefs::kInitialLocale, locale); 207 SaveStringPreferenceForced(prefs::kInitialLocale, locale);
225 else 208 else
226 NOTREACHED(); 209 NOTREACHED();
227 } 210 }
228 211
229 // static 212 // static
230 bool StartupUtils::IsNewOobeAllowed() { 213 bool StartupUtils::IsNewOobeAllowed() {
231 return extensions::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV; 214 return extensions::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV;
232 } 215 }
233 216
234 // static 217 // static
235 bool StartupUtils::IsNewOobeActivated() { 218 bool StartupUtils::IsNewOobeActivated() {
236 return g_browser_process->local_state()->GetBoolean(prefs::kNewOobe) && 219 return g_browser_process->local_state()->GetBoolean(prefs::kNewOobe) &&
237 IsNewOobeAllowed(); 220 IsNewOobeAllowed();
238 } 221 }
239 222
240 } // namespace chromeos 223 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/signin/oauth2_browsertest.cc ('k') | chrome/browser/chromeos/login/test/oobe_base_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698