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/webui/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/sync_setup_handler.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 | 1194 |
1195 void SyncSetupHandler::DidStopLoading( | 1195 void SyncSetupHandler::DidStopLoading( |
1196 content::RenderViewHost* render_view_host) { | 1196 content::RenderViewHost* render_view_host) { |
1197 DCHECK(active_gaia_signin_tab_); | 1197 DCHECK(active_gaia_signin_tab_); |
1198 | 1198 |
1199 // If the user lands on a page outside of Gaia, assume they have navigated | 1199 // If the user lands on a page outside of Gaia, assume they have navigated |
1200 // away and are no longer thinking about signing in with this tab. Treat | 1200 // away and are no longer thinking about signing in with this tab. Treat |
1201 // this as if the user closed the tab. However, don't actually close the tab | 1201 // this as if the user closed the tab. However, don't actually close the tab |
1202 // since the user is doing something with it. Disconnect and forget about it | 1202 // since the user is doing something with it. Disconnect and forget about it |
1203 // before closing down the sync setup. | 1203 // before closing down the sync setup. |
1204 // Ignore navigations to about:blank since that can happen during sign in. | 1204 // The one exception is the expected continue URL. If the user lands there, |
| 1205 // this means sign in was successful. |
1205 const GURL& url = active_gaia_signin_tab_->GetURL(); | 1206 const GURL& url = active_gaia_signin_tab_->GetURL(); |
1206 if (url != GURL("about:blank") && !gaia::IsGaiaSignonRealm(url.GetOrigin())) { | 1207 const GURL continue_url = |
| 1208 SyncPromoUI::GetNextPageURLForSyncPromoURL( |
| 1209 SyncPromoUI::GetSyncPromoURL(GURL(), |
| 1210 SyncPromoUI::SOURCE_SETTINGS, |
| 1211 false)); |
| 1212 |
| 1213 if (url != continue_url && !gaia::IsGaiaSignonRealm(url.GetOrigin())) { |
1207 content::WebContentsObserver::Observe(NULL); | 1214 content::WebContentsObserver::Observe(NULL); |
1208 active_gaia_signin_tab_ = NULL; | 1215 active_gaia_signin_tab_ = NULL; |
1209 CloseSyncSetup(); | 1216 CloseSyncSetup(); |
1210 } | 1217 } |
1211 } | 1218 } |
1212 | 1219 |
1213 void SyncSetupHandler::WebContentsDestroyed( | 1220 void SyncSetupHandler::WebContentsDestroyed( |
1214 content::WebContents* web_contents) { | 1221 content::WebContents* web_contents) { |
1215 DCHECK(active_gaia_signin_tab_); | 1222 DCHECK(active_gaia_signin_tab_); |
1216 CloseSyncSetup(); | 1223 CloseSyncSetup(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 if (i != current_profile_index && AreUserNamesEqual( | 1295 if (i != current_profile_index && AreUserNamesEqual( |
1289 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { | 1296 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { |
1290 *error_message = l10n_util::GetStringUTF16( | 1297 *error_message = l10n_util::GetStringUTF16( |
1291 IDS_SYNC_USER_NAME_IN_USE_ERROR); | 1298 IDS_SYNC_USER_NAME_IN_USE_ERROR); |
1292 return false; | 1299 return false; |
1293 } | 1300 } |
1294 } | 1301 } |
1295 | 1302 |
1296 return true; | 1303 return true; |
1297 } | 1304 } |
OLD | NEW |