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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 CloseOverlay(); | 865 CloseOverlay(); |
866 return; | 866 return; |
867 } | 867 } |
868 | 868 |
869 // Notify services that we are now active. | 869 // Notify services that we are now active. |
870 GetLoginUIService()->SetLoginUI(this); | 870 GetLoginUIService()->SetLoginUI(this); |
871 service->set_setup_in_progress(true); | 871 service->set_setup_in_progress(true); |
872 | 872 |
873 // There are several different UI flows that can bring the user here: | 873 // There are several different UI flows that can bring the user here: |
874 // 1) Signin promo (passes force_login=true) | 874 // 1) Signin promo (passes force_login=true) |
875 // 2) Normal signin through options page (AreCredentialsAvailable() will | 875 // 2) Normal signin through options page (IsSyncEnabledAndLoggedIn() will |
876 // return false). | 876 // return false). |
877 // 3) Previously working credentials have expired | 877 // 3) Previously working credentials have expired |
878 // (service->GetAuthError() != NONE). | 878 // (service->GetAuthError() != NONE). |
879 // 4) User is already signed in, but App Notifications needs to force another | 879 // 4) User is already signed in, but App Notifications needs to force another |
880 // login so it can fetch an oauth token (passes force_login=true) | 880 // login so it can fetch an oauth token (passes force_login=true) |
881 // 5) User clicks [Advanced Settings] button on options page while already | 881 // 5) User clicks [Advanced Settings] button on options page while already |
882 // logged in. | 882 // logged in. |
883 // 6) One-click signin (credentials are already available, so should display | 883 // 6) One-click signin (credentials are already available, so should display |
884 // sync configure UI, not login UI). | 884 // sync configure UI, not login UI). |
885 // 7) ChromeOS re-enable after disabling sync. | 885 // 7) ChromeOS re-enable after disabling sync. |
886 #if !defined(OS_CHROMEOS) | 886 #if !defined(OS_CHROMEOS) |
887 if (force_login || | 887 if (force_login || |
888 !service->AreCredentialsAvailable() || | 888 !service->IsSyncEnabledAndLoggedIn() || |
889 service->GetAuthError().state() != GoogleServiceAuthError::NONE) { | 889 service->GetAuthError().state() != GoogleServiceAuthError::NONE) { |
890 // User is not logged in, or login has been specially requested - need to | 890 // User is not logged in, or login has been specially requested - need to |
891 // display login UI (cases 1-4). | 891 // display login UI (cases 1-4). |
892 DisplayGaiaLogin(false); | 892 DisplayGaiaLogin(false); |
893 } else { | 893 } else { |
894 // User is already logged in. They must have brought up the config wizard | 894 // User is already logged in. They must have brought up the config wizard |
895 // via the "Advanced..." button or through One-Click signin (cases 5/6). | 895 // via the "Advanced..." button or through One-Click signin (cases 5/6). |
896 DisplayConfigureSync(true, false); | 896 DisplayConfigureSync(true, false); |
897 } | 897 } |
898 #else | 898 #else |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 if (i != current_profile_index && AreUserNamesEqual( | 967 if (i != current_profile_index && AreUserNamesEqual( |
968 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { | 968 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { |
969 *error_message = l10n_util::GetStringUTF16( | 969 *error_message = l10n_util::GetStringUTF16( |
970 IDS_SYNC_USER_NAME_IN_USE_ERROR); | 970 IDS_SYNC_USER_NAME_IN_USE_ERROR); |
971 return false; | 971 return false; |
972 } | 972 } |
973 } | 973 } |
974 | 974 |
975 return true; | 975 return true; |
976 } | 976 } |
OLD | NEW |