| 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 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/chrome_notification_types.h" | 28 #include "chrome/browser/chrome_notification_types.h" |
| 29 #include "chrome/browser/defaults.h" | 29 #include "chrome/browser/defaults.h" |
| 30 #include "chrome/browser/google/google_util.h" | 30 #include "chrome/browser/google/google_util.h" |
| 31 #include "chrome/browser/history/history_service.h" | 31 #include "chrome/browser/history/history_service.h" |
| 32 #include "chrome/browser/history/history_service_factory.h" | 32 #include "chrome/browser/history/history_service_factory.h" |
| 33 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
| 34 #include "chrome/browser/profiles/profile_info_cache.h" | 34 #include "chrome/browser/profiles/profile_info_cache.h" |
| 35 #include "chrome/browser/profiles/profile_io_data.h" | 35 #include "chrome/browser/profiles/profile_io_data.h" |
| 36 #include "chrome/browser/profiles/profile_manager.h" | 36 #include "chrome/browser/profiles/profile_manager.h" |
| 37 #include "chrome/browser/search/search.h" | 37 #include "chrome/browser/search/search.h" |
| 38 #include "chrome/browser/signin/chrome_signin_manager_delegate.h" | 38 #include "chrome/browser/signin/chrome_signin_client.h" |
| 39 #include "chrome/browser/signin/signin_global_error.h" | 39 #include "chrome/browser/signin/signin_global_error.h" |
| 40 #include "chrome/browser/signin/signin_manager.h" | 40 #include "chrome/browser/signin/signin_manager.h" |
| 41 #include "chrome/browser/signin/signin_manager_factory.h" | 41 #include "chrome/browser/signin/signin_manager_factory.h" |
| 42 #include "chrome/browser/signin/signin_names_io_thread.h" | 42 #include "chrome/browser/signin/signin_names_io_thread.h" |
| 43 #include "chrome/browser/sync/profile_sync_service.h" | 43 #include "chrome/browser/sync/profile_sync_service.h" |
| 44 #include "chrome/browser/sync/profile_sync_service_factory.h" | 44 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 45 #include "chrome/browser/sync/sync_prefs.h" | 45 #include "chrome/browser/sync/sync_prefs.h" |
| 46 #include "chrome/browser/tab_contents/tab_util.h" | 46 #include "chrome/browser/tab_contents/tab_util.h" |
| 47 #include "chrome/browser/ui/browser_finder.h" | 47 #include "chrome/browser/ui/browser_finder.h" |
| 48 #include "chrome/browser/ui/browser_window.h" | 48 #include "chrome/browser/ui/browser_window.h" |
| 49 #include "chrome/browser/ui/chrome_pages.h" | 49 #include "chrome/browser/ui/chrome_pages.h" |
| 50 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" | 50 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" |
| 51 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" | 51 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
| 52 #include "chrome/browser/ui/sync/signin_histogram.h" | 52 #include "chrome/browser/ui/sync/signin_histogram.h" |
| 53 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 53 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
| 54 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | 54 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" |
| 55 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 55 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 56 #include "chrome/common/chrome_version_info.h" | 56 #include "chrome/common/chrome_version_info.h" |
| 57 #include "chrome/common/net/url_util.h" | 57 #include "chrome/common/net/url_util.h" |
| 58 #include "chrome/common/pref_names.h" | 58 #include "chrome/common/pref_names.h" |
| 59 #include "chrome/common/profile_management_switches.h" | 59 #include "chrome/common/profile_management_switches.h" |
| 60 #include "chrome/common/url_constants.h" | 60 #include "chrome/common/url_constants.h" |
| 61 #include "components/autofill/core/common/password_form.h" | 61 #include "components/autofill/core/common/password_form.h" |
| 62 #include "components/password_manager/core/browser/password_manager.h" | 62 #include "components/password_manager/core/browser/password_manager.h" |
| 63 #include "components/signin/core/signin_manager_delegate.h" | 63 #include "components/signin/core/signin_client.h" |
| 64 #include "content/public/browser/browser_thread.h" | 64 #include "content/public/browser/browser_thread.h" |
| 65 #include "content/public/browser/navigation_entry.h" | 65 #include "content/public/browser/navigation_entry.h" |
| 66 #include "content/public/browser/page_navigator.h" | 66 #include "content/public/browser/page_navigator.h" |
| 67 #include "content/public/browser/render_process_host.h" | 67 #include "content/public/browser/render_process_host.h" |
| 68 #include "content/public/browser/web_contents.h" | 68 #include "content/public/browser/web_contents.h" |
| 69 #include "content/public/browser/web_contents_view.h" | 69 #include "content/public/browser/web_contents_view.h" |
| 70 #include "content/public/common/frame_navigate_params.h" | 70 #include "content/public/common/frame_navigate_params.h" |
| 71 #include "content/public/common/page_transition_types.h" | 71 #include "content/public/common/page_transition_types.h" |
| 72 #include "google_apis/gaia/gaia_auth_util.h" | 72 #include "google_apis/gaia/gaia_auth_util.h" |
| 73 #include "google_apis/gaia/gaia_urls.h" | 73 #include "google_apis/gaia/gaia_urls.h" |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 690 |
| 691 SigninManager* manager = | 691 SigninManager* manager = |
| 692 SigninManagerFactory::GetForProfile(profile); | 692 SigninManagerFactory::GetForProfile(profile); |
| 693 if (manager && !manager->IsSigninAllowed()) | 693 if (manager && !manager->IsSigninAllowed()) |
| 694 return false; | 694 return false; |
| 695 | 695 |
| 696 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && | 696 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && |
| 697 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) | 697 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) |
| 698 return false; | 698 return false; |
| 699 | 699 |
| 700 if (!ChromeSigninManagerDelegate::ProfileAllowsSigninCookies(profile)) | 700 if (!ChromeSigninClient::ProfileAllowsSigninCookies(profile)) |
| 701 return false; | 701 return false; |
| 702 | 702 |
| 703 if (!email.empty()) { | 703 if (!email.empty()) { |
| 704 if (!manager) | 704 if (!manager) |
| 705 return false; | 705 return false; |
| 706 | 706 |
| 707 // Make sure this username is not prohibited by policy. | 707 // Make sure this username is not prohibited by policy. |
| 708 if (!manager->IsAllowedUsername(email)) { | 708 if (!manager->IsAllowedUsername(email)) { |
| 709 if (error_message) { | 709 if (error_message) { |
| 710 error_message->assign( | 710 error_message->assign( |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 | 794 |
| 795 if (!SigninManager::IsSigninAllowedOnIOThread(io_data)) | 795 if (!SigninManager::IsSigninAllowedOnIOThread(io_data)) |
| 796 return DONT_OFFER; | 796 return DONT_OFFER; |
| 797 | 797 |
| 798 if (!io_data->reverse_autologin_enabled()->GetValue()) | 798 if (!io_data->reverse_autologin_enabled()->GetValue()) |
| 799 return DONT_OFFER; | 799 return DONT_OFFER; |
| 800 | 800 |
| 801 if (!io_data->google_services_username()->GetValue().empty()) | 801 if (!io_data->google_services_username()->GetValue().empty()) |
| 802 return DONT_OFFER; | 802 return DONT_OFFER; |
| 803 | 803 |
| 804 if (!ChromeSigninManagerDelegate::SettingsAllowSigninCookies( | 804 if (!ChromeSigninClient::SettingsAllowSigninCookies( |
| 805 io_data->GetCookieSettings())) | 805 io_data->GetCookieSettings())) |
| 806 return DONT_OFFER; | 806 return DONT_OFFER; |
| 807 | 807 |
| 808 // The checks below depend on chrome already knowing what account the user | 808 // The checks below depend on chrome already knowing what account the user |
| 809 // signed in with. This happens only after receiving the response containing | 809 // signed in with. This happens only after receiving the response containing |
| 810 // the Google-Accounts-SignIn header. Until then, if there is even a chance | 810 // the Google-Accounts-SignIn header. Until then, if there is even a chance |
| 811 // that we want to connect the profile, chrome needs to tell Gaia that | 811 // that we want to connect the profile, chrome needs to tell Gaia that |
| 812 // it should offer the interstitial. Therefore missing one click data on | 812 // it should offer the interstitial. Therefore missing one click data on |
| 813 // the request means can offer is true. | 813 // the request means can offer is true. |
| 814 const std::string& pending_email = io_data->reverse_autologin_pending_email(); | 814 const std::string& pending_email = io_data->reverse_autologin_pending_email(); |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 // If the web contents is showing a blank page and not about to be closed, | 1541 // If the web contents is showing a blank page and not about to be closed, |
| 1542 // redirect to the NTP or apps page. | 1542 // redirect to the NTP or apps page. |
| 1543 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && | 1543 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && |
| 1544 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { | 1544 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { |
| 1545 RedirectToNtpOrAppsPage( | 1545 RedirectToNtpOrAppsPage( |
| 1546 web_contents(), | 1546 web_contents(), |
| 1547 signin::GetSourceForPromoURL(original_continue_url_)); | 1547 signin::GetSourceForPromoURL(original_continue_url_)); |
| 1548 } | 1548 } |
| 1549 } | 1549 } |
| 1550 } | 1550 } |
| OLD | NEW |