OLD | NEW |
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_store.h" | 5 #include "chrome/browser/policy/user_cloud_policy_store.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/policy/proto/cloud_policy.pb.h" | 8 #include "chrome/browser/policy/proto/cloud_policy.pb.h" |
9 #include "chrome/browser/signin/signin_manager.h" | 9 #include "chrome/browser/signin/signin_manager.h" |
10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 UserCloudPolicyStore::~UserCloudPolicyStore() { | 21 UserCloudPolicyStore::~UserCloudPolicyStore() { |
22 } | 22 } |
23 | 23 |
24 void UserCloudPolicyStore::Load() { | 24 void UserCloudPolicyStore::Load() { |
25 // TODO(atwilson): Read policy from file. | 25 // TODO(atwilson): Read policy from file. |
26 policy_.reset(); | 26 policy_.reset(); |
27 policy_map_.Clear(); | 27 policy_map_.Clear(); |
28 NotifyStoreLoaded(); | 28 NotifyStoreLoaded(); |
29 } | 29 } |
30 | 30 |
| 31 void UserCloudPolicyStore::RemoveStoredPolicy() { |
| 32 // TODO(atwilson): Remove policy from disk. |
| 33 } |
| 34 |
31 void UserCloudPolicyStore::Store( | 35 void UserCloudPolicyStore::Store( |
32 const enterprise_management::PolicyFetchResponse& policy) { | 36 const enterprise_management::PolicyFetchResponse& policy) { |
33 // Stop any pending requests to store policy, then validate the new policy | 37 // Stop any pending requests to store policy, then validate the new policy |
34 // before storing it. | 38 // before storing it. |
35 weak_factory_.InvalidateWeakPtrs(); | 39 weak_factory_.InvalidateWeakPtrs(); |
36 scoped_ptr<enterprise_management::PolicyFetchResponse> policy_copy( | 40 scoped_ptr<enterprise_management::PolicyFetchResponse> policy_copy( |
37 new enterprise_management::PolicyFetchResponse(policy)); | 41 new enterprise_management::PolicyFetchResponse(policy)); |
38 Validate(policy_copy.Pass(), | 42 Validate(policy_copy.Pass(), |
39 base::Bind(&UserCloudPolicyStore::StorePolicyAfterValidation, | 43 base::Bind(&UserCloudPolicyStore::StorePolicyAfterValidation, |
40 weak_factory_.GetWeakPtr())); | 44 weak_factory_.GetWeakPtr())); |
(...skipping 29 matching lines...) Expand all Loading... |
70 NotifyStoreLoaded(); | 74 NotifyStoreLoaded(); |
71 } | 75 } |
72 | 76 |
73 // static | 77 // static |
74 scoped_ptr<CloudPolicyStore> CloudPolicyStore::CreateUserPolicyStore( | 78 scoped_ptr<CloudPolicyStore> CloudPolicyStore::CreateUserPolicyStore( |
75 Profile* profile) { | 79 Profile* profile) { |
76 return scoped_ptr<CloudPolicyStore>(new UserCloudPolicyStore(profile)); | 80 return scoped_ptr<CloudPolicyStore>(new UserCloudPolicyStore(profile)); |
77 } | 81 } |
78 | 82 |
79 } // namespace policy | 83 } // namespace policy |
OLD | NEW |