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_CLOUD_POLICY_SUBSYSTEM_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ |
6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/prefs/pref_member.h" | 10 #include "chrome/browser/prefs/pref_member.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 class CloudPolicySubsystem | 33 class CloudPolicySubsystem |
34 : public NotificationObserver, | 34 : public NotificationObserver, |
35 public net::NetworkChangeNotifier::IPAddressObserver { | 35 public net::NetworkChangeNotifier::IPAddressObserver { |
36 public: | 36 public: |
37 enum PolicySubsystemState { | 37 enum PolicySubsystemState { |
38 UNENROLLED, // No enrollment attempt has been performed yet. | 38 UNENROLLED, // No enrollment attempt has been performed yet. |
39 BAD_GAIA_TOKEN, // The server rejected the GAIA auth token. | 39 BAD_GAIA_TOKEN, // The server rejected the GAIA auth token. |
40 UNMANAGED, // This device is unmanaged. | 40 UNMANAGED, // This device is unmanaged. |
41 NETWORK_ERROR, // A network error occurred, retrying makes sense. | 41 NETWORK_ERROR, // A network error occurred, retrying makes sense. |
42 LOCAL_ERROR, // Retrying is futile. | 42 LOCAL_ERROR, // Retrying is futile. |
| 43 TOKEN_FETCHED, // Device has been successfully registered. |
43 SUCCESS // Policy has been fetched successfully and is in effect. | 44 SUCCESS // Policy has been fetched successfully and is in effect. |
44 }; | 45 }; |
45 | 46 |
46 enum ErrorDetails { | 47 enum ErrorDetails { |
47 NO_DETAILS, // No error, so no error details either. | 48 NO_DETAILS, // No error, so no error details either. |
48 DMTOKEN_NETWORK_ERROR, // DeviceTokenFetcher encountered a network error. | 49 DMTOKEN_NETWORK_ERROR, // DeviceTokenFetcher encountered a network error. |
49 POLICY_NETWORK_ERROR, // CloudPolicyController encountered a network error. | 50 POLICY_NETWORK_ERROR, // CloudPolicyController encountered a network error. |
50 BAD_DMTOKEN, // The server rejected the DMToken. | 51 BAD_DMTOKEN, // The server rejected the DMToken. |
51 POLICY_LOCAL_ERROR, // The policy cache encountered a local error. | 52 POLICY_LOCAL_ERROR, // The policy cache encountered a local error. |
52 SIGNATURE_MISMATCH, // The policy cache detected a signature mismatch. | 53 SIGNATURE_MISMATCH, // The policy cache detected a signature mismatch. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 void Shutdown(); | 88 void Shutdown(); |
88 | 89 |
89 // Returns the externally visible state and corresponding error details. | 90 // Returns the externally visible state and corresponding error details. |
90 PolicySubsystemState state(); | 91 PolicySubsystemState state(); |
91 ErrorDetails error_details(); | 92 ErrorDetails error_details(); |
92 | 93 |
93 // Stops all auto-retrying error handling behavior inside the policy | 94 // Stops all auto-retrying error handling behavior inside the policy |
94 // subsystem. | 95 // subsystem. |
95 void StopAutoRetry(); | 96 void StopAutoRetry(); |
96 | 97 |
| 98 // Sets wether the policy fetching should not be started immediately after |
| 99 // token fetch. |
| 100 void StopAfterTokenFetch(bool enabled); |
| 101 |
| 102 // Sends a request to the device management backend to fetch policy if one |
| 103 // isn't already outstanding. |
| 104 void SendPolicyRequest(); |
| 105 |
97 ConfigurationPolicyProvider* GetManagedPolicyProvider(); | 106 ConfigurationPolicyProvider* GetManagedPolicyProvider(); |
98 ConfigurationPolicyProvider* GetRecommendedPolicyProvider(); | 107 ConfigurationPolicyProvider* GetRecommendedPolicyProvider(); |
99 | 108 |
100 // Registers cloud policy related prefs. | 109 // Registers cloud policy related prefs. |
101 static void RegisterPrefs(PrefService* pref_service); | 110 static void RegisterPrefs(PrefService* pref_service); |
102 | 111 |
103 private: | 112 private: |
104 // Updates the policy controller with a new refresh rate value. | 113 // Updates the policy controller with a new refresh rate value. |
105 void UpdatePolicyRefreshRate(); | 114 void UpdatePolicyRefreshRate(); |
106 | 115 |
(...skipping 19 matching lines...) Expand all Loading... |
126 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_; | 135 scoped_ptr<DeviceTokenFetcher> device_token_fetcher_; |
127 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_; | 136 scoped_ptr<CloudPolicyCacheBase> cloud_policy_cache_; |
128 scoped_ptr<CloudPolicyController> cloud_policy_controller_; | 137 scoped_ptr<CloudPolicyController> cloud_policy_controller_; |
129 | 138 |
130 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem); | 139 DISALLOW_COPY_AND_ASSIGN(CloudPolicySubsystem); |
131 }; | 140 }; |
132 | 141 |
133 } // namespace policy | 142 } // namespace policy |
134 | 143 |
135 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ | 144 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_SUBSYSTEM_H_ |
OLD | NEW |