origin_trials_component_loader_policy.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright 2021 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. #ifndef ANDROID_WEBVIEW_BROWSER_COMPONENT_UPDATER_LOADER_POLICIES_ORIGIN_TRIALS_COMPONENT_LOADER_POLICY_H_
  5. #define ANDROID_WEBVIEW_BROWSER_COMPONENT_UPDATER_LOADER_POLICIES_ORIGIN_TRIALS_COMPONENT_LOADER_POLICY_H_
  6. #include <stdint.h>
  7. #include <memory>
  8. #include <string>
  9. #include <vector>
  10. #include "base/containers/flat_map.h"
  11. #include "base/files/scoped_file.h"
  12. #include "components/component_updater/android/component_loader_policy.h"
  13. namespace base {
  14. class DictionaryValue;
  15. class Version;
  16. } // namespace base
  17. namespace android_webview {
  18. // OriginTrialsComponentLoaderPolicy defines a loader responsible
  19. // for receiving origin trials config.
  20. class OriginTrialsComponentLoaderPolicy
  21. : public component_updater::ComponentLoaderPolicy {
  22. public:
  23. OriginTrialsComponentLoaderPolicy();
  24. ~OriginTrialsComponentLoaderPolicy() override;
  25. OriginTrialsComponentLoaderPolicy(const OriginTrialsComponentLoaderPolicy&) =
  26. delete;
  27. OriginTrialsComponentLoaderPolicy& operator=(
  28. const OriginTrialsComponentLoaderPolicy&) = delete;
  29. private:
  30. // The following methods override ComponentLoaderPolicy.
  31. void ComponentLoaded(
  32. const base::Version& version,
  33. base::flat_map<std::string, base::ScopedFD>& fd_map,
  34. std::unique_ptr<base::DictionaryValue> manifest) override;
  35. void ComponentLoadFailed(
  36. component_updater::ComponentLoadResult error) override;
  37. void GetHash(std::vector<uint8_t>* hash) const override;
  38. std::string GetMetricsSuffix() const override;
  39. };
  40. } // namespace android_webview
  41. #endif // ANDROID_WEBVIEW_BROWSER_COMPONENT_UPDATER_LOADER_POLICIES_ORIGIN_TRIALS_COMPONENT_LOADER_POLICY_H_