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

Side by Side Diff: chrome/browser/signin/signin_promo.cc

Issue 1413533009: Make the new Gaia password separated signin flow modal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DCHECK Created 5 years 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
« no previous file with comments | « chrome/browser/signin/signin_promo.h ('k') | chrome/browser/ui/browser_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/signin/signin_promo.h" 5 #include "chrome/browser/signin/signin_promo.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" 13 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h"
14 #include "chrome/browser/first_run/first_run.h" 14 #include "chrome/browser/first_run/first_run.h"
15 #include "chrome/browser/google/google_brand.h" 15 #include "chrome/browser/google/google_brand.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_info_cache.h" 17 #include "chrome/browser/profiles/profile_info_cache.h"
18 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/browser/signin/account_tracker_service_factory.h" 19 #include "chrome/browser/signin/account_tracker_service_factory.h"
20 #include "chrome/browser/signin/signin_error_controller_factory.h"
20 #include "chrome/browser/signin/signin_manager_factory.h" 21 #include "chrome/browser/signin/signin_manager_factory.h"
21 #include "chrome/browser/ui/webui/options/core_options_handler.h" 22 #include "chrome/browser/ui/webui/options/core_options_handler.h"
22 #include "chrome/browser/ui/webui/theme_source.h" 23 #include "chrome/browser/ui/webui/theme_source.h"
23 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
24 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
25 #include "components/google/core/browser/google_util.h" 26 #include "components/google/core/browser/google_util.h"
26 #include "components/pref_registry/pref_registry_syncable.h" 27 #include "components/pref_registry/pref_registry_syncable.h"
27 #include "components/signin/core/browser/account_tracker_service.h" 28 #include "components/signin/core/browser/account_tracker_service.h"
28 #include "components/signin/core/browser/signin_manager.h" 29 #include "components/signin/core/browser/signin_manager.h"
29 #include "components/signin/core/common/profile_management_switches.h" 30 #include "components/signin/core/common/profile_management_switches.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return continue_url; 215 return continue_url;
215 } 216 }
216 217
217 return GURL(); 218 return GURL();
218 } 219 }
219 220
220 GURL GetSigninPartitionURL() { 221 GURL GetSigninPartitionURL() {
221 return GURL("chrome-guest://chrome-signin/?"); 222 return GURL("chrome-guest://chrome-signin/?");
222 } 223 }
223 224
225 GURL GetSigninURLFromBubbleViewMode(Profile* profile,
226 profiles::BubbleViewMode mode) {
227 switch (mode) {
228 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN:
229 return GetPromoURL(signin_metrics::SOURCE_AVATAR_BUBBLE_SIGN_IN,
230 false /* auto_close */,
231 true /* is_constrained */);
232 break;
233 case profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT:
234 return GetPromoURL(signin_metrics::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT,
235 false /* auto_close */,
236 true /* is_constrained */);
237 break;
238 case profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH: {
239 const SigninErrorController* error_controller =
240 SigninErrorControllerFactory::GetForProfile(profile);
241 CHECK(error_controller);
242 DCHECK(error_controller->HasError());
243 return GetReauthURL(profile, error_controller->error_account_id());
244 break;
245 }
246 default:
247 NOTREACHED() << "Called with invalid mode=" << mode;
248 return GURL();
249 }
250 }
251
224 signin_metrics::Source GetSourceForPromoURL(const GURL& url) { 252 signin_metrics::Source GetSourceForPromoURL(const GURL& url) {
225 std::string value; 253 std::string value;
226 if (net::GetValueForKeyInQuery(url, kSignInPromoQueryKeySource, &value)) { 254 if (net::GetValueForKeyInQuery(url, kSignInPromoQueryKeySource, &value)) {
227 int source = 0; 255 int source = 0;
228 if (base::StringToInt(value, &source) && 256 if (base::StringToInt(value, &source) &&
229 source >= signin_metrics::SOURCE_START_PAGE && 257 source >= signin_metrics::SOURCE_START_PAGE &&
230 source < signin_metrics::SOURCE_UNKNOWN) { 258 source < signin_metrics::SOURCE_UNKNOWN) {
231 return static_cast<signin_metrics::Source>(source); 259 return static_cast<signin_metrics::Source>(source);
232 } 260 }
233 } 261 }
(...skipping 27 matching lines...) Expand all
261 289
262 void RegisterProfilePrefs( 290 void RegisterProfilePrefs(
263 user_prefs::PrefRegistrySyncable* registry) { 291 user_prefs::PrefRegistrySyncable* registry) {
264 registry->RegisterIntegerPref(prefs::kSignInPromoStartupCount, 0); 292 registry->RegisterIntegerPref(prefs::kSignInPromoStartupCount, 0);
265 registry->RegisterBooleanPref(prefs::kSignInPromoUserSkipped, false); 293 registry->RegisterBooleanPref(prefs::kSignInPromoUserSkipped, false);
266 registry->RegisterBooleanPref(prefs::kSignInPromoShowOnFirstRunAllowed, true); 294 registry->RegisterBooleanPref(prefs::kSignInPromoShowOnFirstRunAllowed, true);
267 registry->RegisterBooleanPref(prefs::kSignInPromoShowNTPBubble, false); 295 registry->RegisterBooleanPref(prefs::kSignInPromoShowNTPBubble, false);
268 } 296 }
269 297
270 } // namespace signin 298 } // namespace signin
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_promo.h ('k') | chrome/browser/ui/browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698