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 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 } | 1350 } |
1351 | 1351 |
1352 void SyncSetupHandler::CloseGaiaSigninPage() { | 1352 void SyncSetupHandler::CloseGaiaSigninPage() { |
1353 if (active_gaia_signin_tab_) { | 1353 if (active_gaia_signin_tab_) { |
1354 content::WebContentsObserver::Observe(NULL); | 1354 content::WebContentsObserver::Observe(NULL); |
1355 | 1355 |
1356 // This can be invoked from a webui handler in the GAIA page (for example, | 1356 // This can be invoked from a webui handler in the GAIA page (for example, |
1357 // if the user clicks 'cancel' in the enterprise signin dialog), so | 1357 // if the user clicks 'cancel' in the enterprise signin dialog), so |
1358 // closing this tab in mid-handler can cause crashes. Instead, close it | 1358 // closing this tab in mid-handler can cause crashes. Instead, close it |
1359 // via a task so we know we aren't in the middle of any webui code. | 1359 // via a task so we know we aren't in the middle of any webui code. |
1360 MessageLoop::current()->PostTask( | 1360 base::MessageLoop::current()->PostTask( |
1361 FROM_HERE, | 1361 FROM_HERE, |
1362 base::Bind(&CloseTab, base::Unretained(active_gaia_signin_tab_))); | 1362 base::Bind(&CloseTab, base::Unretained(active_gaia_signin_tab_))); |
1363 | 1363 |
1364 active_gaia_signin_tab_ = NULL; | 1364 active_gaia_signin_tab_ = NULL; |
1365 } | 1365 } |
1366 } | 1366 } |
1367 #endif | 1367 #endif |
1368 | 1368 |
1369 bool SyncSetupHandler::FocusExistingWizardIfPresent() { | 1369 bool SyncSetupHandler::FocusExistingWizardIfPresent() { |
1370 LoginUIService* service = GetLoginUIService(); | 1370 LoginUIService* service = GetLoginUIService(); |
1371 if (!service->current_login_ui()) | 1371 if (!service->current_login_ui()) |
1372 return false; | 1372 return false; |
1373 service->current_login_ui()->FocusUI(); | 1373 service->current_login_ui()->FocusUI(); |
1374 return true; | 1374 return true; |
1375 } | 1375 } |
1376 | 1376 |
1377 LoginUIService* SyncSetupHandler::GetLoginUIService() const { | 1377 LoginUIService* SyncSetupHandler::GetLoginUIService() const { |
1378 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 1378 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
1379 } | 1379 } |
1380 | 1380 |
1381 void SyncSetupHandler::CloseOverlay() { | 1381 void SyncSetupHandler::CloseOverlay() { |
1382 // Stop a timer to handle timeout in waiting for sync setup. | 1382 // Stop a timer to handle timeout in waiting for sync setup. |
1383 backend_start_timer_.reset(); | 1383 backend_start_timer_.reset(); |
1384 | 1384 |
1385 CloseSyncSetup(); | 1385 CloseSyncSetup(); |
1386 web_ui()->CallJavascriptFunction("OptionsPage.closeOverlay"); | 1386 web_ui()->CallJavascriptFunction("OptionsPage.closeOverlay"); |
1387 } | 1387 } |
OLD | NEW |