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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "chromeos/dbus/dbus_method_call_status.h" | 17 #include "chromeos/dbus/dbus_method_call_status.h" |
| 18 #include "chromeos/dbus/session_manager_client.h" |
18 #include "components/policy/core/common/cloud/cloud_policy_validator.h" | 19 #include "components/policy/core/common/cloud/cloud_policy_validator.h" |
19 #include "components/policy/core/common/cloud/user_cloud_policy_store_base.h" | 20 #include "components/policy/core/common/cloud/user_cloud_policy_store_base.h" |
20 #include "components/signin/core/account_id/account_id.h" | 21 #include "components/signin/core/account_id/account_id.h" |
21 | 22 |
| 23 using RetrievePolicyResponseType = |
| 24 chromeos::SessionManagerClient::RetrievePolicyResponseType; |
| 25 |
22 namespace base { | 26 namespace base { |
23 class SequencedTaskRunner; | 27 class SequencedTaskRunner; |
24 } | 28 } |
25 | 29 |
26 namespace chromeos { | 30 namespace chromeos { |
27 class CryptohomeClient; | 31 class CryptohomeClient; |
28 class SessionManagerClient; | |
29 } | 32 } |
30 | 33 |
31 namespace policy { | 34 namespace policy { |
32 | 35 |
33 // Implements a policy store backed by the Chrome OS' session_manager, which | 36 // Implements a policy store backed by the Chrome OS' session_manager, which |
34 // takes care of persisting policy to disk and is accessed via DBus calls | 37 // takes care of persisting policy to disk and is accessed via DBus calls |
35 // through SessionManagerClient. | 38 // through SessionManagerClient. |
36 // TODO(tnagel): Rename class to reflect that it can store Active Directory | 39 // TODO(tnagel): Rename class to reflect that it can store Active Directory |
37 // policy as well. Also think about whether it would make more sense to keep | 40 // policy as well. Also think about whether it would make more sense to keep |
38 // cloud and AD policy stores separate and to extract the common functionality | 41 // cloud and AD policy stores separate and to extract the common functionality |
(...skipping 25 matching lines...) Expand all Loading... |
64 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy); | 67 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy); |
65 | 68 |
66 // Completion handler for policy validation on the Store() path. | 69 // Completion handler for policy validation on the Store() path. |
67 // Starts a store operation if the validation succeeded. | 70 // Starts a store operation if the validation succeeded. |
68 void OnPolicyToStoreValidated(UserCloudPolicyValidator* validator); | 71 void OnPolicyToStoreValidated(UserCloudPolicyValidator* validator); |
69 | 72 |
70 // Called back from SessionManagerClient for policy store operations. | 73 // Called back from SessionManagerClient for policy store operations. |
71 void OnPolicyStored(bool success); | 74 void OnPolicyStored(bool success); |
72 | 75 |
73 // Called back from SessionManagerClient for policy load operations. | 76 // Called back from SessionManagerClient for policy load operations. |
74 void OnPolicyRetrieved(const std::string& policy_blob); | 77 void OnPolicyRetrieved(const std::string& policy_blob, |
| 78 RetrievePolicyResponseType response); |
75 | 79 |
76 // Starts validation of the loaded |policy| before installing it. | 80 // Starts validation of the loaded |policy| before installing it. |
77 void ValidateRetrievedPolicy( | 81 void ValidateRetrievedPolicy( |
78 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy); | 82 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy); |
79 | 83 |
80 // Completion handler for policy validation on the Load() path. Installs the | 84 // Completion handler for policy validation on the Load() path. Installs the |
81 // policy and publishes it if validation succeeded. | 85 // policy and publishes it if validation succeeded. |
82 void OnRetrievedPolicyValidated(UserCloudPolicyValidator* validator); | 86 void OnRetrievedPolicyValidated(UserCloudPolicyValidator* validator); |
83 | 87 |
84 // Invokes |callback| after reloading |policy_key_|. | 88 // Invokes |callback| after reloading |policy_key_|. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 base::FilePath cached_policy_key_path_; | 124 base::FilePath cached_policy_key_path_; |
121 | 125 |
122 base::WeakPtrFactory<UserCloudPolicyStoreChromeOS> weak_factory_; | 126 base::WeakPtrFactory<UserCloudPolicyStoreChromeOS> weak_factory_; |
123 | 127 |
124 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOS); | 128 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOS); |
125 }; | 129 }; |
126 | 130 |
127 } // namespace policy | 131 } // namespace policy |
128 | 132 |
129 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ | 133 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ |
OLD | NEW |