Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: chrome/browser/policy/device_management_policy_provider.h

Issue 6523058: New policy protobuf protocol. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_DEVICE_MANAGEMENT_POLICY_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_PROVIDER_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_PROVIDER_H_ 6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_PROVIDER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "chrome/browser/policy/configuration_policy_provider.h" 15 #include "chrome/browser/policy/configuration_policy_provider.h"
16 #include "chrome/browser/policy/device_management_backend.h" 16 #include "chrome/browser/policy/device_management_backend.h"
17 #include "chrome/browser/policy/device_token_fetcher.h" 17 #include "chrome/browser/policy/device_token_fetcher.h"
18 18
19 class Profile; 19 class Profile;
20 class TokenService; 20 class TokenService;
21 21
22 namespace policy { 22 namespace policy {
23 23
24 class CloudPolicyCache;
24 class DeviceManagementBackend; 25 class DeviceManagementBackend;
25 class DeviceManagementPolicyCache;
26 26
27 // Provides policy fetched from the device management server. With the exception 27 // Provides policy fetched from the device management server. With the exception
28 // of the Provide method, which can be called on the FILE thread, all public 28 // of the Provide method, which can be called on the FILE thread, all public
29 // methods must be called on the UI thread. 29 // methods must be called on the UI thread.
30 class DeviceManagementPolicyProvider 30 class DeviceManagementPolicyProvider
31 : public ConfigurationPolicyProvider, 31 : public ConfigurationPolicyProvider,
32 public DeviceManagementBackend::DevicePolicyResponseDelegate, 32 public DeviceManagementBackend::DevicePolicyResponseDelegate,
33 public DeviceTokenFetcher::Observer { 33 public DeviceTokenFetcher::Observer {
34 public: 34 public:
35 DeviceManagementPolicyProvider(const PolicyDefinitionList* policy_list, 35 DeviceManagementPolicyProvider(const PolicyDefinitionList* policy_list,
36 DeviceManagementBackend* backend, 36 DeviceManagementBackend* backend,
37 Profile* profile); 37 Profile* profile);
38 38
39 virtual ~DeviceManagementPolicyProvider(); 39 virtual ~DeviceManagementPolicyProvider();
40 40
41 // ConfigurationPolicyProvider implementation: 41 // ConfigurationPolicyProvider implementation:
42 virtual bool Provide(ConfigurationPolicyStoreInterface* store); 42 virtual bool Provide(ConfigurationPolicyStoreInterface* store);
43 virtual bool IsInitializationComplete() const; 43 virtual bool IsInitializationComplete() const;
44 44
45 // DevicePolicyResponseDelegate implementation: 45 // DevicePolicyResponseDelegate implementation:
46 virtual void HandlePolicyResponse( 46 virtual void HandlePolicyResponse(
47 const em::DevicePolicyResponse& response); 47 const em::DevicePolicyResponse& response); // deprecated.
48 virtual void HandleCloudPolicyResponse(
49 const em::CloudPolicyResponse& response);
48 virtual void OnError(DeviceManagementBackend::ErrorCode code); 50 virtual void OnError(DeviceManagementBackend::ErrorCode code);
49 51
50 // DeviceTokenFetcher::Observer implementation: 52 // DeviceTokenFetcher::Observer implementation:
51 virtual void OnTokenSuccess(); 53 virtual void OnTokenSuccess();
52 virtual void OnTokenError(); 54 virtual void OnTokenError();
53 virtual void OnNotManaged(); 55 virtual void OnNotManaged();
54 56
55 // Sets the refresh rate at which to re-fetch policy information. 57 // Sets the refresh rate at which to re-fetch policy information.
56 void SetRefreshRate(int64 refresh_rate_milliseconds); 58 void SetRefreshRate(int64 refresh_rate_milliseconds);
57 59
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // backend. 141 // backend.
140 static std::string GetDeviceManagementURL(); 142 static std::string GetDeviceManagementURL();
141 143
142 // Returns the path to the sub-directory in the user data directory 144 // Returns the path to the sub-directory in the user data directory
143 // in which device management persistent state is stored. 145 // in which device management persistent state is stored.
144 static FilePath GetOrCreateDeviceManagementDir( 146 static FilePath GetOrCreateDeviceManagementDir(
145 const FilePath& user_data_dir); 147 const FilePath& user_data_dir);
146 148
147 scoped_ptr<DeviceManagementBackend> backend_; 149 scoped_ptr<DeviceManagementBackend> backend_;
148 Profile* profile_; // weak 150 Profile* profile_; // weak
149 scoped_ptr<DeviceManagementPolicyCache> cache_; 151 scoped_ptr<CloudPolicyCache> cache_;
152 bool fallback_to_old_protocol_;
150 scoped_refptr<DeviceTokenFetcher> token_fetcher_; 153 scoped_refptr<DeviceTokenFetcher> token_fetcher_;
151 DeviceTokenFetcher::ObserverRegistrar registrar_; 154 DeviceTokenFetcher::ObserverRegistrar registrar_;
152 ObserverList<ConfigurationPolicyProvider::Observer, true> observer_list_; 155 ObserverList<ConfigurationPolicyProvider::Observer, true> observer_list_;
153 FilePath storage_dir_; 156 FilePath storage_dir_;
154 ProviderState state_; 157 ProviderState state_;
155 bool initial_fetch_done_; 158 bool initial_fetch_done_;
156 RefreshTask* refresh_task_; 159 RefreshTask* refresh_task_;
157 int64 policy_refresh_rate_ms_; 160 int64 policy_refresh_rate_ms_;
158 int policy_refresh_deviation_factor_percent_; 161 int policy_refresh_deviation_factor_percent_;
159 int64 policy_refresh_deviation_max_ms_; 162 int64 policy_refresh_deviation_max_ms_;
160 int64 policy_refresh_error_delay_ms_; 163 int64 policy_refresh_error_delay_ms_;
161 int64 effective_policy_refresh_error_delay_ms_; 164 int64 effective_policy_refresh_error_delay_ms_;
162 int64 token_fetch_error_delay_ms_; 165 int64 token_fetch_error_delay_ms_;
163 int64 effective_token_fetch_error_delay_ms_; 166 int64 effective_token_fetch_error_delay_ms_;
164 int64 unmanaged_device_refresh_rate_ms_; 167 int64 unmanaged_device_refresh_rate_ms_;
165 168
166 DISALLOW_COPY_AND_ASSIGN(DeviceManagementPolicyProvider); 169 DISALLOW_COPY_AND_ASSIGN(DeviceManagementPolicyProvider);
167 }; 170 };
168 171
169 } // namespace policy 172 } // namespace policy
170 173
171 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_PROVIDER_H_ 174 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698