xref: /aosp_15_r20/external/libchrome/components/policy/core/common/external_data_manager.h (revision 635a864187cb8b6c713ff48b7e790a6b21769273)
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.
4 
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_MANAGER_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_MANAGER_H_
7 
8 #include <string>
9 
10 #include "components/policy/core/common/external_data_fetcher.h"
11 #include "components/policy/policy_export.h"
12 
13 namespace policy {
14 
15 // Downloads, verifies, caches and retrieves external data referenced by
16 // policies.
17 // An implementation of this abstract interface should be provided for each
18 // policy source (cloud policy, platform policy) that supports external data
19 // references.
20 class POLICY_EXPORT ExternalDataManager {
21  public:
22   // Retrieves the external data referenced by |policy| and invokes |callback|
23   // with the result. If |policy| does not reference any external data, the
24   // |callback| is invoked with a NULL pointer. Otherwise, the |callback| is
25   // invoked with the referenced data once it has been successfully retrieved.
26   // If retrieval is temporarily impossible (e.g. no network connectivity), the
27   // |callback| will be invoked when the temporary hindrance is resolved. If
28   // retrieval is permanently impossible (e.g. |policy| references data that
29   // does not exist on the server), the |callback| will never be invoked.
30   virtual void Fetch(const std::string& policy,
31                      const ExternalDataFetcher::FetchCallback& callback) = 0;
32 };
33 
34 }  // namespace policy
35 
36 #endif  // COMPONENTS_POLICY_CORE_COMMON_EXTERNAL_DATA_MANAGER_H_
37