| 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. See |
| 246 // go/bad-portal for more context. |
| 247 if (!signin_screen_handler_->ShouldLoadGaia()) |
| 248 return; |
| 249 |
| 244 VLOG(1) << "MaybePreloadAuthExtension"; | 250 VLOG(1) << "MaybePreloadAuthExtension"; |
| 245 | 251 |
| 246 if (!network_portal_detector_) { | 252 if (!network_portal_detector_) { |
| 247 NetworkPortalDetectorImpl* detector = new NetworkPortalDetectorImpl( | 253 NetworkPortalDetectorImpl* detector = new NetworkPortalDetectorImpl( |
| 248 g_browser_process->system_request_context(), false); | 254 g_browser_process->system_request_context(), false); |
| 249 detector->set_portal_test_url(GURL(kRestrictiveProxyURL)); | 255 detector->set_portal_test_url(GURL(kRestrictiveProxyURL)); |
| 250 network_portal_detector_.reset(detector); | 256 network_portal_detector_.reset(detector); |
| 251 network_portal_detector_->AddObserver(this); | 257 network_portal_detector_->AddObserver(this); |
| 252 network_portal_detector_->Enable(true); | 258 network_portal_detector_->Enable(true); |
| 253 } | 259 } |
| 254 | 260 |
| 255 // If cookies clearing was initiated or |dns_clear_task_running_| then auth | 261 // If cookies clearing was initiated or |dns_clear_task_running_| then auth |
| 256 // extension showing has already been initiated and preloading is pointless. | 262 // extension showing has already been initiated and preloading is pointless. |
| 257 if (signin_screen_handler_->ShouldLoadGaia() && !gaia_silent_load_ && | 263 if (!gaia_silent_load_ && !cookies_cleared_ && !dns_clear_task_running_ && |
| 258 !cookies_cleared_ && !dns_clear_task_running_ && | |
| 259 network_state_informer_->state() == NetworkStateInformer::ONLINE) { | 264 network_state_informer_->state() == NetworkStateInformer::ONLINE) { |
| 260 gaia_silent_load_ = true; | 265 gaia_silent_load_ = true; |
| 261 gaia_silent_load_network_ = network_state_informer_->network_path(); | 266 gaia_silent_load_network_ = network_state_informer_->network_path(); |
| 262 LoadAuthExtension(true /* force */, false /* offline */); | 267 LoadAuthExtension(true /* force */, false /* offline */); |
| 263 } | 268 } |
| 264 } | 269 } |
| 265 | 270 |
| 266 void GaiaScreenHandler::DisableRestrictiveProxyCheckForTest() { | 271 void GaiaScreenHandler::DisableRestrictiveProxyCheckForTest() { |
| 267 disable_restrictive_proxy_check_for_test_ = true; | 272 disable_restrictive_proxy_check_for_test_ = true; |
| 268 } | 273 } |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 979 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
| 975 return signin_screen_handler_->delegate_; | 980 return signin_screen_handler_->delegate_; |
| 976 } | 981 } |
| 977 | 982 |
| 978 bool GaiaScreenHandler::IsRestrictiveProxy() const { | 983 bool GaiaScreenHandler::IsRestrictiveProxy() const { |
| 979 return !disable_restrictive_proxy_check_for_test_ && | 984 return !disable_restrictive_proxy_check_for_test_ && |
| 980 !IsOnline(captive_portal_status_); | 985 !IsOnline(captive_portal_status_); |
| 981 } | 986 } |
| 982 | 987 |
| 983 } // namespace chromeos | 988 } // namespace chromeos |
| OLD | NEW |