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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_helper.cc

Issue 17482002: Display confirmation dialog for untrusted signins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/sync/one_click_signin_helper.h" 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 223
224 // Start syncing with the given user information. 224 // Start syncing with the given user information.
225 void StartSync(const StartSyncArgs& args, 225 void StartSync(const StartSyncArgs& args,
226 OneClickSigninSyncStarter::StartSyncMode start_mode) { 226 OneClickSigninSyncStarter::StartSyncMode start_mode) {
227 if (start_mode == OneClickSigninSyncStarter::UNDO_SYNC) { 227 if (start_mode == OneClickSigninSyncStarter::UNDO_SYNC) {
228 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_UNDO); 228 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_UNDO);
229 return; 229 return;
230 } 230 }
231 231
232 // If we are giving the user the option to configure sync, then that will
233 // suffice as a confirmation.
234 OneClickSigninSyncStarter::ConfirmationRequired confirmation = 232 OneClickSigninSyncStarter::ConfirmationRequired confirmation =
235 args.confirmation_required; 233 args.confirmation_required;
Roger Tawa OOO till Jul 10th 2013/06/20 07:51:29 Can probably get rid of this local var too. Its n
noms (inactive) 2013/06/21 16:59:24 Done.
236 if (start_mode == OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST &&
237 confirmation == OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN) {
238 confirmation = OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN;
239 }
240 234
241 // The starter deletes itself once its done. 235 // The starter deletes itself once its done.
242 new OneClickSigninSyncStarter(args.profile, args.browser, args.session_index, 236 new OneClickSigninSyncStarter(args.profile, args.browser, args.session_index,
243 args.email, args.password, start_mode, 237 args.email, args.password, start_mode,
244 args.force_same_tab_navigation, 238 args.force_same_tab_navigation,
245 confirmation); 239 confirmation);
246 240
247 int action = one_click_signin::HISTOGRAM_MAX; 241 int action = one_click_signin::HISTOGRAM_MAX;
248 switch (args.auto_accept) { 242 switch (args.auto_accept) {
249 case OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT: 243 case OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT:
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 SyncPromoUI::GetNextPageURLForSyncPromoURL( 981 SyncPromoUI::GetNextPageURLForSyncPromoURL(
988 SyncPromoUI::GetSyncPromoURL(SyncPromoUI::SOURCE_START_PAGE, 982 SyncPromoUI::GetSyncPromoURL(SyncPromoUI::SOURCE_START_PAGE,
989 false)); 983 false));
990 GURL::Replacements replacements; 984 GURL::Replacements replacements;
991 replacements.ClearQuery(); 985 replacements.ClearQuery();
992 986
993 if (!IsValidGaiaSigninRedirectOrResponseURL(url) && 987 if (!IsValidGaiaSigninRedirectOrResponseURL(url) &&
994 continue_url_.is_valid() && 988 continue_url_.is_valid() &&
995 url.ReplaceComponents(replacements) != 989 url.ReplaceComponents(replacements) !=
996 continue_url_.ReplaceComponents(replacements)) { 990 continue_url_.ReplaceComponents(replacements)) {
991 untrusted_confirmation_required_ = true;
Roger Tawa OOO till Jul 10th 2013/06/20 07:51:29 I don't think this change and the one at line 1063
noms (inactive) 2013/06/21 16:59:24 As discussed, removed this change. On 2013/06/20 0
997 if (++untrusted_navigations_since_signin_visit_ > kMaxNavigationsSince) 992 if (++untrusted_navigations_since_signin_visit_ > kMaxNavigationsSince)
998 CleanTransientState(); 993 CleanTransientState();
999 } 994 }
1000 } 995 }
1001 996
1002 void OneClickSigninHelper::DidStopLoading( 997 void OneClickSigninHelper::DidStopLoading(
1003 content::RenderViewHost* render_view_host) { 998 content::RenderViewHost* render_view_host) {
1004 // If the user left the sign in process, clear all members. 999 // If the user left the sign in process, clear all members.
1005 // TODO(rogerta): might need to allow some youtube URLs. 1000 // TODO(rogerta): might need to allow some youtube URLs.
1006 content::WebContents* contents = web_contents(); 1001 content::WebContents* contents = web_contents();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 if (email_.empty()) { 1052 if (email_.empty()) {
1058 VLOG(1) << "OneClickSigninHelper::DidStopLoading: nothing to do"; 1053 VLOG(1) << "OneClickSigninHelper::DidStopLoading: nothing to do";
1059 if (continue_url_match && auto_accept_ == AUTO_ACCEPT_EXPLICIT) 1054 if (continue_url_match && auto_accept_ == AUTO_ACCEPT_EXPLICIT)
1060 RedirectToSignin(); 1055 RedirectToSignin();
1061 std::string unused_value; 1056 std::string unused_value;
1062 if (net::GetValueForKeyInQuery(url, "ntp", &unused_value)) { 1057 if (net::GetValueForKeyInQuery(url, "ntp", &unused_value)) {
1063 SyncPromoUI::SetUserSkippedSyncPromo(profile); 1058 SyncPromoUI::SetUserSkippedSyncPromo(profile);
1064 RedirectToNtpOrAppsPage(web_contents(), source_); 1059 RedirectToNtpOrAppsPage(web_contents(), source_);
1065 } 1060 }
1066 1061
1067 if (!continue_url_match && !IsValidGaiaSigninRedirectOrResponseURL(url) && 1062 if (!continue_url_match && !IsValidGaiaSigninRedirectOrResponseURL(url)) {
1068 ++untrusted_navigations_since_signin_visit_ > kMaxNavigationsSince) { 1063 untrusted_confirmation_required_ = true;
1069 CleanTransientState(); 1064 if (++untrusted_navigations_since_signin_visit_ > kMaxNavigationsSince)
1065 CleanTransientState();
1070 } 1066 }
1071 1067
1072 return; 1068 return;
1073 } 1069 }
1074 1070
1075 // When the user uses the first-run, ntp, or hotdog menu to sign in, then have 1071 // When the user uses the first-run, ntp, or hotdog menu to sign in, then have
1076 // the option of checking the the box "Let me choose what to sync". When the 1072 // the option of checking the the box "Let me choose what to sync". When the
1077 // sign in process started, the source parameter in the continue URL may have 1073 // sign in process started, the source parameter in the continue URL may have
1078 // indicated one of the three options above. However, once this box is 1074 // indicated one of the three options above. However, once this box is
1079 // checked, the source parameter will indicate settings. This will only be 1075 // checked, the source parameter will indicate settings. This will only be
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 break; 1144 break;
1149 case AUTO_ACCEPT_CONFIGURE: 1145 case AUTO_ACCEPT_CONFIGURE:
1150 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_ACCEPTED); 1146 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_ACCEPTED);
1151 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_WITH_ADVANCED); 1147 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_WITH_ADVANCED);
1152 SigninManager::DisableOneClickSignIn(profile); 1148 SigninManager::DisableOneClickSignIn(profile);
1153 // Don't bother displaying an extra confirmation (even in the SAML case) 1149 // Don't bother displaying an extra confirmation (even in the SAML case)
1154 // since the user will get prompted to setup sync anyway. 1150 // since the user will get prompted to setup sync anyway.
1155 StartSync( 1151 StartSync(
1156 StartSyncArgs(profile, browser, auto_accept_, session_index_, email_, 1152 StartSyncArgs(profile, browser, auto_accept_, session_index_, email_,
1157 password_, false /* force_same_tab_navigation */, 1153 password_, false /* force_same_tab_navigation */,
1158 false /* confirmation_required */, source_), 1154 false /* confirmation_required */, source_),
Roger Tawa OOO till Jul 10th 2013/06/20 07:51:29 I think we should change this false to a true as w
1159 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); 1155 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST);
1160 break; 1156 break;
1161 case AUTO_ACCEPT_EXPLICIT: { 1157 case AUTO_ACCEPT_EXPLICIT: {
1162 if (switched_to_advanced_) { 1158 if (switched_to_advanced_) {
1163 LogHistogramValue(original_source_, 1159 LogHistogramValue(original_source_,
1164 one_click_signin::HISTOGRAM_WITH_ADVANCED); 1160 one_click_signin::HISTOGRAM_WITH_ADVANCED);
1165 LogHistogramValue(original_source_, 1161 LogHistogramValue(original_source_,
1166 one_click_signin::HISTOGRAM_ACCEPTED); 1162 one_click_signin::HISTOGRAM_ACCEPTED);
1167 } else { 1163 } else {
1168 LogHistogramValue(source_, one_click_signin::HISTOGRAM_ACCEPTED); 1164 LogHistogramValue(source_, one_click_signin::HISTOGRAM_ACCEPTED);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 contents->GetController().LoadURL(redirect_url_, 1247 contents->GetController().LoadURL(redirect_url_,
1252 content::Referrer(), 1248 content::Referrer(),
1253 content::PAGE_TRANSITION_AUTO_TOPLEVEL, 1249 content::PAGE_TRANSITION_AUTO_TOPLEVEL,
1254 std::string()); 1250 std::string());
1255 } 1251 }
1256 1252
1257 // Clear the redirect URL. 1253 // Clear the redirect URL.
1258 redirect_url_ = GURL(); 1254 redirect_url_ = GURL();
1259 sync_service->RemoveObserver(this); 1255 sync_service->RemoveObserver(this);
1260 } 1256 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698