| 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 CHROME_BROWSER_CHROMEOS_POLICY_CLOUD_EXTERNAL_DATA_MANAGER_BASE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_CLOUD_EXTERNAL_DATA_MANAGER_BASE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_CLOUD_EXTERNAL_DATA_MANAGER_BASE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_CLOUD_EXTERNAL_DATA_MANAGER_BASE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/threading/non_thread_safe.h" | 13 #include "base/sequence_checker.h" |
| 14 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" | 14 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" |
| 15 #include "components/policy/core/common/policy_details.h" | 15 #include "components/policy/core/common/policy_details.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class SequencedTaskRunner; | 18 class SequencedTaskRunner; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace policy { | 21 namespace policy { |
| 22 | 22 |
| 23 class CloudExternalDataStore; | 23 class CloudExternalDataStore; |
| 24 class ExternalPolicyDataFetcherBackend; | 24 class ExternalPolicyDataFetcherBackend; |
| 25 | 25 |
| 26 // Downloads, verifies, caches and retrieves external data referenced by | 26 // Downloads, verifies, caches and retrieves external data referenced by |
| 27 // policies. | 27 // policies. |
| 28 // This is a common base class used by specializations for regular users and | 28 // This is a common base class used by specializations for regular users and |
| 29 // device-local accounts. | 29 // device-local accounts. |
| 30 class CloudExternalDataManagerBase : public CloudExternalDataManager, | 30 class CloudExternalDataManagerBase : public CloudExternalDataManager { |
| 31 public base::NonThreadSafe { | |
| 32 public: | 31 public: |
| 33 // |get_policy_details| is used to determine the maximum size that the | 32 // |get_policy_details| is used to determine the maximum size that the |
| 34 // data referenced by each policy can have. Download scheduling, verification, | 33 // data referenced by each policy can have. Download scheduling, verification, |
| 35 // caching and retrieval tasks are done via the |backend_task_runner|, which | 34 // caching and retrieval tasks are done via the |backend_task_runner|, which |
| 36 // must support file I/O. Network I/O is done via the |io_task_runner|. | 35 // must support file I/O. Network I/O is done via the |io_task_runner|. |
| 37 CloudExternalDataManagerBase( | 36 CloudExternalDataManagerBase( |
| 38 const GetChromePolicyDetailsCallback& get_policy_details, | 37 const GetChromePolicyDetailsCallback& get_policy_details, |
| 39 scoped_refptr<base::SequencedTaskRunner> backend_task_runner, | 38 scoped_refptr<base::SequencedTaskRunner> backend_task_runner, |
| 40 scoped_refptr<base::SequencedTaskRunner> io_task_runner); | 39 scoped_refptr<base::SequencedTaskRunner> io_task_runner); |
| 41 ~CloudExternalDataManagerBase() override; | 40 ~CloudExternalDataManagerBase() override; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 std::unique_ptr<ExternalPolicyDataFetcherBackend> | 82 std::unique_ptr<ExternalPolicyDataFetcherBackend> |
| 84 external_policy_data_fetcher_backend_; | 83 external_policy_data_fetcher_backend_; |
| 85 | 84 |
| 86 // The |backend_| handles all data download scheduling, verification, caching | 85 // The |backend_| handles all data download scheduling, verification, caching |
| 87 // and retrieval. It is instantiated on the thread |this| runs on but after | 86 // and retrieval. It is instantiated on the thread |this| runs on but after |
| 88 // that, must only be accessed and eventually destroyed via the | 87 // that, must only be accessed and eventually destroyed via the |
| 89 // |backend_task_runner_|. | 88 // |backend_task_runner_|. |
| 90 class Backend; | 89 class Backend; |
| 91 std::unique_ptr<Backend> backend_; | 90 std::unique_ptr<Backend> backend_; |
| 92 | 91 |
| 92 SEQUENCE_CHECKER(sequence_checker_); |
| 93 |
| 93 DISALLOW_COPY_AND_ASSIGN(CloudExternalDataManagerBase); | 94 DISALLOW_COPY_AND_ASSIGN(CloudExternalDataManagerBase); |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 } // namespace policy | 97 } // namespace policy |
| 97 | 98 |
| 98 #endif // CHROME_BROWSER_CHROMEOS_POLICY_CLOUD_EXTERNAL_DATA_MANAGER_BASE_H_ | 99 #endif // CHROME_BROWSER_CHROMEOS_POLICY_CLOUD_EXTERNAL_DATA_MANAGER_BASE_H_ |
| OLD | NEW |