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

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: rebase 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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) 604 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled))
604 return false; 605 return false;
605 606
606 if (!SigninManager::AreSigninCookiesAllowed(profile)) 607 if (!SigninManager::AreSigninCookiesAllowed(profile))
607 return false; 608 return false;
608 609
609 if (!email.empty()) { 610 if (!email.empty()) {
610 if (!manager) 611 if (!manager)
611 return false; 612 return false;
612 613
614 if (!manager->IsSigninProcess(
615 web_contents->GetRenderProcessHost()->GetID())) {
616 // We only allow the dedicated signin process to sign the user into
617 // Chrome without intervention, because it doesn't load any untrusted
618 // pages.
619 return false;
620 }
621
613 // If the signin manager already has an authenticated name, then this is a 622 // If the signin manager already has an authenticated name, then this is a
614 // re-auth scenario. Make sure the email just signed in corresponds to the 623 // re-auth scenario. Make sure the email just signed in corresponds to the
615 // the one sign in manager expects. 624 // the one sign in manager expects.
616 std::string current_email = manager->GetAuthenticatedUsername(); 625 std::string current_email = manager->GetAuthenticatedUsername();
617 const bool same_email = gaia::AreEmailsSame(current_email, email); 626 const bool same_email = gaia::AreEmailsSame(current_email, email);
618 if (!current_email.empty() && !same_email) { 627 if (!current_email.empty() && !same_email) {
619 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", 628 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth",
620 signin::HISTOGRAM_ACCOUNT_MISSMATCH, 629 signin::HISTOGRAM_ACCOUNT_MISSMATCH,
621 signin::HISTOGRAM_MAX); 630 signin::HISTOGRAM_MAX);
622 if (error_message) { 631 if (error_message) {
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 } 1301 }
1293 } 1302 }
1294 1303
1295 RedirectToNTP(true); 1304 RedirectToNTP(true);
1296 signin_tracker_.reset(); 1305 signin_tracker_.reset();
1297 } 1306 }
1298 1307
1299 void OneClickSigninHelper::SigninSuccess() { 1308 void OneClickSigninHelper::SigninSuccess() {
1300 signin_tracker_.reset(); 1309 signin_tracker_.reset();
1301 } 1310 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_manager_unittest.cc ('k') | chrome/browser/ui/sync/one_click_signin_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698