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

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

Issue 10823208: Reverting this as it causes browser tests on the Linux ChromiumOS builder to fail. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
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_POLICY_USER_CLOUD_POLICY_MANAGER_H_ 5 #ifndef CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_H_
6 #define CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_H_ 6 #define CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/policy/cloud_policy_client.h" 10 #include "chrome/browser/policy/cloud_policy_client.h"
11 #include "chrome/browser/policy/cloud_policy_constants.h" 11 #include "chrome/browser/policy/cloud_policy_constants.h"
12 #include "chrome/browser/policy/cloud_policy_store.h" 12 #include "chrome/browser/policy/cloud_policy_store.h"
13 #include "chrome/browser/policy/configuration_policy_provider.h" 13 #include "chrome/browser/policy/configuration_policy_provider.h"
14 14
15 class PrefService; 15 class PrefService;
16 class Profile;
17 16
18 namespace policy { 17 namespace policy {
19 18
20 class CloudPolicyRefreshScheduler; 19 class CloudPolicyRefreshScheduler;
21 class CloudPolicyService; 20 class CloudPolicyService;
22 class DeviceManagementService; 21 class DeviceManagementService;
23 22
24 // UserCloudPolicyManager keeps track of all things user policy, drives the 23 // UserCloudPolicyManager keeps track of all things user policy, drives the
25 // corresponding cloud policy service and publishes policy through the 24 // corresponding cloud policy service and publishes policy through the
26 // ConfigurationPolicyProvider interface. 25 // ConfigurationPolicyProvider interface.
27 class UserCloudPolicyManager : public ConfigurationPolicyProvider, 26 class UserCloudPolicyManager : public ConfigurationPolicyProvider,
28 public CloudPolicyClient::Observer, 27 public CloudPolicyClient::Observer,
29 public CloudPolicyStore::Observer { 28 public CloudPolicyStore::Observer {
30 public: 29 public:
31 // If |wait_for_policy| fetch is true, IsInitializationComplete() will return 30 // If |wait_for_policy| fetch is true, IsInitializationComplete() will return
32 // false as long as there hasn't been a successful policy fetch. 31 // false as long as there hasn't been a successful policy fetch.
33 UserCloudPolicyManager(scoped_ptr<CloudPolicyStore> store, 32 UserCloudPolicyManager(scoped_ptr<CloudPolicyStore> store,
34 bool wait_for_policy_fetch); 33 bool wait_for_policy_fetch);
35 virtual ~UserCloudPolicyManager(); 34 virtual ~UserCloudPolicyManager();
36 35
37 // Creates a UserCloudPolicyService instance associated with the passed 36 #if defined(OS_CHROMEOS)
38 // |profile|. 37 // Creates a UserCloudPolicyService instance for the Chrome OS platform.
39 static scoped_ptr<UserCloudPolicyManager> Create(Profile* profile, 38 static scoped_ptr<UserCloudPolicyManager> Create(bool wait_for_policy_fetch);
40 bool wait_for_policy_fetch); 39 #endif
41 40
42 // Initializes the cloud connection. |local_prefs| and |service| must stay 41 // Initializes the cloud connection. |prefs| and |service| must stay valid
43 // valid until Shutdown() gets called. Virtual for mocking. 42 // until Shutdown() gets called.
44 virtual void Initialize(PrefService* local_prefs, 43 void Initialize(PrefService* prefs,
45 DeviceManagementService* service, 44 DeviceManagementService* service,
46 UserAffiliation user_affiliation); 45 UserAffiliation user_affiliation);
47 46 void Shutdown();
48 // Virtual for mocks.
49 virtual void Shutdown();
50 47
51 // Cancels waiting for the policy fetch and flags the 48 // Cancels waiting for the policy fetch and flags the
52 // ConfigurationPolicyProvider ready (assuming all other initialization tasks 49 // ConfigurationPolicyProvider ready (assuming all other initialization tasks
53 // have completed). 50 // have completed).
54 void CancelWaitForPolicyFetch(); 51 void CancelWaitForPolicyFetch();
55 52
56 // Returns true if the underlying CloudPolicyClient is already registered.
57 // Virtual for mocking.
58 virtual bool IsClientRegistered() const;
59
60 // Register the CloudPolicyClient using the passed OAuth token.
61 void RegisterClient(const std::string& access_token);
62
63 CloudPolicyService* cloud_policy_service() { return service_.get(); } 53 CloudPolicyService* cloud_policy_service() { return service_.get(); }
64 54
65 // ConfigurationPolicyProvider: 55 // ConfigurationPolicyProvider:
66 virtual bool IsInitializationComplete() const OVERRIDE; 56 virtual bool IsInitializationComplete() const OVERRIDE;
67 virtual void RefreshPolicies() OVERRIDE; 57 virtual void RefreshPolicies() OVERRIDE;
68 58
69 // CloudPolicyClient::Observer: 59 // CloudPolicyClient::Observer:
70 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE; 60 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE;
71 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE; 61 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE;
72 virtual void OnClientError(CloudPolicyClient* client) OVERRIDE; 62 virtual void OnClientError(CloudPolicyClient* client) OVERRIDE;
(...skipping 28 matching lines...) Expand all
101 91
102 // The pref service to pass to the refresh scheduler on initialization. 92 // The pref service to pass to the refresh scheduler on initialization.
103 PrefService* prefs_; 93 PrefService* prefs_;
104 94
105 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManager); 95 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManager);
106 }; 96 };
107 97
108 } // namespace policy 98 } // namespace policy
109 99
110 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_H_ 100 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/config_dir_policy_loader.cc ('k') | chrome/browser/policy/user_cloud_policy_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698