Chromium Code Reviews| 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_UTILITY_H_ | 5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_UTILITY_H_ |
| 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_UTILITY_H_ | 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_UTILITY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/prefs/pref_change_registrar.h" | 14 #include "base/prefs/pref_change_registrar.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
|
Adrian Kuegel
2013/08/06 13:15:39
Do we still need this include?
Bernhard Bauer
2013/08/06 14:25:24
No, removed.
| |
| 17 #include "chrome/browser/managed_mode/managed_user_sync_service.h" | 17 #include "chrome/browser/managed_mode/managed_user_sync_service.h" |
| 18 #include "chrome/browser/managed_mode/managed_user_sync_service_observer.h" | 18 #include "chrome/browser/managed_mode/managed_user_sync_service_observer.h" |
| 19 #include "chrome/browser/managed_mode/managed_users.h" | 19 #include "chrome/browser/managed_mode/managed_users.h" |
| 20 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" | 21 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" |
| 22 | 22 |
| 23 class GoogleServiceAuthError; | 23 class GoogleServiceAuthError; |
| 24 class ManagedUserRefreshTokenFetcher; | 24 class ManagedUserRefreshTokenFetcher; |
| 25 class ManagedUserRegistrationUtilityTest; | 25 class ManagedUserRegistrationUtilityTest; |
| 26 class PrefService; | 26 class PrefService; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 // unique ID for the new managed user. If its value is the same as that of | 61 // unique ID for the new managed user. If its value is the same as that of |
| 62 // of one of the existing managed users, then the same user will be created | 62 // of one of the existing managed users, then the same user will be created |
| 63 // on this machine. |info| contains necessary information like the display | 63 // on this machine. |info| contains necessary information like the display |
| 64 // name of the the user. |callback| is called with the result of the | 64 // name of the the user. |callback| is called with the result of the |
| 65 // registration. We use the info here and not the profile, because on | 65 // registration. We use the info here and not the profile, because on |
| 66 // Chrome OS the profile of the managed user does not yet exist. | 66 // Chrome OS the profile of the managed user does not yet exist. |
| 67 void Register(const std::string& managed_user_id, | 67 void Register(const std::string& managed_user_id, |
| 68 const ManagedUserRegistrationInfo& info, | 68 const ManagedUserRegistrationInfo& info, |
| 69 const RegistrationCallback& callback); | 69 const RegistrationCallback& callback); |
| 70 | 70 |
| 71 void StartRegistrationTimer(); | |
| 72 | |
| 73 // ManagedUserSyncServiceObserver: | 71 // ManagedUserSyncServiceObserver: |
| 74 virtual void OnManagedUserAcknowledged(const std::string& managed_user_id) | 72 virtual void OnManagedUserAcknowledged(const std::string& managed_user_id) |
| 75 OVERRIDE; | 73 OVERRIDE; |
| 76 virtual void OnManagedUsersSyncingStopped() OVERRIDE; | 74 virtual void OnManagedUsersSyncingStopped() OVERRIDE; |
| 77 | 75 |
| 78 private: | 76 private: |
| 79 FRIEND_TEST_ALL_PREFIXES(ManagedUserRegistrationUtilityTest, Register); | 77 FRIEND_TEST_ALL_PREFIXES(ManagedUserRegistrationUtilityTest, Register); |
| 80 FRIEND_TEST_ALL_PREFIXES(ManagedUserRegistrationUtilityTest, | 78 FRIEND_TEST_ALL_PREFIXES(ManagedUserRegistrationUtilityTest, |
| 81 RegisterBeforeInitialSync); | 79 RegisterBeforeInitialSync); |
| 82 FRIEND_TEST_ALL_PREFIXES(ManagedUserRegistrationUtilityTest, | 80 FRIEND_TEST_ALL_PREFIXES(ManagedUserRegistrationUtilityTest, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 // callback or reporting an error. | 113 // callback or reporting an error. |
| 116 void CancelPendingRegistration(); | 114 void CancelPendingRegistration(); |
| 117 | 115 |
| 118 base::WeakPtrFactory<ManagedUserRegistrationUtility> weak_ptr_factory_; | 116 base::WeakPtrFactory<ManagedUserRegistrationUtility> weak_ptr_factory_; |
| 119 PrefService* prefs_; | 117 PrefService* prefs_; |
| 120 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher_; | 118 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher_; |
| 121 | 119 |
| 122 // A |BrowserContextKeyedService| owned by the custodian profile. | 120 // A |BrowserContextKeyedService| owned by the custodian profile. |
| 123 ManagedUserSyncService* managed_user_sync_service_; | 121 ManagedUserSyncService* managed_user_sync_service_; |
| 124 | 122 |
| 125 // Provides a timeout during profile creation. | |
| 126 base::OneShotTimer<ManagedUserRegistrationUtility> registration_timer_; | |
| 127 | |
| 128 std::string pending_managed_user_id_; | 123 std::string pending_managed_user_id_; |
| 129 std::string pending_managed_user_token_; | 124 std::string pending_managed_user_token_; |
| 130 bool pending_managed_user_acknowledged_; | 125 bool pending_managed_user_acknowledged_; |
| 131 bool is_existing_managed_user_; | 126 bool is_existing_managed_user_; |
| 132 RegistrationCallback callback_; | 127 RegistrationCallback callback_; |
| 133 | 128 |
| 134 DISALLOW_COPY_AND_ASSIGN(ManagedUserRegistrationUtility); | 129 DISALLOW_COPY_AND_ASSIGN(ManagedUserRegistrationUtility); |
| 135 }; | 130 }; |
| 136 | 131 |
| 137 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_UTILITY_H_ | 132 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_UTILITY_H_ |
| OLD | NEW |