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") { ...@@ -606,8 +606,6 @@ static_library("browser") {
"interstitials/chrome_settings_page_helper.h", "interstitials/chrome_settings_page_helper.h",
"interstitials/enterprise_util.cc", "interstitials/enterprise_util.cc",
"interstitials/enterprise_util.h", "interstitials/enterprise_util.h",
"intranet_redirect_detector.cc",
"intranet_redirect_detector.h",
"invalidation/profile_invalidation_provider_factory.cc", "invalidation/profile_invalidation_provider_factory.cc",
"invalidation/profile_invalidation_provider_factory.h", "invalidation/profile_invalidation_provider_factory.h",
"language/language_model_manager_factory.cc", "language/language_model_manager_factory.cc",
...@@ -3476,6 +3474,8 @@ static_library("browser") { ...@@ -3476,6 +3474,8 @@ static_library("browser") {
"importer/in_process_importer_bridge.h", "importer/in_process_importer_bridge.h",
"importer/profile_writer.cc", "importer/profile_writer.cc",
"importer/profile_writer.h", "importer/profile_writer.h",
"intranet_redirect_detector.cc",
"intranet_redirect_detector.h",
"lifetime/browser_close_manager.cc", "lifetime/browser_close_manager.cc",
"lifetime/browser_close_manager.h", "lifetime/browser_close_manager.h",
"lifetime/termination_notification.cc", "lifetime/termination_notification.cc",
......
...@@ -29,7 +29,6 @@ class DownloadRequestLimiter; ...@@ -29,7 +29,6 @@ class DownloadRequestLimiter;
class DownloadStatusUpdater; class DownloadStatusUpdater;
class GpuModeManager; class GpuModeManager;
class IconManager; class IconManager;
class IntranetRedirectDetector;
class MediaFileSystemRegistry; class MediaFileSystemRegistry;
class NotificationPlatformBridge; class NotificationPlatformBridge;
class NotificationUIManager; class NotificationUIManager;
...@@ -41,6 +40,10 @@ class WatchDogThread; ...@@ -41,6 +40,10 @@ class WatchDogThread;
class WebRtcLogUploader; class WebRtcLogUploader;
class StartupData; class StartupData;
#if !defined(OS_ANDROID)
class IntranetRedirectDetector;
#endif
namespace network { namespace network {
class NetworkQualityTracker; class NetworkQualityTracker;
class SharedURLLoaderFactory; class SharedURLLoaderFactory;
...@@ -189,7 +192,9 @@ class BrowserProcess { ...@@ -189,7 +192,9 @@ class BrowserProcess {
virtual printing::BackgroundPrintingManager* virtual printing::BackgroundPrintingManager*
background_printing_manager() = 0; background_printing_manager() = 0;
#if !defined(OS_ANDROID)
virtual IntranetRedirectDetector* intranet_redirect_detector() = 0; virtual IntranetRedirectDetector* intranet_redirect_detector() = 0;
#endif
// Returns the locale used by the application. It is the IETF language tag, // 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 // defined in BCP 47. The region subtag is not included when it adds no
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include "chrome/browser/download/download_status_updater.h" #include "chrome/browser/download/download_status_updater.h"
#include "chrome/browser/gpu/gpu_mode_manager.h" #include "chrome/browser/gpu/gpu_mode_manager.h"
#include "chrome/browser/icon_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/application_lifetime.h"
#include "chrome/browser/lifetime/browser_shutdown.h" #include "chrome/browser/lifetime/browser_shutdown.h"
#include "chrome/browser/lifetime/switch_utils.h" #include "chrome/browser/lifetime/switch_utils.h"
...@@ -159,6 +158,7 @@ ...@@ -159,6 +158,7 @@
#else #else
#include "chrome/browser/devtools/devtools_auto_opener.h" #include "chrome/browser/devtools/devtools_auto_opener.h"
#include "chrome/browser/gcm/gcm_product_util.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/resource_coordinator/tab_manager.h"
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_list.h"
...@@ -825,12 +825,15 @@ printing::BackgroundPrintingManager* ...@@ -825,12 +825,15 @@ printing::BackgroundPrintingManager*
#endif #endif
} }
#if !defined(OS_ANDROID)
IntranetRedirectDetector* BrowserProcessImpl::intranet_redirect_detector() { IntranetRedirectDetector* BrowserProcessImpl::intranet_redirect_detector() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!intranet_redirect_detector_) if (!intranet_redirect_detector_)
CreateIntranetRedirectDetector(); intranet_redirect_detector_ = std::make_unique<IntranetRedirectDetector>();
return intranet_redirect_detector_.get(); return intranet_redirect_detector_.get();
} }
#endif
const std::string& BrowserProcessImpl::GetApplicationLocale() { const std::string& BrowserProcessImpl::GetApplicationLocale() {
#if !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
...@@ -1188,11 +1191,6 @@ void BrowserProcessImpl::CreateIconManager() { ...@@ -1188,11 +1191,6 @@ void BrowserProcessImpl::CreateIconManager() {
icon_manager_ = std::make_unique<IconManager>(); icon_manager_ = std::make_unique<IconManager>();
} }
void BrowserProcessImpl::CreateIntranetRedirectDetector() {
DCHECK(!intranet_redirect_detector_);
intranet_redirect_detector_ = std::make_unique<IntranetRedirectDetector>();
}
void BrowserProcessImpl::CreateNotificationPlatformBridge() { void BrowserProcessImpl::CreateNotificationPlatformBridge() {
#if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
DCHECK(!notification_bridge_); DCHECK(!notification_bridge_);
......
...@@ -158,7 +158,9 @@ class BrowserProcessImpl : public BrowserProcess, ...@@ -158,7 +158,9 @@ class BrowserProcessImpl : public BrowserProcess,
printing::PrintPreviewDialogController* print_preview_dialog_controller() printing::PrintPreviewDialogController* print_preview_dialog_controller()
override; override;
printing::BackgroundPrintingManager* background_printing_manager() override; printing::BackgroundPrintingManager* background_printing_manager() override;
#if !defined(OS_ANDROID)
IntranetRedirectDetector* intranet_redirect_detector() override; IntranetRedirectDetector* intranet_redirect_detector() override;
#endif
const std::string& GetApplicationLocale() override; const std::string& GetApplicationLocale() override;
void SetApplicationLocale(const std::string& actual_locale) override; void SetApplicationLocale(const std::string& actual_locale) override;
DownloadStatusUpdater* download_status_updater() override; DownloadStatusUpdater* download_status_updater() override;
...@@ -214,7 +216,6 @@ class BrowserProcessImpl : public BrowserProcess, ...@@ -214,7 +216,6 @@ class BrowserProcessImpl : public BrowserProcess,
void CreateWatchdogThread(); void CreateWatchdogThread();
void CreateProfileManager(); void CreateProfileManager();
void CreateIconManager(); void CreateIconManager();
void CreateIntranetRedirectDetector();
void CreateNotificationPlatformBridge(); void CreateNotificationPlatformBridge();
void CreateNotificationUIManager(); void CreateNotificationUIManager();
void CreatePrintPreviewDialogController(); void CreatePrintPreviewDialogController();
...@@ -299,7 +300,9 @@ class BrowserProcessImpl : public BrowserProcess, ...@@ -299,7 +300,9 @@ class BrowserProcessImpl : public BrowserProcess,
std::unique_ptr<NotificationUIManager> notification_ui_manager_; std::unique_ptr<NotificationUIManager> notification_ui_manager_;
#endif #endif
#if !defined(OS_ANDROID)
std::unique_ptr<IntranetRedirectDetector> intranet_redirect_detector_; std::unique_ptr<IntranetRedirectDetector> intranet_redirect_detector_;
#endif
std::unique_ptr<StatusTray> status_tray_; std::unique_ptr<StatusTray> status_tray_;
......
...@@ -1498,6 +1498,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { ...@@ -1498,6 +1498,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
net::NetModule::SetResourceProvider(ChromeNetResourceProvider); net::NetModule::SetResourceProvider(ChromeNetResourceProvider);
media::SetLocalizedStringProvider(ChromeMediaLocalizedStringProvider); media::SetLocalizedStringProvider(ChromeMediaLocalizedStringProvider);
#if !defined(OS_ANDROID)
// In unittest mode, this will do nothing. In normal mode, this will create // In unittest mode, this will do nothing. In normal mode, this will create
// the global IntranetRedirectDetector instance, which will promptly go to // the global IntranetRedirectDetector instance, which will promptly go to
// sleep for seven seconds (to avoid slowing startup), and wake up afterwards // sleep for seven seconds (to avoid slowing startup), and wake up afterwards
...@@ -1510,6 +1511,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { ...@@ -1510,6 +1511,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
// This can't be created in the BrowserProcessImpl constructor because it // This can't be created in the BrowserProcessImpl constructor because it
// needs to read prefs that get set after that runs. // needs to read prefs that get set after that runs.
browser_process_->intranet_redirect_detector(); browser_process_->intranet_redirect_detector();
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) #if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD)
if (parsed_command_line().HasSwitch(switches::kDebugPrint)) { if (parsed_command_line().HasSwitch(switches::kDebugPrint)) {
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "build/build_config.h"
#include "components/pref_registry/pref_registry_syncable.h" #include "components/pref_registry/pref_registry_syncable.h"
#include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_registrar.h"
...@@ -26,6 +27,11 @@ class SimpleURLLoader; ...@@ -26,6 +27,11 @@ class SimpleURLLoader;
class PrefRegistrySimple; 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 // 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, // that redirects requests for intranet hostnames to another site, and if so,
// tracking what that site is (including across restarts via a pref). For // tracking what that site is (including across restarts via a pref). For
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "chrome/browser/external_protocol/external_protocol_handler.h" #include "chrome/browser/external_protocol/external_protocol_handler.h"
#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/gpu/gpu_mode_manager.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/lifetime/browser_shutdown.h"
#include "chrome/browser/media/media_device_id_salt.h" #include "chrome/browser/media/media_device_id_salt.h"
#include "chrome/browser/media/media_engagement_service.h" #include "chrome/browser/media/media_engagement_service.h"
...@@ -230,6 +229,7 @@ ...@@ -230,6 +229,7 @@
#include "chrome/browser/accessibility/caption_controller.h" #include "chrome/browser/accessibility/caption_controller.h"
#include "chrome/browser/enterprise/reporting/prefs.h" #include "chrome/browser/enterprise/reporting/prefs.h"
#include "chrome/browser/gcm/gcm_product_util.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/media/unified_autoplay_config.h"
#include "chrome/browser/metrics/tab_stats_tracker.h" #include "chrome/browser/metrics/tab_stats_tracker.h"
#include "chrome/browser/nearby_sharing/common/nearby_share_prefs.h" #include "chrome/browser/nearby_sharing/common/nearby_share_prefs.h"
...@@ -569,7 +569,6 @@ void RegisterLocalState(PrefRegistrySimple* registry) { ...@@ -569,7 +569,6 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
flags_ui::PrefServiceFlagsStorage::RegisterPrefs(registry); flags_ui::PrefServiceFlagsStorage::RegisterPrefs(registry);
GpuModeManager::RegisterPrefs(registry); GpuModeManager::RegisterPrefs(registry);
signin::IdentityManager::RegisterLocalStatePrefs(registry); signin::IdentityManager::RegisterLocalStatePrefs(registry);
IntranetRedirectDetector::RegisterPrefs(registry);
invalidation::FCMInvalidationService::RegisterPrefs(registry); invalidation::FCMInvalidationService::RegisterPrefs(registry);
language::GeoLanguageProvider::RegisterLocalStatePrefs(registry); language::GeoLanguageProvider::RegisterLocalStatePrefs(registry);
language::UlpLanguageCodeLocator::RegisterLocalStatePrefs(registry); language::UlpLanguageCodeLocator::RegisterLocalStatePrefs(registry);
...@@ -629,6 +628,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) { ...@@ -629,6 +628,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
enterprise_connectors::RegisterLocalStatePrefs(registry); enterprise_connectors::RegisterLocalStatePrefs(registry);
enterprise_reporting::RegisterLocalStatePrefs(registry); enterprise_reporting::RegisterLocalStatePrefs(registry);
gcm::RegisterPrefs(registry); gcm::RegisterPrefs(registry);
IntranetRedirectDetector::RegisterPrefs(registry);
media_router::RegisterLocalStatePrefs(registry); media_router::RegisterLocalStatePrefs(registry);
metrics::TabStatsTracker::RegisterPrefs(registry); metrics::TabStatsTracker::RegisterPrefs(registry);
RegisterBrowserPrefs(registry); RegisterBrowserPrefs(registry);
......
...@@ -314,9 +314,11 @@ TestingBrowserProcess::notification_platform_bridge() { ...@@ -314,9 +314,11 @@ TestingBrowserProcess::notification_platform_bridge() {
return notification_platform_bridge_.get(); return notification_platform_bridge_.get();
} }
#if !defined(OS_ANDROID)
IntranetRedirectDetector* TestingBrowserProcess::intranet_redirect_detector() { IntranetRedirectDetector* TestingBrowserProcess::intranet_redirect_detector() {
return nullptr; return nullptr;
} }
#endif
void TestingBrowserProcess::CreateDevToolsProtocolHandler() {} void TestingBrowserProcess::CreateDevToolsProtocolHandler() {}
......
...@@ -109,7 +109,9 @@ class TestingBrowserProcess : public BrowserProcess { ...@@ -109,7 +109,9 @@ class TestingBrowserProcess : public BrowserProcess {
extensions::EventRouterForwarder* extension_event_router_forwarder() override; extensions::EventRouterForwarder* extension_event_router_forwarder() override;
NotificationUIManager* notification_ui_manager() override; NotificationUIManager* notification_ui_manager() override;
NotificationPlatformBridge* notification_platform_bridge() override; NotificationPlatformBridge* notification_platform_bridge() override;
#if !defined(OS_ANDROID)
IntranetRedirectDetector* intranet_redirect_detector() override; IntranetRedirectDetector* intranet_redirect_detector() override;
#endif
void CreateDevToolsProtocolHandler() override; void CreateDevToolsProtocolHandler() override;
void CreateDevToolsAutoOpener() override; void CreateDevToolsAutoOpener() override;
bool IsShuttingDown() 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