| 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/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/prefs/pref_change_registrar.h" | 15 #include "base/prefs/pref_change_registrar.h" |
| 16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 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 "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 20 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
| 21 | 21 |
| 22 class GoogleServiceAuthError; | 22 class GoogleServiceAuthError; |
| 23 class ManagedUserRefreshTokenFetcher; | 23 class ManagedUserRefreshTokenFetcher; |
| 24 class ManagedUserRegistrationUtilityTest; | 24 class ManagedUserRegistrationUtilityTest; |
| 25 class ManagedUserSharedSettingsService; |
| 25 class PrefService; | 26 class PrefService; |
| 26 class Profile; | 27 class Profile; |
| 27 | 28 |
| 28 namespace browser_sync { | 29 namespace browser_sync { |
| 29 class DeviceInfo; | 30 class DeviceInfo; |
| 30 } | 31 } |
| 31 | 32 |
| 32 // Structure to store registration information. | 33 // Structure to store registration information. |
| 33 struct ManagedUserRegistrationInfo { | 34 struct ManagedUserRegistrationInfo { |
| 34 ManagedUserRegistrationInfo(const base::string16& name, int avatar_index); | 35 ManagedUserRegistrationInfo(const base::string16& name, int avatar_index); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 ManagedUserRegistrationUtility() {} | 76 ManagedUserRegistrationUtility() {} |
| 76 | 77 |
| 77 private: | 78 private: |
| 78 friend class ScopedTestingManagedUserRegistrationUtility; | 79 friend class ScopedTestingManagedUserRegistrationUtility; |
| 79 friend class ManagedUserRegistrationUtilityTest; | 80 friend class ManagedUserRegistrationUtilityTest; |
| 80 | 81 |
| 81 // Creates implementation with explicit dependencies, can be used for testing. | 82 // Creates implementation with explicit dependencies, can be used for testing. |
| 82 static ManagedUserRegistrationUtility* CreateImpl( | 83 static ManagedUserRegistrationUtility* CreateImpl( |
| 83 PrefService* prefs, | 84 PrefService* prefs, |
| 84 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher, | 85 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher, |
| 85 ManagedUserSyncService* service); | 86 ManagedUserSyncService* service, |
| 87 ManagedUserSharedSettingsService* shared_settings_service); |
| 86 | 88 |
| 87 // Set the instance of ManagedUserRegistrationUtility that will be returned | 89 // Set the instance of ManagedUserRegistrationUtility that will be returned |
| 88 // by next Create() call. Takes ownership of the |utility|. | 90 // by next Create() call. Takes ownership of the |utility|. |
| 89 static void SetUtilityForTests(ManagedUserRegistrationUtility* utility); | 91 static void SetUtilityForTests(ManagedUserRegistrationUtility* utility); |
| 90 }; | 92 }; |
| 91 | 93 |
| 92 // Class that sets the instance of ManagedUserRegistrationUtility that will be | 94 // Class that sets the instance of ManagedUserRegistrationUtility that will be |
| 93 // returned by next Create() call, and correctly destroys it if Create() was | 95 // returned by next Create() call, and correctly destroys it if Create() was |
| 94 // not called. | 96 // not called. |
| 95 class ScopedTestingManagedUserRegistrationUtility { | 97 class ScopedTestingManagedUserRegistrationUtility { |
| 96 public: | 98 public: |
| 97 // Delegates ownership of the |instance| to ManagedUserRegistrationUtility. | 99 // Delegates ownership of the |instance| to ManagedUserRegistrationUtility. |
| 98 ScopedTestingManagedUserRegistrationUtility( | 100 ScopedTestingManagedUserRegistrationUtility( |
| 99 ManagedUserRegistrationUtility* instance); | 101 ManagedUserRegistrationUtility* instance); |
| 100 | 102 |
| 101 ~ScopedTestingManagedUserRegistrationUtility(); | 103 ~ScopedTestingManagedUserRegistrationUtility(); |
| 102 }; | 104 }; |
| 103 | 105 |
| 104 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_UTILITY_H_ | 106 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_REGISTRATION_UTILITY_H_ |
| OLD | NEW |