Commit d5b7c22b authored by Tommy Li's avatar Tommy Li Committed by Commit Bot

[omnibox] Disable IntranetRedirectDetector on Android

This CL stops building IntranetRedirectDetector on Android.

It seems that on Android, this functionality is active today, and after
startup, sends redirect detecting requests 7 seconds after startup,
just like on Desktop.

This information is not used on Android. This CL modifies the BUILD.gn
files to no longer build this functionality on Android or any other
non-Desktop platform.

Android will no longer make these redirect detect requests after this.

Desktop will have a policy to control this behavior.

Bug: 1090985, 935772
Change-Id: I9b5e527af01133c3f8a091bcfe807d11c9ea982b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2498952
Commit-Queue: Tommy Li <tommycli@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821537}
parent 12561d34
......@@ -606,8 +606,6 @@ static_library("browser") {
"interstitials/chrome_settings_page_helper.h",
"interstitials/enterprise_util.cc",
"interstitials/enterprise_util.h",
"intranet_redirect_detector.cc",
"intranet_redirect_detector.h",
"invalidation/profile_invalidation_provider_factory.cc",
"invalidation/profile_invalidation_provider_factory.h",
"language/language_model_manager_factory.cc",
......@@ -3476,6 +3474,8 @@ static_library("browser") {
"importer/in_process_importer_bridge.h",
"importer/profile_writer.cc",
"importer/profile_writer.h",
"intranet_redirect_detector.cc",
"intranet_redirect_detector.h",
"lifetime/browser_close_manager.cc",
"lifetime/browser_close_manager.h",
"lifetime/termination_notification.cc",
......
......@@ -29,7 +29,6 @@ class DownloadRequestLimiter;
class DownloadStatusUpdater;
class GpuModeManager;
class IconManager;
class IntranetRedirectDetector;
class MediaFileSystemRegistry;
class NotificationPlatformBridge;
class NotificationUIManager;
......@@ -41,6 +40,10 @@ class WatchDogThread;
class WebRtcLogUploader;
class StartupData;
#if !defined(OS_ANDROID)
class IntranetRedirectDetector;
#endif
namespace network {
class NetworkQualityTracker;
class SharedURLLoaderFactory;
......@@ -189,7 +192,9 @@ class BrowserProcess {
virtual printing::BackgroundPrintingManager*
background_printing_manager() = 0;
#if !defined(OS_ANDROID)
virtual IntranetRedirectDetector* intranet_redirect_detector() = 0;
#endif
// Returns the locale used by the application. It is the IETF language tag,
// defined in BCP 47. The region subtag is not included when it adds no
......
......@@ -46,7 +46,6 @@
#include "chrome/browser/download/download_status_updater.h"
#include "chrome/browser/gpu/gpu_mode_manager.h"
#include "chrome/browser/icon_manager.h"
#include "chrome/browser/intranet_redirect_detector.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/lifetime/browser_shutdown.h"
#include "chrome/browser/lifetime/switch_utils.h"
......@@ -159,6 +158,7 @@
#else
#include "chrome/browser/devtools/devtools_auto_opener.h"
#include "chrome/browser/gcm/gcm_product_util.h"
#include "chrome/browser/intranet_redirect_detector.h"
#include "chrome/browser/resource_coordinator/tab_manager.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
......@@ -825,12 +825,15 @@ printing::BackgroundPrintingManager*
#endif
}
#if !defined(OS_ANDROID)
IntranetRedirectDetector* BrowserProcessImpl::intranet_redirect_detector() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!intranet_redirect_detector_)
CreateIntranetRedirectDetector();
intranet_redirect_detector_ = std::make_unique<IntranetRedirectDetector>();
return intranet_redirect_detector_.get();
}
#endif
const std::string& BrowserProcessImpl::GetApplicationLocale() {
#if !defined(OS_CHROMEOS)
......@@ -1188,11 +1191,6 @@ void BrowserProcessImpl::CreateIconManager() {
icon_manager_ = std::make_unique<IconManager>();
}
void BrowserProcessImpl::CreateIntranetRedirectDetector() {
DCHECK(!intranet_redirect_detector_);
intranet_redirect_detector_ = std::make_unique<IntranetRedirectDetector>();
}
void BrowserProcessImpl::CreateNotificationPlatformBridge() {
#if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
DCHECK(!notification_bridge_);
......
......@@ -158,7 +158,9 @@ class BrowserProcessImpl : public BrowserProcess,
printing::PrintPreviewDialogController* print_preview_dialog_controller()
override;
printing::BackgroundPrintingManager* background_printing_manager() override;
#if !defined(OS_ANDROID)
IntranetRedirectDetector* intranet_redirect_detector() override;
#endif
const std::string& GetApplicationLocale() override;
void SetApplicationLocale(const std::string& actual_locale) override;
DownloadStatusUpdater* download_status_updater() override;
......@@ -214,7 +216,6 @@ class BrowserProcessImpl : public BrowserProcess,
void CreateWatchdogThread();
void CreateProfileManager();
void CreateIconManager();
void CreateIntranetRedirectDetector();
void CreateNotificationPlatformBridge();
void CreateNotificationUIManager();
void CreatePrintPreviewDialogController();
......@@ -299,7 +300,9 @@ class BrowserProcessImpl : public BrowserProcess,
std::unique_ptr<NotificationUIManager> notification_ui_manager_;
#endif
#if !defined(OS_ANDROID)
std::unique_ptr<IntranetRedirectDetector> intranet_redirect_detector_;
#endif
std::unique_ptr<StatusTray> status_tray_;
......
......@@ -1498,6 +1498,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
net::NetModule::SetResourceProvider(ChromeNetResourceProvider);
media::SetLocalizedStringProvider(ChromeMediaLocalizedStringProvider);
#if !defined(OS_ANDROID)
// In unittest mode, this will do nothing. In normal mode, this will create
// the global IntranetRedirectDetector instance, which will promptly go to
// sleep for seven seconds (to avoid slowing startup), and wake up afterwards
......@@ -1510,6 +1511,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
// This can't be created in the BrowserProcessImpl constructor because it
// needs to read prefs that get set after that runs.
browser_process_->intranet_redirect_detector();
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD)
if (parsed_command_line().HasSwitch(switches::kDebugPrint)) {
......
......@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
......@@ -26,6 +27,11 @@ class SimpleURLLoader;
class PrefRegistrySimple;
#if !(defined(OS_MAC) || defined(OS_WIN) || defined(OS_LINUX) || \
defined(OS_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
......
......@@ -30,7 +30,6 @@
#include "chrome/browser/external_protocol/external_protocol_handler.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/gpu/gpu_mode_manager.h"
#include "chrome/browser/intranet_redirect_detector.h"
#include "chrome/browser/lifetime/browser_shutdown.h"
#include "chrome/browser/media/media_device_id_salt.h"
#include "chrome/browser/media/media_engagement_service.h"
......@@ -230,6 +229,7 @@
#include "chrome/browser/accessibility/caption_controller.h"
#include "chrome/browser/enterprise/reporting/prefs.h"
#include "chrome/browser/gcm/gcm_product_util.h"
#include "chrome/browser/intranet_redirect_detector.h"
#include "chrome/browser/media/unified_autoplay_config.h"
#include "chrome/browser/metrics/tab_stats_tracker.h"
#include "chrome/browser/nearby_sharing/common/nearby_share_prefs.h"
......@@ -569,7 +569,6 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
flags_ui::PrefServiceFlagsStorage::RegisterPrefs(registry);
GpuModeManager::RegisterPrefs(registry);
signin::IdentityManager::RegisterLocalStatePrefs(registry);
IntranetRedirectDetector::RegisterPrefs(registry);
invalidation::FCMInvalidationService::RegisterPrefs(registry);
language::GeoLanguageProvider::RegisterLocalStatePrefs(registry);
language::UlpLanguageCodeLocator::RegisterLocalStatePrefs(registry);
......@@ -629,6 +628,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
enterprise_connectors::RegisterLocalStatePrefs(registry);
enterprise_reporting::RegisterLocalStatePrefs(registry);
gcm::RegisterPrefs(registry);
IntranetRedirectDetector::RegisterPrefs(registry);
media_router::RegisterLocalStatePrefs(registry);
metrics::TabStatsTracker::RegisterPrefs(registry);
RegisterBrowserPrefs(registry);
......
......@@ -314,9 +314,11 @@ TestingBrowserProcess::notification_platform_bridge() {
return notification_platform_bridge_.get();
}
#if !defined(OS_ANDROID)
IntranetRedirectDetector* TestingBrowserProcess::intranet_redirect_detector() {
return nullptr;
}
#endif
void TestingBrowserProcess::CreateDevToolsProtocolHandler() {}
......
......@@ -109,7 +109,9 @@ class TestingBrowserProcess : public BrowserProcess {
extensions::EventRouterForwarder* extension_event_router_forwarder() override;
NotificationUIManager* notification_ui_manager() override;
NotificationPlatformBridge* notification_platform_bridge() override;
#if !defined(OS_ANDROID)
IntranetRedirectDetector* intranet_redirect_detector() override;
#endif
void CreateDevToolsProtocolHandler() override;
void CreateDevToolsAutoOpener() override;
bool IsShuttingDown() override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment