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
3 // found in the LICENSE file.
5 #include "components/policy/core/common/external_data_fetcher.h"
7 #include "base/callback.h"
8 #include "components/policy/core/common/external_data_manager.h"
12 ExternalDataFetcher::ExternalDataFetcher(
13 base::WeakPtr
<ExternalDataManager
> manager
,
14 const std::string
& policy
)
19 ExternalDataFetcher::ExternalDataFetcher(const ExternalDataFetcher
& other
)
20 : manager_(other
.manager_
),
21 policy_(other
.policy_
) {
24 ExternalDataFetcher::~ExternalDataFetcher() {
28 bool ExternalDataFetcher::Equals(const ExternalDataFetcher
* first
,
29 const ExternalDataFetcher
* second
) {
30 if (!first
&& !second
)
32 if (!first
|| !second
)
34 return first
->manager_
.get() == second
->manager_
.get() &&
35 first
->policy_
== second
->policy_
;
38 void ExternalDataFetcher::Fetch(const FetchCallback
& callback
) const {
40 manager_
->Fetch(policy_
, callback
);
42 callback
.Run(scoped_ptr
<std::string
>());