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 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 } | 1295 } |
1296 | 1296 |
1297 void SyncSetupHandler::CloseGaiaSigninPage() { | 1297 void SyncSetupHandler::CloseGaiaSigninPage() { |
1298 if (active_gaia_signin_tab_) { | 1298 if (active_gaia_signin_tab_) { |
1299 content::WebContentsObserver::Observe(NULL); | 1299 content::WebContentsObserver::Observe(NULL); |
1300 | 1300 |
1301 // This can be invoked from a webui handler in the GAIA page (for example, | 1301 // This can be invoked from a webui handler in the GAIA page (for example, |
1302 // if the user clicks 'cancel' in the enterprise signin dialog), so | 1302 // if the user clicks 'cancel' in the enterprise signin dialog), so |
1303 // closing this tab in mid-handler can cause crashes. Instead, close it | 1303 // closing this tab in mid-handler can cause crashes. Instead, close it |
1304 // via a task so we know we aren't in the middle of any webui code. | 1304 // via a task so we know we aren't in the middle of any webui code. |
1305 MessageLoop::current()->PostTask( | 1305 base::MessageLoop::current()->PostTask( |
1306 FROM_HERE, | 1306 FROM_HERE, |
1307 base::Bind(&CloseTab, base::Unretained(active_gaia_signin_tab_))); | 1307 base::Bind(&CloseTab, base::Unretained(active_gaia_signin_tab_))); |
1308 | 1308 |
1309 active_gaia_signin_tab_ = NULL; | 1309 active_gaia_signin_tab_ = NULL; |
1310 } | 1310 } |
1311 } | 1311 } |
1312 | 1312 |
1313 bool SyncSetupHandler::IsLoginAuthDataValid(const std::string& username, | 1313 bool SyncSetupHandler::IsLoginAuthDataValid(const std::string& username, |
1314 string16* error_message) { | 1314 string16* error_message) { |
1315 if (username.empty()) | 1315 if (username.empty()) |
(...skipping 23 matching lines...) Expand all Loading... |
1339 if (i != current_profile_index && AreUserNamesEqual( | 1339 if (i != current_profile_index && AreUserNamesEqual( |
1340 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { | 1340 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { |
1341 *error_message = l10n_util::GetStringUTF16( | 1341 *error_message = l10n_util::GetStringUTF16( |
1342 IDS_SYNC_USER_NAME_IN_USE_ERROR); | 1342 IDS_SYNC_USER_NAME_IN_USE_ERROR); |
1343 return false; | 1343 return false; |
1344 } | 1344 } |
1345 } | 1345 } |
1346 | 1346 |
1347 return true; | 1347 return true; |
1348 } | 1348 } |
OLD | NEW |