| 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 25 matching lines...) Expand all Loading... |
| 36 #include "chrome/browser/sync/profile_sync_service.h" | 36 #include "chrome/browser/sync/profile_sync_service.h" |
| 37 #include "chrome/browser/sync/profile_sync_service_factory.h" | 37 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 38 #include "chrome/browser/sync/sync_prefs.h" | 38 #include "chrome/browser/sync/sync_prefs.h" |
| 39 #include "chrome/browser/tab_contents/tab_util.h" | 39 #include "chrome/browser/tab_contents/tab_util.h" |
| 40 #include "chrome/browser/ui/browser_finder.h" | 40 #include "chrome/browser/ui/browser_finder.h" |
| 41 #include "chrome/browser/ui/browser_window.h" | 41 #include "chrome/browser/ui/browser_window.h" |
| 42 #include "chrome/browser/ui/chrome_pages.h" | 42 #include "chrome/browser/ui/chrome_pages.h" |
| 43 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" | 43 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" |
| 44 #include "chrome/browser/ui/sync/one_click_signin_infobar_delegate.h" | 44 #include "chrome/browser/ui/sync/one_click_signin_infobar_delegate.h" |
| 45 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" | 45 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
| 46 #include "chrome/browser/ui/sync/signin_histogram.h" |
| 46 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 47 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
| 47 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | 48 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" |
| 48 #include "chrome/common/chrome_notification_types.h" | 49 #include "chrome/common/chrome_notification_types.h" |
| 49 #include "chrome/common/chrome_switches.h" | 50 #include "chrome/common/chrome_switches.h" |
| 50 #include "chrome/common/chrome_version_info.h" | 51 #include "chrome/common/chrome_version_info.h" |
| 51 #include "chrome/common/net/url_util.h" | 52 #include "chrome/common/net/url_util.h" |
| 52 #include "chrome/common/one_click_signin_messages.h" | 53 #include "chrome/common/one_click_signin_messages.h" |
| 53 #include "chrome/common/pref_names.h" | 54 #include "chrome/common/pref_names.h" |
| 54 #include "chrome/common/url_constants.h" | 55 #include "chrome/common/url_constants.h" |
| 55 #include "content/public/browser/browser_thread.h" | 56 #include "content/public/browser/browser_thread.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 SigninManagerFactory::GetForProfile(profile); | 552 SigninManagerFactory::GetForProfile(profile); |
| 552 if (!manager) | 553 if (!manager) |
| 553 return false; | 554 return false; |
| 554 | 555 |
| 555 // If the signin manager already has an authenticated name, then this is a | 556 // If the signin manager already has an authenticated name, then this is a |
| 556 // re-auth scenario. Make sure the email just signed in corresponds to the | 557 // re-auth scenario. Make sure the email just signed in corresponds to the |
| 557 // the one sign in manager expects. | 558 // the one sign in manager expects. |
| 558 std::string current_email = manager->GetAuthenticatedUsername(); | 559 std::string current_email = manager->GetAuthenticatedUsername(); |
| 559 const bool same_email = gaia::AreEmailsSame(current_email, email); | 560 const bool same_email = gaia::AreEmailsSame(current_email, email); |
| 560 if (!current_email.empty() && !same_email) { | 561 if (!current_email.empty() && !same_email) { |
| 562 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", |
| 563 signin::HISTOGRAM_ACCOUNT_MISSMATCH, |
| 564 signin::HISTOGRAM_MAX); |
| 561 if (error_message) { | 565 if (error_message) { |
| 562 error_message->assign( | 566 error_message->assign( |
| 563 l10n_util::GetStringFUTF8(IDS_SYNC_WRONG_EMAIL, | 567 l10n_util::GetStringFUTF8(IDS_SYNC_WRONG_EMAIL, |
| 564 UTF8ToUTF16(current_email))); | 568 UTF8ToUTF16(current_email))); |
| 565 } | 569 } |
| 566 return false; | 570 return false; |
| 567 } | 571 } |
| 568 | 572 |
| 569 // Make sure this username is not prohibited by policy. | 573 // Make sure this username is not prohibited by policy. |
| 570 if (!manager->IsAllowedUsername(email)) { | 574 if (!manager->IsAllowedUsername(email)) { |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 } | 1200 } |
| 1197 } | 1201 } |
| 1198 | 1202 |
| 1199 RedirectToNTP(true); | 1203 RedirectToNTP(true); |
| 1200 signin_tracker_.reset(); | 1204 signin_tracker_.reset(); |
| 1201 } | 1205 } |
| 1202 | 1206 |
| 1203 void OneClickSigninHelper::SigninSuccess() { | 1207 void OneClickSigninHelper::SigninSuccess() { |
| 1204 signin_tracker_.reset(); | 1208 signin_tracker_.reset(); |
| 1205 } | 1209 } |
| OLD | NEW |