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

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

Issue 300523003: Fix some problems with new reauth: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 6 years, 7 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
« no previous file with comments | « chrome/browser/signin/signin_promo.h ('k') | chrome/browser/ui/sync/one_click_signin_helper.cc » ('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/first_run/first_run.h" 13 #include "chrome/browser/first_run/first_run.h"
14 #include "chrome/browser/google/google_util.h" 14 #include "chrome/browser/google/google_util.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_info_cache.h" 16 #include "chrome/browser/profiles/profile_info_cache.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/signin/signin_manager_factory.h" 18 #include "chrome/browser/signin/signin_manager_factory.h"
19 #include "chrome/browser/sync/profile_sync_service.h"
20 #include "chrome/browser/sync/profile_sync_service_factory.h"
21 #include "chrome/browser/ui/webui/options/core_options_handler.h" 19 #include "chrome/browser/ui/webui/options/core_options_handler.h"
22 #include "chrome/browser/ui/webui/theme_source.h" 20 #include "chrome/browser/ui/webui/theme_source.h"
23 #include "chrome/common/net/url_util.h" 21 #include "chrome/common/net/url_util.h"
24 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
25 #include "chrome/common/url_constants.h" 23 #include "chrome/common/url_constants.h"
26 #include "components/pref_registry/pref_registry_syncable.h" 24 #include "components/pref_registry/pref_registry_syncable.h"
27 #include "components/signin/core/browser/signin_manager.h" 25 #include "components/signin/core/browser/signin_manager.h"
28 #include "components/signin/core/common/profile_management_switches.h" 26 #include "components/signin/core/common/profile_management_switches.h"
29 #include "content/public/browser/url_data_source.h" 27 #include "content/public/browser/url_data_source.h"
30 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 240 }
243 241
244 GURL GetReauthURL(Profile* profile, const std::string& account_id) { 242 GURL GetReauthURL(Profile* profile, const std::string& account_id) {
245 if (switches::IsEnableWebBasedSignin()) { 243 if (switches::IsEnableWebBasedSignin()) {
246 return net::AppendQueryParameter( 244 return net::AppendQueryParameter(
247 signin::GetPromoURL(signin::SOURCE_SETTINGS, true), 245 signin::GetPromoURL(signin::SOURCE_SETTINGS, true),
248 "Email", 246 "Email",
249 account_id); 247 account_id);
250 } 248 }
251 249
252 const std::string primary_account_id = 250 signin::Source source = switches::IsNewProfileManagement() ?
253 SigninManagerFactory::GetForProfile(profile)-> 251 signin::SOURCE_REAUTH : signin::SOURCE_SETTINGS;
254 GetAuthenticatedAccountId();
255 signin::Source source = account_id == primary_account_id ?
256 signin::SOURCE_SETTINGS : signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT;
257 252
258 GURL url = signin::GetPromoURL(source, true); 253 GURL url = signin::GetPromoURL(
254 source, true /* auto_close */,
255 switches::IsNewProfileManagement() /* is_constrained */);
259 url = net::AppendQueryParameter(url, "email", account_id); 256 url = net::AppendQueryParameter(url, "email", account_id);
260 url = net::AppendQueryParameter(url, "validateEmail", "1"); 257 url = net::AppendQueryParameter(url, "validateEmail", "1");
261 return net::AppendQueryParameter(url, "readOnlyEmail", "1"); 258 return net::AppendQueryParameter(url, "readOnlyEmail", "1");
262 } 259 }
263 260
264 GURL GetNextPageURLForPromoURL(const GURL& url) { 261 GURL GetNextPageURLForPromoURL(const GURL& url) {
265 std::string value; 262 std::string value;
266 if (GetValueForKeyInQuery(url, kSignInPromoQueryKeyContinue, &value)) { 263 if (GetValueForKeyInQuery(url, kSignInPromoQueryKeyContinue, &value)) {
267 GURL continue_url = GURL(value); 264 GURL continue_url = GURL(value);
268 if (continue_url.is_valid()) 265 if (continue_url.is_valid())
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 prefs::kSignInPromoShowOnFirstRunAllowed, 324 prefs::kSignInPromoShowOnFirstRunAllowed,
328 true, 325 true,
329 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 326 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
330 registry->RegisterBooleanPref( 327 registry->RegisterBooleanPref(
331 prefs::kSignInPromoShowNTPBubble, 328 prefs::kSignInPromoShowNTPBubble,
332 false, 329 false,
333 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 330 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
334 } 331 }
335 332
336 } // namespace signin 333 } // namespace signin
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_promo.h ('k') | chrome/browser/ui/sync/one_click_signin_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698