Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" |
| 6 | 6 |
| 7 #include "ash/system/devicetype_utils.h" | 7 #include "ash/system/devicetype_utils.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/guid.h" | 10 #include "base/guid.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 DCHECK(network_state_informer_.get()); | 234 DCHECK(network_state_informer_.get()); |
| 235 set_call_js_prefix(kJsScreenPath); | 235 set_call_js_prefix(kJsScreenPath); |
| 236 } | 236 } |
| 237 | 237 |
| 238 GaiaScreenHandler::~GaiaScreenHandler() { | 238 GaiaScreenHandler::~GaiaScreenHandler() { |
| 239 if (network_portal_detector_) | 239 if (network_portal_detector_) |
| 240 network_portal_detector_->RemoveObserver(this); | 240 network_portal_detector_->RemoveObserver(this); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void GaiaScreenHandler::MaybePreloadAuthExtension() { | 243 void GaiaScreenHandler::MaybePreloadAuthExtension() { |
| 244 // We shall not have network portal detector initialized, which unnecessarily | |
| 245 // polls captive portal checking URL if we don't need to load gaia. | |
|
jdufault
2017/06/06 23:23:00
Please add a link to go/bad-portal here.
// Don't
Qiang(Joe) Xu
2017/06/06 23:46:51
Done.
| |
| 246 if (!signin_screen_handler_->ShouldLoadGaia()) | |
| 247 return; | |
| 248 | |
| 244 VLOG(1) << "MaybePreloadAuthExtension"; | 249 VLOG(1) << "MaybePreloadAuthExtension"; |
| 245 | 250 |
| 246 if (!network_portal_detector_) { | 251 if (!network_portal_detector_) { |
| 247 NetworkPortalDetectorImpl* detector = new NetworkPortalDetectorImpl( | 252 NetworkPortalDetectorImpl* detector = new NetworkPortalDetectorImpl( |
| 248 g_browser_process->system_request_context(), false); | 253 g_browser_process->system_request_context(), false); |
| 249 detector->set_portal_test_url(GURL(kRestrictiveProxyURL)); | 254 detector->set_portal_test_url(GURL(kRestrictiveProxyURL)); |
| 250 network_portal_detector_.reset(detector); | 255 network_portal_detector_.reset(detector); |
| 251 network_portal_detector_->AddObserver(this); | 256 network_portal_detector_->AddObserver(this); |
| 252 network_portal_detector_->Enable(true); | 257 network_portal_detector_->Enable(true); |
| 253 } | 258 } |
| 254 | 259 |
| 255 // If cookies clearing was initiated or |dns_clear_task_running_| then auth | 260 // If cookies clearing was initiated or |dns_clear_task_running_| then auth |
| 256 // extension showing has already been initiated and preloading is pointless. | 261 // extension showing has already been initiated and preloading is pointless. |
| 257 if (signin_screen_handler_->ShouldLoadGaia() && !gaia_silent_load_ && | 262 if (!gaia_silent_load_ && !cookies_cleared_ && !dns_clear_task_running_ && |
| 258 !cookies_cleared_ && !dns_clear_task_running_ && | |
| 259 network_state_informer_->state() == NetworkStateInformer::ONLINE) { | 263 network_state_informer_->state() == NetworkStateInformer::ONLINE) { |
| 260 gaia_silent_load_ = true; | 264 gaia_silent_load_ = true; |
| 261 gaia_silent_load_network_ = network_state_informer_->network_path(); | 265 gaia_silent_load_network_ = network_state_informer_->network_path(); |
| 262 LoadAuthExtension(true /* force */, false /* offline */); | 266 LoadAuthExtension(true /* force */, false /* offline */); |
| 263 } | 267 } |
| 264 } | 268 } |
| 265 | 269 |
| 266 void GaiaScreenHandler::DisableRestrictiveProxyCheckForTest() { | 270 void GaiaScreenHandler::DisableRestrictiveProxyCheckForTest() { |
| 267 disable_restrictive_proxy_check_for_test_ = true; | 271 disable_restrictive_proxy_check_for_test_ = true; |
| 268 } | 272 } |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 974 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 978 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
| 975 return signin_screen_handler_->delegate_; | 979 return signin_screen_handler_->delegate_; |
| 976 } | 980 } |
| 977 | 981 |
| 978 bool GaiaScreenHandler::IsRestrictiveProxy() const { | 982 bool GaiaScreenHandler::IsRestrictiveProxy() const { |
| 979 return !disable_restrictive_proxy_check_for_test_ && | 983 return !disable_restrictive_proxy_check_for_test_ && |
| 980 !IsOnline(captive_portal_status_); | 984 !IsOnline(captive_portal_status_); |
| 981 } | 985 } |
| 982 | 986 |
| 983 } // namespace chromeos | 987 } // namespace chromeos |
| OLD | NEW |