| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 // Per-profile service used to generate PolicyHeaderIOHelper objects, and | 24 // Per-profile service used to generate PolicyHeaderIOHelper objects, and |
| 25 // keep them up-to-date as policy changes. | 25 // keep them up-to-date as policy changes. |
| 26 // TODO(atwilson): Move to components/policy once CloudPolicyStore is moved. | 26 // TODO(atwilson): Move to components/policy once CloudPolicyStore is moved. |
| 27 class POLICY_EXPORT PolicyHeaderService : public CloudPolicyStore::Observer { | 27 class POLICY_EXPORT PolicyHeaderService : public CloudPolicyStore::Observer { |
| 28 public: | 28 public: |
| 29 // |device_policy_store| can be null on platforms that do not support | 29 // |device_policy_store| can be null on platforms that do not support |
| 30 // device policy. Both |user_policy_store| and |device_policy_store| must | 30 // device policy. Both |user_policy_store| and |device_policy_store| must |
| 31 // outlive this object. | 31 // outlive this object. |
| 32 PolicyHeaderService(const std::string& server_url, | 32 PolicyHeaderService(const std::string& server_url, |
| 33 const std::string& verification_key_hash, |
| 33 CloudPolicyStore* user_policy_store, | 34 CloudPolicyStore* user_policy_store, |
| 34 CloudPolicyStore* device_policy_store); | 35 CloudPolicyStore* device_policy_store); |
| 35 virtual ~PolicyHeaderService(); | 36 virtual ~PolicyHeaderService(); |
| 36 | 37 |
| 37 // 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 |
| 38 // add policy headers to outgoing requests. The caller takes ownership of | 39 // add policy headers to outgoing requests. The caller takes ownership of |
| 39 // this object and must ensure it outlives ProfileHeaderService (in practice, | 40 // this object and must ensure it outlives ProfileHeaderService (in practice, |
| 40 // this is called by ProfileIOData, which is shutdown *after* all | 41 // this is called by ProfileIOData, which is shutdown *after* all |
| 41 // ProfileKeyedServices are shutdown). | 42 // ProfileKeyedServices are shutdown). |
| 42 scoped_ptr<PolicyHeaderIOHelper> CreatePolicyHeaderIOHelper( | 43 scoped_ptr<PolicyHeaderIOHelper> CreatePolicyHeaderIOHelper( |
| 43 scoped_refptr<base::SequencedTaskRunner> task_runner); | 44 scoped_refptr<base::SequencedTaskRunner> task_runner); |
| 44 | 45 |
| 45 // Overridden CloudPolicyStore::Observer methods: | 46 // Overridden CloudPolicyStore::Observer methods: |
| 46 virtual void OnStoreLoaded(CloudPolicyStore* store) OVERRIDE; | 47 virtual void OnStoreLoaded(CloudPolicyStore* store) OVERRIDE; |
| 47 virtual void OnStoreError(CloudPolicyStore* store) OVERRIDE; | 48 virtual void OnStoreError(CloudPolicyStore* store) OVERRIDE; |
| 48 | 49 |
| 49 private: | 50 private: |
| 50 // Generate a policy header based on the currently loaded policy. | 51 // Generate a policy header based on the currently loaded policy. |
| 51 std::string CreateHeaderValue(); | 52 std::string CreateHeaderValue(); |
| 52 | 53 |
| 53 // Weak pointer to created PolicyHeaderIOHelper objects. | 54 // Weak pointer to created PolicyHeaderIOHelper objects. |
| 54 std::vector<PolicyHeaderIOHelper*> helpers_; | 55 std::vector<PolicyHeaderIOHelper*> helpers_; |
| 55 | 56 |
| 56 // URL of the policy server. | 57 // URL of the policy server. |
| 57 std::string server_url_; | 58 std::string server_url_; |
| 58 | 59 |
| 60 // Identifier for the verification key this Chrome instance is using. |
| 61 std::string verification_key_hash_; |
| 62 |
| 59 // Weak pointers to User-/Device-level policy stores. | 63 // Weak pointers to User-/Device-level policy stores. |
| 60 CloudPolicyStore* user_policy_store_; | 64 CloudPolicyStore* user_policy_store_; |
| 61 CloudPolicyStore* device_policy_store_; | 65 CloudPolicyStore* device_policy_store_; |
| 62 | 66 |
| 63 DISALLOW_COPY_AND_ASSIGN(PolicyHeaderService); | 67 DISALLOW_COPY_AND_ASSIGN(PolicyHeaderService); |
| 64 }; | 68 }; |
| 65 | 69 |
| 66 } // namespace policy | 70 } // namespace policy |
| 67 | 71 |
| 68 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_HEADER_SERVICE_H_ | 72 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_HEADER_SERVICE_H_ |
| OLD | NEW |