// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_INTRANET_REDIRECT_DETECTOR_H_ #define CHROME_BROWSER_INTRANET_REDIRECT_DETECTOR_H_ #include <map> #include <memory> #include <string> #include <vector> #include "base/memory/weak_ptr.h" #include "build/build_config.h" #include "components/pref_registry/pref_registry_syncable.h" #include "mojo/public/cpp/bindings/receiver.h" #include "services/network/public/cpp/network_connection_tracker.h" #include "services/network/public/mojom/host_resolver.mojom.h" #include "url/gurl.h" namespace network { class SimpleURLLoader; } class PrefRegistrySimple; #if !(BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \ BUILDFLAG(IS_CHROMEOS)) #error "IntranetRedirectDetector should only be built on Desktop platforms." #endif // This object is responsible for determining whether the user is on a network // that redirects requests for intranet hostnames to another site, and if so, // tracking what that site is (including across restarts via a pref). For // example, the user's ISP might convert a request for "http://query/" into a // 302 redirect to "http://isp.domain.com/search?q=query" in order to display // custom pages on typos, nonexistent sites, etc. // // We use this information in the OmniboxNavigationObserver to avoid displaying // infobars for these cases. Our infobars are designed to allow users to get at // intranet sites when they were erroneously taken to a search result page. In // these cases, however, users would be shown a confusing and useless infobar // when they really did mean to do a search. // // Consumers should call RedirectOrigin(), which is guaranteed to synchronously // return a value at all times (even during startup or in unittest mode). If no // redirection is in place, the returned GURL will be empty. class IntranetRedirectDetector : public network::NetworkConnectionTracker::NetworkConnectionObserver, public network::mojom::DnsConfigChangeManagerClient { … }; #endif // CHROME_BROWSER_INTRANET_REDIRECT_DETECTOR_H_