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

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

Issue 12374007: signin: force web signin flow initiated visits to accounts.google.com to their own process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add browser test Created 7 years, 9 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) 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" 48 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
49 #include "chrome/common/chrome_notification_types.h" 49 #include "chrome/common/chrome_notification_types.h"
50 #include "chrome/common/chrome_switches.h" 50 #include "chrome/common/chrome_switches.h"
51 #include "chrome/common/chrome_version_info.h" 51 #include "chrome/common/chrome_version_info.h"
52 #include "chrome/common/net/url_util.h" 52 #include "chrome/common/net/url_util.h"
53 #include "chrome/common/one_click_signin_messages.h" 53 #include "chrome/common/one_click_signin_messages.h"
54 #include "chrome/common/pref_names.h" 54 #include "chrome/common/pref_names.h"
55 #include "chrome/common/url_constants.h" 55 #include "chrome/common/url_constants.h"
56 #include "content/public/browser/browser_thread.h" 56 #include "content/public/browser/browser_thread.h"
57 #include "content/public/browser/page_navigator.h" 57 #include "content/public/browser/page_navigator.h"
58 #include "content/public/browser/render_process_host.h"
58 #include "content/public/browser/web_contents.h" 59 #include "content/public/browser/web_contents.h"
59 #include "content/public/browser/web_contents_view.h" 60 #include "content/public/browser/web_contents_view.h"
60 #include "content/public/common/frame_navigate_params.h" 61 #include "content/public/common/frame_navigate_params.h"
61 #include "content/public/common/page_transition_types.h" 62 #include "content/public/common/page_transition_types.h"
62 #include "content/public/common/password_form.h" 63 #include "content/public/common/password_form.h"
63 #include "google_apis/gaia/gaia_auth_util.h" 64 #include "google_apis/gaia/gaia_auth_util.h"
64 #include "google_apis/gaia/gaia_urls.h" 65 #include "google_apis/gaia/gaia_urls.h"
65 #include "googleurl/src/gurl.h" 66 #include "googleurl/src/gurl.h"
66 #include "grit/chromium_strings.h" 67 #include "grit/chromium_strings.h"
67 #include "grit/generated_resources.h" 68 #include "grit/generated_resources.h"
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 547
547 if (!SigninManager::AreSigninCookiesAllowed(profile)) 548 if (!SigninManager::AreSigninCookiesAllowed(profile))
548 return false; 549 return false;
549 550
550 if (!email.empty()) { 551 if (!email.empty()) {
551 SigninManager* manager = 552 SigninManager* manager =
552 SigninManagerFactory::GetForProfile(profile); 553 SigninManagerFactory::GetForProfile(profile);
553 if (!manager) 554 if (!manager)
554 return false; 555 return false;
555 556
557 if (!manager->IsSigninProcess(
558 web_contents->GetRenderProcessHost()->GetID())) {
Charlie Reis 2013/03/04 19:22:24 nit: 4 more spaces.
tim (not reviewing) 2013/03/04 23:40:19 Done.
559 // We only allow the dedicated signin process to sign the user into
560 // Chrome without intervention, because it doesn't load any untrusted
561 // pages.
562 return false;
563 }
564
556 // If the signin manager already has an authenticated name, then this is a 565 // If the signin manager already has an authenticated name, then this is a
557 // re-auth scenario. Make sure the email just signed in corresponds to the 566 // re-auth scenario. Make sure the email just signed in corresponds to the
558 // the one sign in manager expects. 567 // the one sign in manager expects.
559 std::string current_email = manager->GetAuthenticatedUsername(); 568 std::string current_email = manager->GetAuthenticatedUsername();
560 const bool same_email = gaia::AreEmailsSame(current_email, email); 569 const bool same_email = gaia::AreEmailsSame(current_email, email);
561 if (!current_email.empty() && !same_email) { 570 if (!current_email.empty() && !same_email) {
562 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", 571 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth",
563 signin::HISTOGRAM_ACCOUNT_MISSMATCH, 572 signin::HISTOGRAM_ACCOUNT_MISSMATCH,
564 signin::HISTOGRAM_MAX); 573 signin::HISTOGRAM_MAX);
565 if (error_message) { 574 if (error_message) {
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 } 1212 }
1204 } 1213 }
1205 1214
1206 RedirectToNTP(true); 1215 RedirectToNTP(true);
1207 signin_tracker_.reset(); 1216 signin_tracker_.reset();
1208 } 1217 }
1209 1218
1210 void OneClickSigninHelper::SigninSuccess() { 1219 void OneClickSigninHelper::SigninSuccess() {
1211 signin_tracker_.reset(); 1220 signin_tracker_.reset();
1212 } 1221 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698