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 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_H_ |
6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 // | 33 // |
34 // At signin time, this class initializes the UCPM and loads policy before any | 34 // At signin time, this class initializes the UCPM and loads policy before any |
35 // other signed in services are initialized. After each restart, this class | 35 // other signed in services are initialized. After each restart, this class |
36 // ensures that the CloudPolicyClient is registered (in case the policy server | 36 // ensures that the CloudPolicyClient is registered (in case the policy server |
37 // was offline during the initial policy fetch) and if not it initiates a fresh | 37 // was offline during the initial policy fetch) and if not it initiates a fresh |
38 // registration process. | 38 // registration process. |
39 // | 39 // |
40 // Finally, if the user signs out, this class is responsible for shutting down | 40 // Finally, if the user signs out, this class is responsible for shutting down |
41 // the policy infrastructure to ensure that any cached policy is cleared. | 41 // the policy infrastructure to ensure that any cached policy is cleared. |
42 class UserPolicySigninService | 42 class UserPolicySigninService |
43 : public ProfileKeyedService, | 43 : public BrowserContextKeyedService, |
44 public CloudPolicyClient::Observer, | 44 public CloudPolicyClient::Observer, |
45 public CloudPolicyService::Observer, | 45 public CloudPolicyService::Observer, |
46 public content::NotificationObserver { | 46 public content::NotificationObserver { |
47 public: | 47 public: |
48 // The callback invoked once policy registration is complete. Passed | 48 // The callback invoked once policy registration is complete. Passed |
49 // CloudPolicyClient parameter is null if DMToken fetch failed. | 49 // CloudPolicyClient parameter is null if DMToken fetch failed. |
50 typedef base::Callback<void(scoped_ptr<CloudPolicyClient>)> | 50 typedef base::Callback<void(scoped_ptr<CloudPolicyClient>)> |
51 PolicyRegistrationCallback; | 51 PolicyRegistrationCallback; |
52 | 52 |
53 // The callback invoked once policy fetch is complete. Passed boolean | 53 // The callback invoked once policy fetch is complete. Passed boolean |
(...skipping 25 matching lines...) Expand all Loading... |
79 const content::NotificationDetails& details) OVERRIDE; | 79 const content::NotificationDetails& details) OVERRIDE; |
80 | 80 |
81 // CloudPolicyService::Observer implementation. | 81 // CloudPolicyService::Observer implementation. |
82 virtual void OnInitializationCompleted(CloudPolicyService* service) OVERRIDE; | 82 virtual void OnInitializationCompleted(CloudPolicyService* service) OVERRIDE; |
83 | 83 |
84 // CloudPolicyClient::Observer implementation. | 84 // CloudPolicyClient::Observer implementation. |
85 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE; | 85 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE; |
86 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE; | 86 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE; |
87 virtual void OnClientError(CloudPolicyClient* client) OVERRIDE; | 87 virtual void OnClientError(CloudPolicyClient* client) OVERRIDE; |
88 | 88 |
89 // ProfileKeyedService implementation: | 89 // BrowserContextKeyedService implementation: |
90 virtual void Shutdown() OVERRIDE; | 90 virtual void Shutdown() OVERRIDE; |
91 | 91 |
92 private: | 92 private: |
93 // Returns false if cloud policy is disabled or if the passed |email_address| | 93 // Returns false if cloud policy is disabled or if the passed |email_address| |
94 // is definitely not from a hosted domain (according to the blacklist in | 94 // is definitely not from a hosted domain (according to the blacklist in |
95 // BrowserPolicyConnector::IsNonEnterpriseUser()). | 95 // BrowserPolicyConnector::IsNonEnterpriseUser()). |
96 bool ShouldLoadPolicyForUser(const std::string& email_address); | 96 bool ShouldLoadPolicyForUser(const std::string& email_address); |
97 | 97 |
98 // Initializes the UserCloudPolicyManager using the passed CloudPolicyClient. | 98 // Initializes the UserCloudPolicyManager using the passed CloudPolicyClient. |
99 void InitializeUserCloudPolicyManager(scoped_ptr<CloudPolicyClient> client); | 99 void InitializeUserCloudPolicyManager(scoped_ptr<CloudPolicyClient> client); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 scoped_ptr<CloudPolicyClientRegistrationHelper> registration_helper_; | 139 scoped_ptr<CloudPolicyClientRegistrationHelper> registration_helper_; |
140 | 140 |
141 base::WeakPtrFactory<UserPolicySigninService> weak_factory_; | 141 base::WeakPtrFactory<UserPolicySigninService> weak_factory_; |
142 | 142 |
143 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService); | 143 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService); |
144 }; | 144 }; |
145 | 145 |
146 } // namespace policy | 146 } // namespace policy |
147 | 147 |
148 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_H_ | 148 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_H_ |
OLD | NEW |