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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 | 984 |
985 if (!IsValidGaiaSigninRedirectOrResponseURL(url) && | 985 if (!IsValidGaiaSigninRedirectOrResponseURL(url) && |
986 continue_url_.is_valid() && | 986 continue_url_.is_valid() && |
987 url.ReplaceComponents(replacements) != | 987 url.ReplaceComponents(replacements) != |
988 continue_url_.ReplaceComponents(replacements)) { | 988 continue_url_.ReplaceComponents(replacements)) { |
989 if (++untrusted_navigations_since_signin_visit_ > kMaxNavigationsSince) | 989 if (++untrusted_navigations_since_signin_visit_ > kMaxNavigationsSince) |
990 CleanTransientState(); | 990 CleanTransientState(); |
991 } | 991 } |
992 } | 992 } |
993 | 993 |
| 994 void OneClickSigninHelper::DidNavigateMainFrame( |
| 995 const content::LoadCommittedDetails& details, |
| 996 const content::FrameNavigateParams& params) { |
| 997 // If we navigate to a non-sign-in URL, make sure that the renderer process |
| 998 // is no longer considered the trusted sign-in process. |
| 999 if (!SigninManager::IsWebBasedSigninFlowURL(params.url)) { |
| 1000 Profile* profile = |
| 1001 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 1002 SigninManager* manager = profile ? |
| 1003 SigninManagerFactory::GetForProfile(profile) : NULL; |
| 1004 if (manager) |
| 1005 manager->ClearSigninProcess(); |
| 1006 } |
| 1007 } |
| 1008 |
994 void OneClickSigninHelper::DidStopLoading( | 1009 void OneClickSigninHelper::DidStopLoading( |
995 content::RenderViewHost* render_view_host) { | 1010 content::RenderViewHost* render_view_host) { |
996 // If the user left the sign in process, clear all members. | 1011 // If the user left the sign in process, clear all members. |
997 // TODO(rogerta): might need to allow some youtube URLs. | 1012 // TODO(rogerta): might need to allow some youtube URLs. |
998 content::WebContents* contents = web_contents(); | 1013 content::WebContents* contents = web_contents(); |
999 const GURL url = contents->GetURL(); | 1014 const GURL url = contents->GetURL(); |
1000 Profile* profile = | 1015 Profile* profile = |
1001 Profile::FromBrowserContext(contents->GetBrowserContext()); | 1016 Profile::FromBrowserContext(contents->GetBrowserContext()); |
1002 VLOG(1) << "OneClickSigninHelper::DidStopLoading: url=" << url.spec(); | 1017 VLOG(1) << "OneClickSigninHelper::DidStopLoading: url=" << url.spec(); |
1003 | 1018 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 contents->GetController().LoadURL(redirect_url_, | 1258 contents->GetController().LoadURL(redirect_url_, |
1244 content::Referrer(), | 1259 content::Referrer(), |
1245 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 1260 content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
1246 std::string()); | 1261 std::string()); |
1247 } | 1262 } |
1248 | 1263 |
1249 // Clear the redirect URL. | 1264 // Clear the redirect URL. |
1250 redirect_url_ = GURL(); | 1265 redirect_url_ = GURL(); |
1251 sync_service->RemoveObserver(this); | 1266 sync_service->RemoveObserver(this); |
1252 } | 1267 } |
OLD | NEW |