Chromium Code Reviews| OLD | NEW | 
|---|---|
| 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 540 if (!profile) | 540 if (!profile) | 
| 541 return false; | 541 return false; | 
| 542 | 542 | 
| 543 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && | 543 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && | 
| 544 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) | 544 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) | 
| 545 return false; | 545 return false; | 
| 546 | 546 | 
| 547 if (!SigninManager::AreSigninCookiesAllowed(profile)) | 547 if (!SigninManager::AreSigninCookiesAllowed(profile)) | 
| 548 return false; | 548 return false; | 
| 549 | 549 | 
| 550 SigninManager* manager = | |
| 551 SigninManagerFactory::GetForProfile(profile); | |
| 552 if (!manager) | |
| 553 return false; | |
| 554 | |
| 555 if (!manager->IsSigninProcess(web_contents->GetRenderProcessHost())) | |
| 556 return false; | |
| 
 
Roger Tawa OOO till Jul 10th
2013/02/28 18:23:17
This check should only be done if there is a valid
 
 | |
| 557 | |
| 550 if (!email.empty()) { | 558 if (!email.empty()) { | 
| 551 SigninManager* manager = | |
| 552 SigninManagerFactory::GetForProfile(profile); | |
| 553 if (!manager) | |
| 554 return false; | |
| 555 | |
| 556 // If the signin manager already has an authenticated name, then this is a | 559 // 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 | 560 // re-auth scenario. Make sure the email just signed in corresponds to the | 
| 558 // the one sign in manager expects. | 561 // the one sign in manager expects. | 
| 559 std::string current_email = manager->GetAuthenticatedUsername(); | 562 std::string current_email = manager->GetAuthenticatedUsername(); | 
| 560 const bool same_email = gaia::AreEmailsSame(current_email, email); | 563 const bool same_email = gaia::AreEmailsSame(current_email, email); | 
| 561 if (!current_email.empty() && !same_email) { | 564 if (!current_email.empty() && !same_email) { | 
| 562 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", | 565 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", | 
| 563 signin::HISTOGRAM_ACCOUNT_MISSMATCH, | 566 signin::HISTOGRAM_ACCOUNT_MISSMATCH, | 
| 564 signin::HISTOGRAM_MAX); | 567 signin::HISTOGRAM_MAX); | 
| 565 if (error_message) { | 568 if (error_message) { | 
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1203 } | 1206 } | 
| 1204 } | 1207 } | 
| 1205 | 1208 | 
| 1206 RedirectToNTP(true); | 1209 RedirectToNTP(true); | 
| 1207 signin_tracker_.reset(); | 1210 signin_tracker_.reset(); | 
| 1208 } | 1211 } | 
| 1209 | 1212 | 
| 1210 void OneClickSigninHelper::SigninSuccess() { | 1213 void OneClickSigninHelper::SigninSuccess() { | 
| 1211 signin_tracker_.reset(); | 1214 signin_tracker_.reset(); | 
| 1212 } | 1215 } | 
| OLD | NEW |