| 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 |
| 22 namespace base { | 23 namespace base { |
| 23 class SequencedTaskRunner; | 24 class SequencedTaskRunner; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace chromeos { | 27 namespace chromeos { |
| 27 class CryptohomeClient; | 28 class CryptohomeClient; |
| 28 class SessionManagerClient; | |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace policy { | 31 namespace policy { |
| 32 | 32 |
| 33 // Implements a policy store backed by the Chrome OS' session_manager, which | 33 // 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 | 34 // takes care of persisting policy to disk and is accessed via DBus calls |
| 35 // through SessionManagerClient. | 35 // through SessionManagerClient. |
| 36 // TODO(tnagel): Rename class to reflect that it can store Active Directory | 36 // 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 | 37 // 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 | 38 // 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); | 64 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy); |
| 65 | 65 |
| 66 // Completion handler for policy validation on the Store() path. | 66 // Completion handler for policy validation on the Store() path. |
| 67 // Starts a store operation if the validation succeeded. | 67 // Starts a store operation if the validation succeeded. |
| 68 void OnPolicyToStoreValidated(UserCloudPolicyValidator* validator); | 68 void OnPolicyToStoreValidated(UserCloudPolicyValidator* validator); |
| 69 | 69 |
| 70 // Called back from SessionManagerClient for policy store operations. | 70 // Called back from SessionManagerClient for policy store operations. |
| 71 void OnPolicyStored(bool success); | 71 void OnPolicyStored(bool success); |
| 72 | 72 |
| 73 // Called back from SessionManagerClient for policy load operations. | 73 // Called back from SessionManagerClient for policy load operations. |
| 74 void OnPolicyRetrieved(const std::string& policy_blob); | 74 void OnPolicyRetrieved( |
| 75 const std::string& policy_blob, |
| 76 chromeos::SessionManagerClient::RetrievePolicyResponseType response); |
| 75 | 77 |
| 76 // Starts validation of the loaded |policy| before installing it. | 78 // Starts validation of the loaded |policy| before installing it. |
| 77 void ValidateRetrievedPolicy( | 79 void ValidateRetrievedPolicy( |
| 78 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy); | 80 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy); |
| 79 | 81 |
| 80 // Completion handler for policy validation on the Load() path. Installs the | 82 // Completion handler for policy validation on the Load() path. Installs the |
| 81 // policy and publishes it if validation succeeded. | 83 // policy and publishes it if validation succeeded. |
| 82 void OnRetrievedPolicyValidated(UserCloudPolicyValidator* validator); | 84 void OnRetrievedPolicyValidated(UserCloudPolicyValidator* validator); |
| 83 | 85 |
| 84 // Invokes |callback| after reloading |policy_key_|. | 86 // 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_; | 122 base::FilePath cached_policy_key_path_; |
| 121 | 123 |
| 122 base::WeakPtrFactory<UserCloudPolicyStoreChromeOS> weak_factory_; | 124 base::WeakPtrFactory<UserCloudPolicyStoreChromeOS> weak_factory_; |
| 123 | 125 |
| 124 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOS); | 126 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOS); |
| 125 }; | 127 }; |
| 126 | 128 |
| 127 } // namespace policy | 129 } // namespace policy |
| 128 | 130 |
| 129 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ | 131 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ |
| OLD | NEW |