| // Copyright 2023 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "chrome/browser/ash/input_method/assistive_input.h" |
| #include "chrome/browser/ash/input_method/url_utils.h" |
| // The default denylist of domains that will turn off autocorrect and multi word |
| const char* kDefaultDomainDenylist[] = { |
| // Exceptions where the features are enabled. |
| const char* kAllowedDomainsWithPaths[][2] = {{"mail.google", "/chat"}}; |
| bool IsMatchedSubDomain(const GURL& url) { |
| for (const char* domain : kDefaultDomainDenylist) { |
| if (IsSubDomain(url, domain)) { |
| bool IsMatchedSubDomainWithPathPrefix(const GURL& url) { |
| for (const auto& [domain, path_prefix] : kAllowedDomainsWithPaths) { |
| if (IsSubDomainWithPathPrefix(url, domain, path_prefix)) { |
| bool IsAssistiveInputDisabled(const absl::optional<GURL>& url) { |
| return IsMatchedSubDomain(*url) && !IsMatchedSubDomainWithPathPrefix(*url); |
| } // namespace input_method |