OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_SERVICE_H_ |
6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_SERVICE_H_ | 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 // Registers a new managed user with the server. |name| is the display name of | 45 // Registers a new managed user with the server. |name| is the display name of |
46 // the user. |callback| is called with the result of the registration. | 46 // the user. |callback| is called with the result of the registration. |
47 void Register(const string16& name, const RegistrationCallback& callback); | 47 void Register(const string16& name, const RegistrationCallback& callback); |
48 | 48 |
49 // Convenience method that registers a new managed user with the server and | 49 // Convenience method that registers a new managed user with the server and |
50 // initializes it locally. The callback allows it to be run after a new | 50 // initializes it locally. The callback allows it to be run after a new |
51 // profile has been created: | 51 // profile has been created: |
52 // ProfileManager::CreateMultiProfileAsync( | 52 // ProfileManager::CreateMultiProfileAsync( |
53 // name, icon, | 53 // name, icon, |
54 // managed_user_registration_service->GetRegistrationAndInitCallback(), | 54 // managed_user_registration_service->GetRegistrationAndInitCallback( |
| 55 // callback), |
55 // managed_user); | 56 // managed_user); |
56 ProfileManager::CreateCallback GetRegistrationAndInitCallback(); | 57 ProfileManager::CreateCallback GetRegistrationAndInitCallback( |
| 58 const ProfileManager::CreateCallback& callback); |
57 | 59 |
58 // ProfileKeyedService implementation: | 60 // ProfileKeyedService implementation: |
59 virtual void Shutdown() OVERRIDE; | 61 virtual void Shutdown() OVERRIDE; |
60 | 62 |
61 // SyncableService implementation: | 63 // SyncableService implementation: |
62 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( | 64 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( |
63 syncer::ModelType type, | 65 syncer::ModelType type, |
64 const syncer::SyncDataList& initial_sync_data, | 66 const syncer::SyncDataList& initial_sync_data, |
65 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 67 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
66 scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE; | 68 scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE; |
(...skipping 15 matching lines...) Expand all Loading... |
82 | 84 |
83 // Dispatches the callback if all the conditions have been met. | 85 // Dispatches the callback if all the conditions have been met. |
84 void DispatchCallbackIfReady(); | 86 void DispatchCallbackIfReady(); |
85 | 87 |
86 void CancelPendingRegistration(); | 88 void CancelPendingRegistration(); |
87 | 89 |
88 // Dispatches the callback with the saved token (which may be empty) and the | 90 // Dispatches the callback with the saved token (which may be empty) and the |
89 // given |error|. | 91 // given |error|. |
90 void DispatchCallback(const GoogleServiceAuthError& error); | 92 void DispatchCallback(const GoogleServiceAuthError& error); |
91 | 93 |
92 void OnProfileCreated(Profile* profile, Profile::CreateStatus status); | 94 void OnProfileCreated(const ProfileManager::CreateCallback& callback, |
| 95 Profile* profile, |
| 96 Profile::CreateStatus status); |
93 | 97 |
94 base::WeakPtrFactory<ManagedUserRegistrationService> weak_ptr_factory_; | 98 base::WeakPtrFactory<ManagedUserRegistrationService> weak_ptr_factory_; |
95 PrefService* prefs_; | 99 PrefService* prefs_; |
96 PrefChangeRegistrar pref_change_registrar_; | 100 PrefChangeRegistrar pref_change_registrar_; |
97 | 101 |
98 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; | 102 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; |
99 scoped_ptr<syncer::SyncErrorFactory> error_handler_; | 103 scoped_ptr<syncer::SyncErrorFactory> error_handler_; |
100 | 104 |
101 std::string pending_managed_user_id_; | 105 std::string pending_managed_user_id_; |
102 std::string pending_managed_user_token_; | 106 std::string pending_managed_user_token_; |
103 bool pending_managed_user_acknowledged_; | 107 bool pending_managed_user_acknowledged_; |
104 RegistrationCallback callback_; | 108 RegistrationCallback callback_; |
105 | 109 |
106 DISALLOW_COPY_AND_ASSIGN(ManagedUserRegistrationService); | 110 DISALLOW_COPY_AND_ASSIGN(ManagedUserRegistrationService); |
107 }; | 111 }; |
108 | 112 |
109 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_SERVICE_H_ | 113 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_SERVICE_H_ |
OLD | NEW |