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 18 matching lines...) Expand all Loading... |
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_client.h" | 38 #include "chrome/browser/signin/chrome_signin_client.h" |
| 39 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
39 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 40 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
40 #include "chrome/browser/signin/signin_manager.h" | 41 #include "chrome/browser/signin/signin_manager.h" |
41 #include "chrome/browser/signin/signin_manager_factory.h" | 42 #include "chrome/browser/signin/signin_manager_factory.h" |
42 #include "chrome/browser/signin/signin_names_io_thread.h" | 43 #include "chrome/browser/signin/signin_names_io_thread.h" |
43 #include "chrome/browser/sync/profile_sync_service.h" | 44 #include "chrome/browser/sync/profile_sync_service.h" |
44 #include "chrome/browser/sync/profile_sync_service_factory.h" | 45 #include "chrome/browser/sync/profile_sync_service_factory.h" |
45 #include "chrome/browser/tab_contents/tab_util.h" | 46 #include "chrome/browser/tab_contents/tab_util.h" |
46 #include "chrome/browser/ui/browser_finder.h" | 47 #include "chrome/browser/ui/browser_finder.h" |
47 #include "chrome/browser/ui/browser_list.h" | 48 #include "chrome/browser/ui/browser_list.h" |
48 #include "chrome/browser/ui/browser_tabstrip.h" | 49 #include "chrome/browser/ui/browser_tabstrip.h" |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 | 1106 |
1106 return; | 1107 return; |
1107 } | 1108 } |
1108 | 1109 |
1109 // Only allow the dedicated signin process to sign the user into | 1110 // Only allow the dedicated signin process to sign the user into |
1110 // Chrome without intervention, because it doesn't load any untrusted | 1111 // Chrome without intervention, because it doesn't load any untrusted |
1111 // pages. If at any point an untrusted page is detected, chrome will | 1112 // pages. If at any point an untrusted page is detected, chrome will |
1112 // show a modal dialog asking the user to confirm. | 1113 // show a modal dialog asking the user to confirm. |
1113 Profile* profile = | 1114 Profile* profile = |
1114 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 1115 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
1115 SigninManager* manager = profile ? | 1116 ChromeSigninClient* signin_client = |
1116 SigninManagerFactory::GetForProfile(profile) : NULL; | 1117 profile ? ChromeSigninClientFactory::GetForProfile(profile) : NULL; |
1117 helper->untrusted_confirmation_required_ |= | 1118 helper->untrusted_confirmation_required_ |= |
1118 (manager && !manager->IsSigninProcess(child_id)); | 1119 (signin_client && !signin_client->IsSigninProcess(child_id)); |
1119 | 1120 |
1120 if (continue_url.is_valid()) { | 1121 if (continue_url.is_valid()) { |
1121 // Set |original_continue_url_| if it is currently empty. |continue_url| | 1122 // Set |original_continue_url_| if it is currently empty. |continue_url| |
1122 // could be modified by gaia pages, thus we need to record the original | 1123 // could be modified by gaia pages, thus we need to record the original |
1123 // continue url to navigate back to the right page when sync setup is | 1124 // continue url to navigate back to the right page when sync setup is |
1124 // complete. | 1125 // complete. |
1125 if (helper->original_continue_url_.is_empty()) | 1126 if (helper->original_continue_url_.is_empty()) |
1126 helper->original_continue_url_ = continue_url; | 1127 helper->original_continue_url_ = continue_url; |
1127 helper->continue_url_ = continue_url; | 1128 helper->continue_url_ = continue_url; |
1128 } | 1129 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 } | 1301 } |
1301 | 1302 |
1302 void OneClickSigninHelper::DidNavigateMainFrame( | 1303 void OneClickSigninHelper::DidNavigateMainFrame( |
1303 const content::LoadCommittedDetails& details, | 1304 const content::LoadCommittedDetails& details, |
1304 const content::FrameNavigateParams& params) { | 1305 const content::FrameNavigateParams& params) { |
1305 if (!SigninManager::IsWebBasedSigninFlowURL(params.url)) { | 1306 if (!SigninManager::IsWebBasedSigninFlowURL(params.url)) { |
1306 // Make sure the renderer process is no longer considered the trusted | 1307 // Make sure the renderer process is no longer considered the trusted |
1307 // sign-in process when a navigation to a non-sign-in URL occurs. | 1308 // sign-in process when a navigation to a non-sign-in URL occurs. |
1308 Profile* profile = | 1309 Profile* profile = |
1309 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 1310 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
1310 SigninManager* manager = profile ? | 1311 ChromeSigninClient* signin_client = |
1311 SigninManagerFactory::GetForProfile(profile) : NULL; | 1312 profile ? ChromeSigninClientFactory::GetForProfile(profile) : NULL; |
1312 int process_id = web_contents()->GetRenderProcessHost()->GetID(); | 1313 int process_id = web_contents()->GetRenderProcessHost()->GetID(); |
1313 if (manager && manager->IsSigninProcess(process_id)) | 1314 if (signin_client && signin_client->IsSigninProcess(process_id)) |
1314 manager->ClearSigninProcess(); | 1315 signin_client->ClearSigninProcess(); |
1315 | 1316 |
1316 // If the navigation to a non-sign-in URL hasn't been triggered by the web | 1317 // If the navigation to a non-sign-in URL hasn't been triggered by the web |
1317 // contents, the sign in flow has been aborted and the state must be | 1318 // contents, the sign in flow has been aborted and the state must be |
1318 // cleaned (crbug.com/269421). | 1319 // cleaned (crbug.com/269421). |
1319 if (!content::PageTransitionIsWebTriggerable(params.transition) && | 1320 if (!content::PageTransitionIsWebTriggerable(params.transition) && |
1320 auto_accept_ != AUTO_ACCEPT_NONE) { | 1321 auto_accept_ != AUTO_ACCEPT_NONE) { |
1321 CleanTransientState(); | 1322 CleanTransientState(); |
1322 } | 1323 } |
1323 } | 1324 } |
1324 } | 1325 } |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 // If the web contents is showing a blank page and not about to be closed, | 1655 // If the web contents is showing a blank page and not about to be closed, |
1655 // redirect to the NTP or apps page. | 1656 // redirect to the NTP or apps page. |
1656 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && | 1657 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && |
1657 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { | 1658 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { |
1658 RedirectToNtpOrAppsPage( | 1659 RedirectToNtpOrAppsPage( |
1659 web_contents(), | 1660 web_contents(), |
1660 signin::GetSourceForPromoURL(original_continue_url_)); | 1661 signin::GetSourceForPromoURL(original_continue_url_)); |
1661 } | 1662 } |
1662 } | 1663 } |
1663 } | 1664 } |
OLD | NEW |