| // Copyright 2019 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef COMPONENTS_REPUTATION_CORE_SAFETY_TIPS_CONFIG_H_ |
| #define COMPONENTS_REPUTATION_CORE_SAFETY_TIPS_CONFIG_H_ |
| |
| #include <memory> |
| #include <string> |
| #include <vector> |
| |
| #include "components/reputation/core/safety_tips.pb.h" |
| #include "components/security_state/core/security_state.h" |
| |
| class GURL; |
| |
| namespace reputation { |
| |
| // Sets the global configuration for Safety Tips retrieved from the component |
| // updater. The configuration proto contains the list of URLs that can trigger |
| // a safety tip. |
| void SetSafetyTipsRemoteConfigProto(std::unique_ptr<SafetyTipsConfig> proto); |
| |
| // Gets the global configuration for Safety Tips as retrieved from the component |
| // updater. The configuration proto contains the list of URLs that can trigger |
| // a safety tip. |
| const SafetyTipsConfig* GetSafetyTipsRemoteConfigProto(); |
| |
| // Checks SafeBrowsing-style permutations of |url| against the component updater |
| // allowlist and returns whether the URL is explicitly allowed. |
| bool IsUrlAllowlistedBySafetyTipsComponent(const SafetyTipsConfig* proto, |
| const GURL& url); |
| |
| // Checks |hostname| against the component updater target allowlist and returns |
| // whether it is explicitly allowed. |
| bool IsTargetHostAllowlistedBySafetyTipsComponent(const SafetyTipsConfig* proto, |
| const std::string& hostname); |
| |
| // Checks SafeBrowsing-style permutations of |url| against the component updater |
| // blocklist and returns the match type. kNone means the URL is not blocked. |
| // This method assumes that the flagged pages in the safety tip config proto are |
| // in sorted order. |
| security_state::SafetyTipStatus GetSafetyTipUrlBlockType(const GURL& url); |
| |
| } // namespace reputation |
| |
| #endif // COMPONENTS_REPUTATION_CORE_SAFETY_TIPS_CONFIG_H_ |