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

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

Issue 12189011: Split up chrome/browser/policy subdirectory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, add chrome/browser/chromeos/policy/OWNERS Created 7 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/policy/user_cloud_policy_manager.h"
6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "chrome/browser/policy/cloud_policy_constants.h"
10 #include "chrome/browser/policy/cloud_policy_service.h"
11 #include "chrome/browser/policy/policy_types.h"
12 #include "chrome/browser/policy/user_cloud_policy_manager_factory.h"
13 #include "chrome/browser/policy/user_cloud_policy_store.h"
14 #include "chrome/common/pref_names.h"
15
16 namespace em = enterprise_management;
17
18 namespace policy {
19
20 UserCloudPolicyManager::UserCloudPolicyManager(
21 Profile* profile,
22 scoped_ptr<UserCloudPolicyStore> store)
23 : CloudPolicyManager(
24 PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType, std::string()),
25 store.get()),
26 profile_(profile),
27 store_(store.Pass()) {
28 UserCloudPolicyManagerFactory::GetInstance()->Register(profile_, this);
29 }
30
31 UserCloudPolicyManager::~UserCloudPolicyManager() {
32 UserCloudPolicyManagerFactory::GetInstance()->Unregister(profile_, this);
33 }
34
35 void UserCloudPolicyManager::Connect(
36 PrefService* local_state, scoped_ptr<CloudPolicyClient> client) {
37 core()->Connect(client.Pass());
38 core()->StartRefreshScheduler();
39 core()->TrackRefreshDelayPref(local_state, prefs::kUserPolicyRefreshRate);
40 }
41
42 // static
43 scoped_ptr<CloudPolicyClient>
44 UserCloudPolicyManager::CreateCloudPolicyClient(
45 DeviceManagementService* device_management_service) {
46 return make_scoped_ptr(
47 new CloudPolicyClient(std::string(), std::string(),
48 USER_AFFILIATION_NONE,
49 NULL, device_management_service)).Pass();
50 }
51
52 void UserCloudPolicyManager::DisconnectAndRemovePolicy() {
53 core()->Disconnect();
54 store_->Clear();
55 }
56
57 bool UserCloudPolicyManager::IsClientRegistered() const {
58 return client() && client()->is_registered();
59 }
60
61 void UserCloudPolicyManager::RegisterClient(const std::string& access_token) {
62 DCHECK(client()) << "Callers must invoke Initialize() first";
63 if (!client()->is_registered()) {
64 DVLOG(1) << "Registering client with access token: " << access_token;
65 client()->Register(em::DeviceRegisterRequest::BROWSER,
66 access_token, std::string(), false);
67 }
68 }
69
70 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/user_cloud_policy_manager.h ('k') | chrome/browser/policy/user_cloud_policy_manager_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698