| 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_EXTERNAL_DATA_FETCHER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_FETCHER_H_ |
| 6 #define COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_FETCHER_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_FETCHER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/callback_forward.h" | 11 #include "base/callback_forward.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 #include "components/policy/policy_export.h" |
| 14 | 14 |
| 15 namespace policy { | 15 namespace policy { |
| 16 | 16 |
| 17 class ExternalDataManager; | 17 class ExternalDataManager; |
| 18 | 18 |
| 19 // A helper that encapsulates the parameters required to retrieve the external | 19 // A helper that encapsulates the parameters required to retrieve the external |
| 20 // data for a policy. | 20 // data for a policy. |
| 21 class POLICY_EXPORT ExternalDataFetcher { | 21 class POLICY_EXPORT ExternalDataFetcher { |
| 22 public: | 22 public: |
| 23 typedef base::Callback<void(scoped_ptr<std::string>)> FetchCallback; | 23 typedef base::Callback<void(std::unique_ptr<std::string>)> FetchCallback; |
| 24 | 24 |
| 25 // 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 |
| 26 // external data referenced by the given |policy|. | 26 // external data referenced by the given |policy|. |
| 27 ExternalDataFetcher(base::WeakPtr<ExternalDataManager> manager, | 27 ExternalDataFetcher(base::WeakPtr<ExternalDataManager> manager, |
| 28 const std::string& policy); | 28 const std::string& policy); |
| 29 ExternalDataFetcher(const ExternalDataFetcher& other); | 29 ExternalDataFetcher(const ExternalDataFetcher& other); |
| 30 | 30 |
| 31 ~ExternalDataFetcher(); | 31 ~ExternalDataFetcher(); |
| 32 | 32 |
| 33 static bool Equals(const ExternalDataFetcher* first, | 33 static bool Equals(const ExternalDataFetcher* first, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 void Fetch(const FetchCallback& callback) const; | 44 void Fetch(const FetchCallback& callback) const; |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 base::WeakPtr<ExternalDataManager> manager_; | 47 base::WeakPtr<ExternalDataManager> manager_; |
| 48 const std::string policy_; | 48 const std::string policy_; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace policy | 51 } // namespace policy |
| 52 | 52 |
| 53 #endif // COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_FETCHER_H_ | 53 #endif // COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_FETCHER_H_ |
| OLD | NEW |