OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_POLICY_CONNECTOR_H_ | 5 #ifndef CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ |
6 #define CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ | 6 #define CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 class CloudPolicySubsystem; | 27 class CloudPolicySubsystem; |
28 class ConfigurationPolicyProvider; | 28 class ConfigurationPolicyProvider; |
29 class UserPolicyTokenCache; | 29 class UserPolicyTokenCache; |
30 | 30 |
31 // Manages the lifecycle of browser-global policy infrastructure, such as the | 31 // Manages the lifecycle of browser-global policy infrastructure, such as the |
32 // platform policy providers, device- and the user-cloud policy infrastructure. | 32 // platform policy providers, device- and the user-cloud policy infrastructure. |
33 // TODO(gfeher,mnissler): Factor out device and user specific methods into their | 33 // TODO(gfeher,mnissler): Factor out device and user specific methods into their |
34 // respective classes. | 34 // respective classes. |
35 class BrowserPolicyConnector : public NotificationObserver { | 35 class BrowserPolicyConnector : public NotificationObserver { |
36 public: | 36 public: |
| 37 // Indicates the type of token passed to SetDeviceCredentials. |
| 38 enum TokenType { |
| 39 TOKEN_TYPE_GAIA, // A gaia service token. |
| 40 TOKEN_TYPE_OAUTH, // An OAuth v2 access token. |
| 41 }; |
| 42 |
37 static BrowserPolicyConnector* Create(); | 43 static BrowserPolicyConnector* Create(); |
38 virtual ~BrowserPolicyConnector(); | 44 virtual ~BrowserPolicyConnector(); |
39 | 45 |
40 ConfigurationPolicyProvider* GetManagedPlatformProvider() const; | 46 ConfigurationPolicyProvider* GetManagedPlatformProvider() const; |
41 ConfigurationPolicyProvider* GetManagedCloudProvider() const; | 47 ConfigurationPolicyProvider* GetManagedCloudProvider() const; |
42 ConfigurationPolicyProvider* GetRecommendedPlatformProvider() const; | 48 ConfigurationPolicyProvider* GetRecommendedPlatformProvider() const; |
43 ConfigurationPolicyProvider* GetRecommendedCloudProvider() const; | 49 ConfigurationPolicyProvider* GetRecommendedCloudProvider() const; |
44 | 50 |
45 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the | 51 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the |
46 // device policy managed by this policy connector, or NULL if no such | 52 // device policy managed by this policy connector, or NULL if no such |
(...skipping 10 matching lines...) Expand all Loading... |
57 // user policy managed by this policy connector, or NULL if no such | 63 // user policy managed by this policy connector, or NULL if no such |
58 // subsystem exists (i.e. when user cloud policy is not active due to | 64 // subsystem exists (i.e. when user cloud policy is not active due to |
59 // unmanaged or not logged in). | 65 // unmanaged or not logged in). |
60 CloudPolicySubsystem* user_cloud_policy_subsystem() { | 66 CloudPolicySubsystem* user_cloud_policy_subsystem() { |
61 return user_cloud_policy_subsystem_.get(); | 67 return user_cloud_policy_subsystem_.get(); |
62 } | 68 } |
63 | 69 |
64 // Used to set the credentials stored in the data store associated | 70 // Used to set the credentials stored in the data store associated |
65 // with this policy connector. | 71 // with this policy connector. |
66 void SetDeviceCredentials(const std::string& owner_email, | 72 void SetDeviceCredentials(const std::string& owner_email, |
67 const std::string& gaia_token); | 73 const std::string& token, |
| 74 TokenType token_type); |
68 | 75 |
69 // Returns true if this device is managed by an enterprise (as opposed to | 76 // Returns true if this device is managed by an enterprise (as opposed to |
70 // a local owner). | 77 // a local owner). |
71 bool IsEnterpriseManaged(); | 78 bool IsEnterpriseManaged(); |
72 | 79 |
73 // Locks the device to an enterprise domain. | 80 // Locks the device to an enterprise domain. |
74 EnterpriseInstallAttributes::LockResult LockDevice(const std::string& user); | 81 EnterpriseInstallAttributes::LockResult LockDevice(const std::string& user); |
75 | 82 |
76 // Returns the enterprise domain if device is managed. | 83 // Returns the enterprise domain if device is managed. |
77 std::string GetEnterpriseDomain(); | 84 std::string GetEnterpriseDomain(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Weak reference to the TokenService we are listening to for user cloud | 164 // Weak reference to the TokenService we are listening to for user cloud |
158 // policy authentication tokens. | 165 // policy authentication tokens. |
159 TokenService* token_service_; | 166 TokenService* token_service_; |
160 | 167 |
161 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); | 168 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); |
162 }; | 169 }; |
163 | 170 |
164 } // namespace policy | 171 } // namespace policy |
165 | 172 |
166 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ | 173 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ |
OLD | NEW |