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_USER_CLOUD_EXTERNAL_DATA_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_EXTERNAL_DATA_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_EXTERNAL_DATA_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_EXTERNAL_DATA_MANAGER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h" | 11 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h" |
| 12 #include "components/policy/core/common/policy_details.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 class SequencedTaskRunner; | 15 class SequencedTaskRunner; |
15 } | 16 } |
16 | 17 |
17 namespace policy { | 18 namespace policy { |
18 | 19 |
19 class CloudPolicyStore; | 20 class CloudPolicyStore; |
20 struct PolicyDefinitionList; | |
21 class ResourceCache; | 21 class ResourceCache; |
22 | 22 |
23 // Downloads, verifies, caches and retrieves external data referenced by | 23 // Downloads, verifies, caches and retrieves external data referenced by |
24 // policies. | 24 // policies. |
25 // This is the implementation for regular users on Chrome OS. The code would | 25 // This is the implementation for regular users on Chrome OS. The code would |
26 // work on desktop platforms as well but for now, is used on Chrome OS only | 26 // work on desktop platforms as well but for now, is used on Chrome OS only |
27 // because no other platform has policies referencing external data. | 27 // because no other platform has policies referencing external data. |
28 class UserCloudExternalDataManager : public CloudExternalDataManagerBase { | 28 class UserCloudExternalDataManager : public CloudExternalDataManagerBase { |
29 public: | 29 public: |
30 // The |policy_definitions| are used to determine the maximum size that the | 30 // |get_policy_details| is used to determine the maximum size that the |
31 // data referenced by each policy can have. Download scheduling, verification, | 31 // data referenced by each policy can have. Download scheduling, verification, |
32 // caching and retrieval tasks are done via the |backend_task_runner|, which | 32 // caching and retrieval tasks are done via the |backend_task_runner|, which |
33 // must support file I/O. Network I/O is done via the |io_task_runner|. The | 33 // must support file I/O. Network I/O is done via the |io_task_runner|. The |
34 // manager is responsible for external data references by policies in | 34 // manager is responsible for external data references by policies in |
35 // |policy_store|. | 35 // |policy_store|. |
36 UserCloudExternalDataManager( | 36 UserCloudExternalDataManager( |
37 const PolicyDefinitionList* policy_definitions, | 37 const GetChromePolicyDetailsCallback& get_policy_details, |
38 scoped_refptr<base::SequencedTaskRunner> backend_task_runner, | 38 scoped_refptr<base::SequencedTaskRunner> backend_task_runner, |
39 scoped_refptr<base::SequencedTaskRunner> io_task_runner, | 39 scoped_refptr<base::SequencedTaskRunner> io_task_runner, |
40 const base::FilePath& cache_path, | 40 const base::FilePath& cache_path, |
41 CloudPolicyStore* policy_store); | 41 CloudPolicyStore* policy_store); |
42 virtual ~UserCloudExternalDataManager(); | 42 virtual ~UserCloudExternalDataManager(); |
43 | 43 |
44 private: | 44 private: |
45 // Cache used to store downloaded external data. The |resource_cache_| is | 45 // Cache used to store downloaded external data. The |resource_cache_| is |
46 // owned by the manager but its destruction must be handled with care: | 46 // owned by the manager but its destruction must be handled with care: |
47 // * The manager owns a |backend_| which owns an |external_data_store_| which | 47 // * The manager owns a |backend_| which owns an |external_data_store_| which |
(...skipping 11 matching lines...) Expand all Loading... |
59 // |resource_cache_|. | 59 // |resource_cache_|. |
60 // Because of this destruction sequence, a scoped_ptr cannot be used. | 60 // Because of this destruction sequence, a scoped_ptr cannot be used. |
61 ResourceCache* resource_cache_; | 61 ResourceCache* resource_cache_; |
62 | 62 |
63 DISALLOW_COPY_AND_ASSIGN(UserCloudExternalDataManager); | 63 DISALLOW_COPY_AND_ASSIGN(UserCloudExternalDataManager); |
64 }; | 64 }; |
65 | 65 |
66 } // namespace policy | 66 } // namespace policy |
67 | 67 |
68 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_EXTERNAL_DATA_MANAGER_H_ | 68 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_EXTERNAL_DATA_MANAGER_H_ |
OLD | NEW |