Commit 1c9d9d29 authored by Yunke Zhou's avatar Yunke Zhou Committed by Commit Bot

Oobe: remove NetworkPortalDetector from GaiaScreenHandler

Bug: 1133203
Change-Id: Ib30cb16ac7705f575452b2f22ef96060443a351a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537530Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Commit-Queue: Yunke Zhou <yunkez@google.com>
Cr-Commit-Position: refs/heads/master@{#827772}
parent 14f26f85
......@@ -40,10 +40,6 @@ void GaiaScreen::SetView(GaiaView* view) {
view_->Bind(this);
}
void GaiaScreen::MaybePreloadAuthExtension() {
view_->MaybePreloadAuthExtension();
}
void GaiaScreen::LoadOnline(const AccountId& account) {
view_->SetGaiaPath(GaiaView::GaiaPath::kDefault);
view_->LoadGaiaAsync(account);
......
......@@ -36,7 +36,6 @@ class GaiaScreen : public BaseScreen {
void SetView(GaiaView* view);
void MaybePreloadAuthExtension();
// Loads online Gaia into the webview.
void LoadOnline(const AccountId& account);
// Loads online Gaia (for child signup) into the webview.
......
......@@ -75,7 +75,6 @@
#include "chromeos/login/auth/saml_password_attributes.h"
#include "chromeos/login/auth/user_context.h"
#include "chromeos/network/onc/certificate_scope.h"
#include "chromeos/network/portal_detector/network_portal_detector.h"
#include "chromeos/settings/cros_settings_names.h"
#include "chromeos/strings/grit/chromeos_strings.h"
#include "components/login/localized_values_builder.h"
......@@ -302,34 +301,10 @@ GaiaScreenHandler::GaiaScreenHandler(
}
GaiaScreenHandler::~GaiaScreenHandler() {
if (network_portal_detector::IsInitialized())
network_portal_detector::GetInstance()->RemoveObserver(this);
if (is_security_token_pin_enabled_)
GetLoginScreenPinDialogManager()->RemovePinDialogHost(this);
}
void GaiaScreenHandler::MaybePreloadAuthExtension() {
// We shall not have network portal detector initialized, which unnecessarily
// polls captive portal checking URL if we don't need to load gaia. See
// go/bad-portal for more context.
if (!signin_screen_handler_->ShouldLoadGaia())
return;
VLOG(1) << "MaybePreloadAuthExtension";
if (network_portal_detector::IsInitialized())
network_portal_detector::GetInstance()->AddAndFireObserver(this);
// If cookies clearing was initiated or `dns_clear_task_running_` then auth
// extension showing has already been initiated and preloading is pointless.
if (!gaia_silent_load_ && !cookies_cleared_ && !dns_clear_task_running_ &&
network_state_informer_->state() == NetworkStateInformer::ONLINE) {
gaia_silent_load_ = true;
gaia_silent_load_network_ = network_state_informer_->network_path();
LoadAuthExtension(true /* force */, false /* offline */);
}
}
void GaiaScreenHandler::DisableRestrictiveProxyCheckForTest() {
disable_restrictive_proxy_check_for_test_ = true;
}
......@@ -983,7 +958,6 @@ void GaiaScreenHandler::HandleOnFatalError(
}
void GaiaScreenHandler::OnShowAddUser() {
signin_screen_handler_->is_account_picker_showing_first_time_ = false;
lock_screen_utils::EnforceDevicePolicyInputMethods(std::string());
LoadGaiaAsync(EmptyAccountId());
LoginDisplayHost::default_host()->StartWizard(
......
......@@ -54,10 +54,6 @@ class GaiaView {
GaiaView() = default;
virtual ~GaiaView() = default;
// Decides whether an auth extension should be pre-loaded. If it should,
// pre-loads it.
virtual void MaybePreloadAuthExtension() = 0;
virtual void DisableRestrictiveProxyCheckForTest() = 0;
// Loads Gaia into the webview. Depending on internal state, the Gaia will
......@@ -123,7 +119,6 @@ class GaiaScreenHandler : public BaseScreenHandler,
~GaiaScreenHandler() override;
// GaiaView:
void MaybePreloadAuthExtension() override;
void DisableRestrictiveProxyCheckForTest() override;
void LoadGaiaAsync(const AccountId& account_id) override;
void LoadOfflineGaia(const AccountId& account_id) override;
......
......@@ -456,11 +456,6 @@ void SigninScreenHandler::SetDelegate(SigninScreenHandlerDelegate* delegate) {
delegate_->SetWebUIHandler(this);
}
void SigninScreenHandler::OnNetworkReady() {
VLOG(1) << "OnNetworkReady() call.";
gaia_screen_handler_->MaybePreloadAuthExtension();
}
void SigninScreenHandler::UpdateState(NetworkError::ErrorReason reason) {
// ERROR_REASON_FRAME_ERROR is an explicit signal from GAIA frame so it shoud
// force network error UI update.
......@@ -953,14 +948,6 @@ void SigninScreenHandler::OnTabletModeToggled(bool enabled) {
CallJS("login.AccountPickerScreen.setTabletModeState", enabled);
}
bool SigninScreenHandler::ShouldLoadGaia() const {
// Fetching of the extension is not started before account picker page is
// loaded because it can affect the loading speed.
// Do not load the extension for the screen locker, see crosbug.com/25018.
return !ScreenLocker::default_screen_locker() &&
is_account_picker_showing_first_time_;
}
void SigninScreenHandler::HandleAuthenticateUser(const AccountId& account_id,
const std::string& password,
bool authenticated_by_pin) {
......@@ -1105,8 +1092,6 @@ void SigninScreenHandler::HandleAccountPickerReady() {
return;
}
is_account_picker_showing_first_time_ = true;
// The wallpaper may have been set before the instance is initialized, so make
// sure the colors and blur state are updated.
OnWallpaperColorsChanged();
......
......@@ -169,7 +169,6 @@ class SigninScreenHandler
void SetDelegate(SigninScreenHandlerDelegate* delegate);
// NetworkStateInformer::NetworkStateInformerObserver implementation:
void OnNetworkReady() override;
void UpdateState(NetworkError::ErrorReason reason) override;
// Required Local State preferences.
......@@ -336,8 +335,6 @@ class SigninScreenHandler
// screen.
bool IsSigninScreenHiddenByError() const;
bool ShouldLoadGaia() const;
net::Error FrameError() const;
// input_method::ImeKeyboard::Observer implementation:
......@@ -363,9 +360,6 @@ class SigninScreenHandler
// Keeps whether screen should be shown for OOBE.
bool oobe_ui_ = false;
// Is account picker being shown for the first time.
bool is_account_picker_showing_first_time_ = false;
// Network state informer used to keep signin screen up.
scoped_refptr<NetworkStateInformer> network_state_informer_;
......
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