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_POLICY_EXTERNAL_DATA_FETCHER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_FETCHER_H_ |
6 #define CHROME_BROWSER_POLICY_EXTERNAL_DATA_FETCHER_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_FETCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "components/policy/policy_export.h" |
13 | 14 |
14 namespace policy { | 15 namespace policy { |
15 | 16 |
16 class ExternalDataManager; | 17 class ExternalDataManager; |
17 | 18 |
18 // A helper that encapsulates the parameters required to retrieve the external | 19 // A helper that encapsulates the parameters required to retrieve the external |
19 // data for a policy. | 20 // data for a policy. |
20 class ExternalDataFetcher { | 21 class POLICY_EXPORT ExternalDataFetcher { |
21 public: | 22 public: |
22 typedef base::Callback<void(scoped_ptr<std::string>)> FetchCallback; | 23 typedef base::Callback<void(scoped_ptr<std::string>)> FetchCallback; |
23 | 24 |
24 // This instance's Fetch() method will instruct the |manager| to retrieve the | 25 // This instance's Fetch() method will instruct the |manager| to retrieve the |
25 // external data referenced by the given |policy|. | 26 // external data referenced by the given |policy|. |
26 ExternalDataFetcher(base::WeakPtr<ExternalDataManager> manager, | 27 ExternalDataFetcher(base::WeakPtr<ExternalDataManager> manager, |
27 const std::string& policy); | 28 const std::string& policy); |
28 ExternalDataFetcher(const ExternalDataFetcher& other); | 29 ExternalDataFetcher(const ExternalDataFetcher& other); |
29 | 30 |
30 ~ExternalDataFetcher(); | 31 ~ExternalDataFetcher(); |
(...skipping 11 matching lines...) Expand all Loading... |
42 // does not exist on the server), the |callback| will never be invoked. | 43 // does not exist on the server), the |callback| will never be invoked. |
43 void Fetch(const FetchCallback& callback) const; | 44 void Fetch(const FetchCallback& callback) const; |
44 | 45 |
45 private: | 46 private: |
46 base::WeakPtr<ExternalDataManager> manager_; | 47 base::WeakPtr<ExternalDataManager> manager_; |
47 const std::string policy_; | 48 const std::string policy_; |
48 }; | 49 }; |
49 | 50 |
50 } // namespace policy | 51 } // namespace policy |
51 | 52 |
52 #endif // CHROME_BROWSER_POLICY_EXTERNAL_DATA_FETCHER_H_ | 53 #endif // COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_FETCHER_H_ |
OLD | NEW |