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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 "preferences", | 88 "preferences", |
89 "passwords", | 89 "passwords", |
90 "autofill", | 90 "autofill", |
91 "themes", | 91 "themes", |
92 "typedUrls", | 92 "typedUrls", |
93 "extensions", | 93 "extensions", |
94 "apps", | 94 "apps", |
95 "tabs" | 95 "tabs" |
96 }; | 96 }; |
97 | 97 |
98 COMPILE_ASSERT(29 == syncer::MODEL_TYPE_COUNT, | 98 COMPILE_ASSERT(30 == syncer::MODEL_TYPE_COUNT, |
99 update_kDataTypeNames_to_match_UserSelectableTypes); | 99 update_kDataTypeNames_to_match_UserSelectableTypes); |
100 | 100 |
101 typedef std::map<syncer::ModelType, const char*> ModelTypeNameMap; | 101 typedef std::map<syncer::ModelType, const char*> ModelTypeNameMap; |
102 | 102 |
103 ModelTypeNameMap GetSelectableTypeNameMap() { | 103 ModelTypeNameMap GetSelectableTypeNameMap() { |
104 ModelTypeNameMap type_names; | 104 ModelTypeNameMap type_names; |
105 syncer::ModelTypeSet type_set = syncer::UserSelectableTypes(); | 105 syncer::ModelTypeSet type_set = syncer::UserSelectableTypes(); |
106 syncer::ModelTypeSet::Iterator it = type_set.First(); | 106 syncer::ModelTypeSet::Iterator it = type_set.First(); |
107 DCHECK_EQ(arraysize(kDataTypeNames), type_set.Size()); | 107 DCHECK_EQ(arraysize(kDataTypeNames), type_set.Size()); |
108 for (size_t i = 0; i < arraysize(kDataTypeNames) && it.Good(); | 108 for (size_t i = 0; i < arraysize(kDataTypeNames) && it.Good(); |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 // If a setup wizard is present on this page or another, bring it to focus. | 744 // If a setup wizard is present on this page or another, bring it to focus. |
745 // Otherwise, display a new one on this page. | 745 // Otherwise, display a new one on this page. |
746 if (!FocusExistingWizardIfPresent()) | 746 if (!FocusExistingWizardIfPresent()) |
747 OpenSyncSetup(); | 747 OpenSyncSetup(); |
748 } | 748 } |
749 | 749 |
750 #if defined(OS_CHROMEOS) | 750 #if defined(OS_CHROMEOS) |
751 // On ChromeOS, we need to sign out the user session to fix an auth error, so | 751 // On ChromeOS, we need to sign out the user session to fix an auth error, so |
752 // the user goes through the real signin flow to generate a new auth token. | 752 // the user goes through the real signin flow to generate a new auth token. |
753 void SyncSetupHandler::HandleDoSignOutOnAuthError(const ListValue* args) { | 753 void SyncSetupHandler::HandleDoSignOutOnAuthError(const ListValue* args) { |
754 DLOG(INFO) << "Signing out the user to fix a sync error."; | 754 DLOG(WARNING) << "Signing out the user to fix a sync error."; |
755 chrome::AttemptUserExit(); | 755 chrome::AttemptUserExit(); |
756 } | 756 } |
757 #endif | 757 #endif |
758 | 758 |
759 #if !defined(OS_CHROMEOS) | 759 #if !defined(OS_CHROMEOS) |
760 void SyncSetupHandler::HandleStartSignin(const ListValue* args) { | 760 void SyncSetupHandler::HandleStartSignin(const ListValue* args) { |
761 // Should only be called if the user is not already signed in. | 761 // Should only be called if the user is not already signed in. |
762 DCHECK(SigninManagerFactory::GetForProfile(GetProfile())-> | 762 DCHECK(SigninManagerFactory::GetForProfile(GetProfile())-> |
763 GetAuthenticatedUsername().empty()); | 763 GetAuthenticatedUsername().empty()); |
764 OpenSyncSetup(); | 764 OpenSyncSetup(); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 | 901 |
902 LoginUIService* service = GetLoginUIService(); | 902 LoginUIService* service = GetLoginUIService(); |
903 DCHECK(service); | 903 DCHECK(service); |
904 service->current_login_ui()->FocusUI(); | 904 service->current_login_ui()->FocusUI(); |
905 return true; | 905 return true; |
906 } | 906 } |
907 | 907 |
908 LoginUIService* SyncSetupHandler::GetLoginUIService() const { | 908 LoginUIService* SyncSetupHandler::GetLoginUIService() const { |
909 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 909 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
910 } | 910 } |
OLD | NEW |