Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: chrome/browser/ui/webui/sync_setup_handler.cc

Issue 11411267: Make sure to display an errors that occur during the chrome sign in process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 args.SetBoolean("usePassphrase", service->IsUsingSecondaryPassphrase()); 500 args.SetBoolean("usePassphrase", service->IsUsingSecondaryPassphrase());
501 } 501 }
502 502
503 StringValue page("configure"); 503 StringValue page("configure");
504 web_ui()->CallJavascriptFunction( 504 web_ui()->CallJavascriptFunction(
505 "SyncSetupOverlay.showSyncSetupPage", page, args); 505 "SyncSetupOverlay.showSyncSetupPage", page, args);
506 506
507 if (UseWebBasedSigninFlow()) { 507 if (UseWebBasedSigninFlow()) {
508 // Make sure the tab used for the Gaia sign in does not cover the settings 508 // Make sure the tab used for the Gaia sign in does not cover the settings
509 // tab. 509 // tab.
510 BringTabToFront(web_ui()->GetWebContents()); 510 FocusUI();
511 } 511 }
512 } 512 }
513 513
514 void SyncSetupHandler::ConfigureSyncDone() { 514 void SyncSetupHandler::ConfigureSyncDone() {
515 StringValue page("done"); 515 StringValue page("done");
516 web_ui()->CallJavascriptFunction( 516 web_ui()->CallJavascriptFunction(
517 "SyncSetupOverlay.showSyncSetupPage", page); 517 "SyncSetupOverlay.showSyncSetupPage", page);
518 518
519 // Suppress the sync promo once the user signs into sync. This way the user 519 // Suppress the sync promo once the user signs into sync. This way the user
520 // doesn't see the sync promo even if they sign out of sync later on. 520 // doesn't see the sync promo even if they sign out of sync later on.
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 834
835 // Gaia credentials are valid - update the UI. 835 // Gaia credentials are valid - update the UI.
836 DisplayGaiaSuccessAndSettingUp(); 836 DisplayGaiaSuccessAndSettingUp();
837 } 837 }
838 838
839 void SyncSetupHandler::SigninFailed(const GoogleServiceAuthError& error) { 839 void SyncSetupHandler::SigninFailed(const GoogleServiceAuthError& error) {
840 // Stop a timer to handle timeout in waiting for checking network connection. 840 // Stop a timer to handle timeout in waiting for checking network connection.
841 backend_start_timer_.reset(); 841 backend_start_timer_.reset();
842 842
843 last_signin_error_ = error; 843 last_signin_error_ = error;
844 // Got a failed signin - this is either just a typical auth error, or a 844
845 // sync error (treat sync errors as "fatal errors" - i.e. non-auth errors). 845 // If using web-based sign in flow, don't show the gaia sign in page again
846 // On ChromeOS, this condition can happen when auth token is invalid and 846 // since there is no way to show the user an error message.
847 // cannot start sync backend. 847 if (UseWebBasedSigninFlow()) {
848 if (retry_on_signin_failure_) { 848 CloseSyncSetup();
849 DisplayGaiaLogin(GetSyncService()->HasUnrecoverableError());
850 } else { 849 } else {
851 // TODO(peria): Show error dialog for prompting sign in and out on 850 // Got a failed signin - this is either just a typical auth error, or a
852 // Chrome OS. http://crbug.com/128692 851 // sync error (treat sync errors as "fatal errors" - i.e. non-auth errors).
853 CloseOverlay(); 852 // On ChromeOS, this condition can happen when auth token is invalid and
853 // cannot start sync backend.
854 // If using web-based sign in flow, don't show the gaia sign in page again
855 // since there is no way to show the user an error message.
856 if (retry_on_signin_failure_) {
Evan Stade 2012/12/04 20:42:32 if {} else {if {} else {}} ==> if {} else if {} el
Roger Tawa OOO till Jul 10th 2012/12/04 21:18:36 Done.
857 DisplayGaiaLogin(GetSyncService()->HasUnrecoverableError());
858 } else {
859 // TODO(peria): Show error dialog for prompting sign in and out on
860 // Chrome OS. http://crbug.com/128692
861 CloseOverlay();
862 }
854 } 863 }
855 } 864 }
856 865
857 Profile* SyncSetupHandler::GetProfile() const { 866 Profile* SyncSetupHandler::GetProfile() const {
858 return Profile::FromWebUI(web_ui()); 867 return Profile::FromWebUI(web_ui());
859 } 868 }
860 869
861 ProfileSyncService* SyncSetupHandler::GetSyncService() const { 870 ProfileSyncService* SyncSetupHandler::GetSyncService() const {
862 return ProfileSyncServiceFactory::GetForProfile(GetProfile()); 871 return ProfileSyncServiceFactory::GetForProfile(GetProfile());
863 } 872 }
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 if (i != current_profile_index && AreUserNamesEqual( 1224 if (i != current_profile_index && AreUserNamesEqual(
1216 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { 1225 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) {
1217 *error_message = l10n_util::GetStringUTF16( 1226 *error_message = l10n_util::GetStringUTF16(
1218 IDS_SYNC_USER_NAME_IN_USE_ERROR); 1227 IDS_SYNC_USER_NAME_IN_USE_ERROR);
1219 return false; 1228 return false;
1220 } 1229 }
1221 } 1230 }
1222 1231
1223 return true; 1232 return true;
1224 } 1233 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698