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

Side by Side Diff: chrome/browser/policy/user_cloud_policy_manager_chromeos.cc

Issue 11434053: Add support for public account policy to CloudPolicyClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years 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 #include "chrome/browser/policy/user_cloud_policy_manager_chromeos.h" 5 #include "chrome/browser/policy/user_cloud_policy_manager_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "chrome/browser/policy/cloud_policy_service.h" 9 #include "chrome/browser/policy/cloud_policy_service.h"
10 #include "chrome/browser/policy/policy_types.h" 10 #include "chrome/browser/policy/policy_types.h"
bartfab (slow) 2012/12/03 12:28:40 Nit: No longer needed.
Mattias Nissler (ping if slow) 2012/12/03 13:50:39 Done.
11 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
12 12
13 namespace policy { 13 namespace policy {
14 14
15 UserCloudPolicyManagerChromeOS::UserCloudPolicyManagerChromeOS( 15 UserCloudPolicyManagerChromeOS::UserCloudPolicyManagerChromeOS(
16 scoped_ptr<CloudPolicyStore> store, 16 scoped_ptr<CloudPolicyStore> store,
17 bool wait_for_policy_fetch) 17 bool wait_for_policy_fetch)
18 : CloudPolicyManager(store.get()), 18 : CloudPolicyManager(store.get()),
19 store_(store.Pass()), 19 store_(store.Pass()),
20 wait_for_policy_fetch_(wait_for_policy_fetch) {} 20 wait_for_policy_fetch_(wait_for_policy_fetch) {}
21 21
22 UserCloudPolicyManagerChromeOS::~UserCloudPolicyManagerChromeOS() {} 22 UserCloudPolicyManagerChromeOS::~UserCloudPolicyManagerChromeOS() {}
23 23
24 void UserCloudPolicyManagerChromeOS::Initialize( 24 void UserCloudPolicyManagerChromeOS::Connect(
25 PrefService* local_state, 25 PrefService* local_state,
26 DeviceManagementService* device_management_service, 26 DeviceManagementService* device_management_service,
27 UserAffiliation user_affiliation) { 27 UserAffiliation user_affiliation) {
28 DCHECK(device_management_service); 28 DCHECK(device_management_service);
29 DCHECK(local_state); 29 DCHECK(local_state);
30 local_state_ = local_state; 30 local_state_ = local_state;
31 scoped_ptr<CloudPolicyClient> client( 31 scoped_ptr<CloudPolicyClient> client(
32 new CloudPolicyClient(std::string(), std::string(), user_affiliation, 32 new CloudPolicyClient(std::string(), std::string(), user_affiliation,
33 POLICY_SCOPE_USER, NULL, 33 CloudPolicyClient::POLICY_TYPE_USER, NULL,
34 device_management_service)); 34 device_management_service));
35 InitializeService(client.Pass()); 35 InitializeService(client.Pass());
36 cloud_policy_client()->AddObserver(this); 36 cloud_policy_client()->AddObserver(this);
37 37
38 if (wait_for_policy_fetch_) { 38 if (wait_for_policy_fetch_) {
39 // If we are supposed to wait for a policy fetch, we trigger an explicit 39 // If we are supposed to wait for a policy fetch, we trigger an explicit
40 // policy refresh at startup that allows us to unblock initialization once 40 // policy refresh at startup that allows us to unblock initialization once
41 // done. The refresh scheduler only gets started once that refresh 41 // done. The refresh scheduler only gets started once that refresh
42 // completes. Note that we might have to wait for registration to happen, 42 // completes. Note that we might have to wait for registration to happen,
43 // see OnRegistrationStateChanged() below. 43 // see OnRegistrationStateChanged() below.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 void UserCloudPolicyManagerChromeOS::OnClientError(CloudPolicyClient* client) { 113 void UserCloudPolicyManagerChromeOS::OnClientError(CloudPolicyClient* client) {
114 DCHECK_EQ(cloud_policy_client(), client); 114 DCHECK_EQ(cloud_policy_client(), client);
115 CancelWaitForPolicyFetch(); 115 CancelWaitForPolicyFetch();
116 } 116 }
117 117
118 void UserCloudPolicyManagerChromeOS::OnInitialPolicyFetchComplete() { 118 void UserCloudPolicyManagerChromeOS::OnInitialPolicyFetchComplete() {
119 CancelWaitForPolicyFetch(); 119 CancelWaitForPolicyFetch();
120 } 120 }
121 121
122 } // namespace policy 122 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698