| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_HEADER_SERVICE_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_HEADER_SERVICE_H_ |
| 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_HEADER_SERVICE_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_HEADER_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // Per-profile service used to generate PolicyHeaderIOHelper objects, and | 25 // Per-profile service used to generate PolicyHeaderIOHelper objects, and |
| 26 // keep them up to date as policy changes. | 26 // keep them up to date as policy changes. |
| 27 // TODO(atwilson): Move to components/policy once CloudPolicyStore is moved. | 27 // TODO(atwilson): Move to components/policy once CloudPolicyStore is moved. |
| 28 class POLICY_EXPORT PolicyHeaderService : public CloudPolicyStore::Observer { | 28 class POLICY_EXPORT PolicyHeaderService : public CloudPolicyStore::Observer { |
| 29 public: | 29 public: |
| 30 // |device_policy_store| can be null on platforms that do not support | 30 // |device_policy_store| can be null on platforms that do not support |
| 31 // device policy. Both |user_policy_store| and |device_policy_store| must | 31 // device policy. Both |user_policy_store| and |device_policy_store| must |
| 32 // outlive this object. | 32 // outlive this object. |
| 33 PolicyHeaderService(const std::string& server_url, | 33 PolicyHeaderService(const std::string& server_url, |
| 34 const std::string& verification_key_hash, | 34 const std::string& verification_key_hash, |
| 35 CloudPolicyStore* user_policy_store, | 35 CloudPolicyStore* user_policy_store); |
| 36 CloudPolicyStore* device_policy_store); | |
| 37 ~PolicyHeaderService() override; | 36 ~PolicyHeaderService() override; |
| 38 | 37 |
| 39 // Creates a PolicyHeaderIOHelper object to be run on the IO thread and | 38 // Creates a PolicyHeaderIOHelper object to be run on the IO thread and |
| 40 // add policy headers to outgoing requests. The caller takes ownership of | 39 // add policy headers to outgoing requests. The caller takes ownership of |
| 41 // this object and must ensure it outlives ProfileHeaderService (in practice, | 40 // this object and must ensure it outlives ProfileHeaderService (in practice, |
| 42 // this is called by ProfileIOData, which is shutdown *after* all | 41 // this is called by ProfileIOData, which is shutdown *after* all |
| 43 // ProfileKeyedServices are shutdown). | 42 // ProfileKeyedServices are shutdown). |
| 44 std::unique_ptr<PolicyHeaderIOHelper> CreatePolicyHeaderIOHelper( | 43 std::unique_ptr<PolicyHeaderIOHelper> CreatePolicyHeaderIOHelper( |
| 45 scoped_refptr<base::SequencedTaskRunner> task_runner); | 44 scoped_refptr<base::SequencedTaskRunner> task_runner); |
| 46 | 45 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 57 | 56 |
| 58 // Weak pointer to created PolicyHeaderIOHelper objects. | 57 // Weak pointer to created PolicyHeaderIOHelper objects. |
| 59 std::vector<PolicyHeaderIOHelper*> helpers_; | 58 std::vector<PolicyHeaderIOHelper*> helpers_; |
| 60 | 59 |
| 61 // URL of the policy server. | 60 // URL of the policy server. |
| 62 std::string server_url_; | 61 std::string server_url_; |
| 63 | 62 |
| 64 // Identifier for the verification key this Chrome instance is using. | 63 // Identifier for the verification key this Chrome instance is using. |
| 65 std::string verification_key_hash_; | 64 std::string verification_key_hash_; |
| 66 | 65 |
| 67 // Weak pointers to User-/Device-level policy stores. | 66 // Weak pointer to the User-level policy store. |
| 68 CloudPolicyStore* user_policy_store_; | 67 CloudPolicyStore* user_policy_store_; |
| 69 CloudPolicyStore* device_policy_store_; | |
| 70 | 68 |
| 71 DISALLOW_COPY_AND_ASSIGN(PolicyHeaderService); | 69 DISALLOW_COPY_AND_ASSIGN(PolicyHeaderService); |
| 72 }; | 70 }; |
| 73 | 71 |
| 74 } // namespace policy | 72 } // namespace policy |
| 75 | 73 |
| 76 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_HEADER_SERVICE_H_ | 74 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_HEADER_SERVICE_H_ |
| OLD | NEW |