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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h

Issue 19733003: Implement cloud policy invalidations using the invalidation service framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
OLDNEW
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_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/policy/cloud/cloud_policy_client.h" 14 #include "chrome/browser/policy/cloud/cloud_policy_client.h"
15 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" 15 #include "chrome/browser/policy/cloud/cloud_policy_constants.h"
16 #include "chrome/browser/policy/cloud/cloud_policy_manager.h" 16 #include "chrome/browser/policy/cloud/cloud_policy_manager.h"
17 #include "chrome/browser/policy/cloud/cloud_policy_service.h" 17 #include "chrome/browser/policy/cloud/cloud_policy_service.h"
18 #include "chrome/browser/policy/cloud/component_cloud_policy_service.h" 18 #include "chrome/browser/policy/cloud/component_cloud_policy_service.h"
19 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 19 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
20 #include "google_apis/gaia/gaia_auth_consumer.h" 20 #include "google_apis/gaia/gaia_auth_consumer.h"
21 21
22 class PrefService; 22 class PrefService;
23 23
24 namespace invalidation {
25 class InvalidationService;
26 }
27
24 namespace net { 28 namespace net {
25 class URLRequestContextGetter; 29 class URLRequestContextGetter;
26 } 30 }
27 31
28 namespace policy { 32 namespace policy {
29 33
30 class DeviceManagementService; 34 class DeviceManagementService;
31 class ResourceCache; 35 class ResourceCache;
32 class PolicyOAuth2TokenFetcher; 36 class PolicyOAuth2TokenFetcher;
33 37
34 // UserCloudPolicyManagerChromeOS implements logic for initializing user policy 38 // UserCloudPolicyManagerChromeOS implements logic for initializing user policy
35 // on Chrome OS. 39 // on Chrome OS.
36 class UserCloudPolicyManagerChromeOS 40 class UserCloudPolicyManagerChromeOS
37 : public CloudPolicyManager, 41 : public CloudPolicyManager,
38 public CloudPolicyClient::Observer, 42 public CloudPolicyClient::Observer,
39 public CloudPolicyService::Observer, 43 public CloudPolicyService::Observer,
40 public ComponentCloudPolicyService::Delegate, 44 public ComponentCloudPolicyService::Delegate,
41 public BrowserContextKeyedService { 45 public BrowserContextKeyedService {
42 public: 46 public:
43 // If |wait_for_policy_fetch| is true, IsInitializationComplete() will return 47 // If |wait_for_policy_fetch| is true, IsInitializationComplete() will return
44 // false as long as there hasn't been a successful policy fetch. 48 // false as long as there hasn't been a successful policy fetch.
45 UserCloudPolicyManagerChromeOS( 49 UserCloudPolicyManagerChromeOS(
46 scoped_ptr<CloudPolicyStore> store, 50 scoped_ptr<CloudPolicyStore> store,
47 scoped_ptr<ResourceCache> resource_cache, 51 scoped_ptr<ResourceCache> resource_cache,
48 bool wait_for_policy_fetch); 52 bool wait_for_policy_fetch,
53 invalidation::InvalidationService* invalidation_service);
49 virtual ~UserCloudPolicyManagerChromeOS(); 54 virtual ~UserCloudPolicyManagerChromeOS();
50 55
51 // Initializes the cloud connection. |local_state| and 56 // Initializes the cloud connection. |local_state| and
52 // |device_management_service| must stay valid until this object is deleted. 57 // |device_management_service| must stay valid until this object is deleted.
53 void Connect(PrefService* local_state, 58 void Connect(PrefService* local_state,
54 DeviceManagementService* device_management_service, 59 DeviceManagementService* device_management_service,
55 scoped_refptr<net::URLRequestContextGetter> request_context, 60 scoped_refptr<net::URLRequestContextGetter> request_context,
56 UserAffiliation user_affiliation); 61 UserAffiliation user_affiliation);
57 62
58 // The OAuth2 login |refresh_token| can be used to obtain a policy OAuth2 63 // The OAuth2 login |refresh_token| can be used to obtain a policy OAuth2
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 scoped_ptr<CloudPolicyStore> store_; 118 scoped_ptr<CloudPolicyStore> store_;
114 119
115 // Handles fetching and storing cloud policy for components. It uses the 120 // Handles fetching and storing cloud policy for components. It uses the
116 // |store_|, so destroy it first. 121 // |store_|, so destroy it first.
117 scoped_ptr<ComponentCloudPolicyService> component_policy_service_; 122 scoped_ptr<ComponentCloudPolicyService> component_policy_service_;
118 123
119 // Whether to wait for a policy fetch to complete before reporting 124 // Whether to wait for a policy fetch to complete before reporting
120 // IsInitializationComplete(). 125 // IsInitializationComplete().
121 bool wait_for_policy_fetch_; 126 bool wait_for_policy_fetch_;
122 127
128 // The invalidation service which provides invalidations to policy objects.
129 invalidation::InvalidationService* invalidation_service_;
130
123 // The pref service to pass to the refresh scheduler on initialization. 131 // The pref service to pass to the refresh scheduler on initialization.
124 PrefService* local_state_; 132 PrefService* local_state_;
125 133
126 // Used to fetch the policy OAuth token, when necessary. This object holds 134 // Used to fetch the policy OAuth token, when necessary. This object holds
127 // a callback with an unretained reference to the manager, when it exists. 135 // a callback with an unretained reference to the manager, when it exists.
128 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; 136 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_;
129 137
130 // The OAuth2 login tokens fetched by the |token_fetcher_|, which can be 138 // The OAuth2 login tokens fetched by the |token_fetcher_|, which can be
131 // retrieved using oauth2_tokens(). 139 // retrieved using oauth2_tokens().
132 GaiaAuthConsumer::ClientOAuthResult oauth2_login_tokens_; 140 GaiaAuthConsumer::ClientOAuthResult oauth2_login_tokens_;
133 141
134 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); 142 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS);
135 }; 143 };
136 144
137 } // namespace policy 145 } // namespace policy
138 146
139 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 147 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698