https_only_mode_policy_handler.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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 COMPONENTS_SECURITY_INTERSTITIALS_CORE_HTTPS_ONLY_MODE_POLICY_HANDLER_H_
  5. #define COMPONENTS_SECURITY_INTERSTITIALS_CORE_HTTPS_ONLY_MODE_POLICY_HANDLER_H_
  6. #include "components/policy/core/browser/configuration_policy_handler.h"
  7. namespace policy {
  8. // Checks and converts the strings in policy::key::kHttpsOnlyMode to the boolean
  9. // pref::kHttpsOnlyModeEnabled. This currently only sets the associated pref to
  10. // `false` if the policy is set to "disallowed". Otherwise, the policy has no
  11. // effect.
  12. class HttpsOnlyModePolicyHandler : public TypeCheckingPolicyHandler {
  13. public:
  14. explicit HttpsOnlyModePolicyHandler(const char* const pref_name);
  15. ~HttpsOnlyModePolicyHandler() override;
  16. HttpsOnlyModePolicyHandler(const HttpsOnlyModePolicyHandler&) = delete;
  17. HttpsOnlyModePolicyHandler& operator=(const HttpsOnlyModePolicyHandler&) =
  18. delete;
  19. // ConfigurationPolicyHandler methods:
  20. void ApplyPolicySettings(const PolicyMap& policies,
  21. PrefValueMap* prefs) override;
  22. private:
  23. // Name of the HTTPS-Only pref.
  24. const char* const pref_name_;
  25. };
  26. } // namespace policy
  27. #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_HTTPS_ONLY_MODE_POLICY_HANDLER_H_