| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/login/screens/update_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/update_screen.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 15 #include "chrome/browser/chromeos/cros/network_library.h" | |
| 16 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 15 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
| 17 #include "chrome/browser/chromeos/login/screens/screen_observer.h" | 16 #include "chrome/browser/chromeos/login/screens/screen_observer.h" |
| 18 #include "chrome/browser/chromeos/login/screens/update_screen_actor.h" | 17 #include "chrome/browser/chromeos/login/screens/update_screen_actor.h" |
| 19 #include "chrome/browser/chromeos/login/startup_utils.h" | 18 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 20 #include "chrome/browser/chromeos/login/wizard_controller.h" | 19 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 21 #include "chromeos/chromeos_switches.h" | 20 #include "chromeos/chromeos_switches.h" |
| 22 #include "chromeos/dbus/dbus_thread_manager.h" | 21 #include "chromeos/dbus/dbus_thread_manager.h" |
| 22 #include "chromeos/network/network_state.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 | 24 |
| 25 using content::BrowserThread; | 25 using content::BrowserThread; |
| 26 | 26 |
| 27 namespace chromeos { | 27 namespace chromeos { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 // Progress bar stages. Each represents progress bar value | 31 // Progress bar stages. Each represents progress bar value |
| 32 // at the beginning of each stage. | 32 // at the beginning of each stage. |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 case UpdateEngineClient::UPDATE_STATUS_REPORTING_ERROR_EVENT: | 232 case UpdateEngineClient::UPDATE_STATUS_REPORTING_ERROR_EVENT: |
| 233 ExitUpdate(REASON_UPDATE_ENDED); | 233 ExitUpdate(REASON_UPDATE_ENDED); |
| 234 break; | 234 break; |
| 235 default: | 235 default: |
| 236 NOTREACHED(); | 236 NOTREACHED(); |
| 237 break; | 237 break; |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 void UpdateScreen::OnPortalDetectionCompleted( | 241 void UpdateScreen::OnPortalDetectionCompleted( |
| 242 const Network* network, | 242 const NetworkState* network, |
| 243 const NetworkPortalDetector::CaptivePortalState& state) { | 243 const NetworkPortalDetector::CaptivePortalState& state) { |
| 244 // Wait for the sane portal detection results. | 244 // Wait for the sane portal detection results. |
| 245 if (!network || | 245 if (!network || |
| 246 state.status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN) { | 246 state.status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN) { |
| 247 return; | 247 return; |
| 248 } | 248 } |
| 249 LOG(WARNING) << "UpdateScreen::OnPortalDetectionCompleted(): " | 249 LOG(WARNING) << "UpdateScreen::OnPortalDetectionCompleted(): " |
| 250 << "network=" << network->service_path() << ", " | 250 << "network=" << network->path() << ", " |
| 251 << "state.status=" << state.status << ", " | 251 << "state.status=" << state.status << ", " |
| 252 << "state.response_code=" << state.response_code; | 252 << "state.response_code=" << state.response_code; |
| 253 NetworkPortalDetector::CaptivePortalStatus status = state.status; | 253 NetworkPortalDetector::CaptivePortalStatus status = state.status; |
| 254 if (state_ == STATE_ERROR) { | 254 if (state_ == STATE_ERROR) { |
| 255 // In the case of online state hide error message and proceed to | 255 // In the case of online state hide error message and proceed to |
| 256 // the update stage. Otherwise, update error message content. | 256 // the update stage. Otherwise, update error message content. |
| 257 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE) { | 257 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE) { |
| 258 HideErrorMessage(); | 258 HideErrorMessage(); |
| 259 StartUpdateCheck(); | 259 StartUpdateCheck(); |
| 260 } else { | 260 } else { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_UPDATE); | 478 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_UPDATE); |
| 479 get_screen_observer()->ShowErrorScreen(); | 479 get_screen_observer()->ShowErrorScreen(); |
| 480 } | 480 } |
| 481 | 481 |
| 482 void UpdateScreen::HideErrorMessage() { | 482 void UpdateScreen::HideErrorMessage() { |
| 483 LOG(WARNING) << "UpdateScreen::HideErrorMessage()"; | 483 LOG(WARNING) << "UpdateScreen::HideErrorMessage()"; |
| 484 get_screen_observer()->HideErrorScreen(this); | 484 get_screen_observer()->HideErrorScreen(this); |
| 485 } | 485 } |
| 486 | 486 |
| 487 void UpdateScreen::UpdateErrorMessage( | 487 void UpdateScreen::UpdateErrorMessage( |
| 488 const Network* network, | 488 const NetworkState* network, |
| 489 const NetworkPortalDetector::CaptivePortalStatus status) { | 489 const NetworkPortalDetector::CaptivePortalStatus status) { |
| 490 switch (status) { | 490 switch (status) { |
| 491 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN: | 491 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN: |
| 492 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE: | 492 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE: |
| 493 NOTREACHED(); | 493 NOTREACHED(); |
| 494 break; | 494 break; |
| 495 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE: | 495 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE: |
| 496 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_OFFLINE, | 496 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_OFFLINE, |
| 497 std::string()); | 497 std::string()); |
| 498 break; | 498 break; |
| 499 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL: | 499 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL: |
| 500 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_PORTAL, | 500 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_PORTAL, |
| 501 network->name()); | 501 network->name()); |
| 502 if (is_first_portal_notification_) { | 502 if (is_first_portal_notification_) { |
| 503 is_first_portal_notification_ = false; | 503 is_first_portal_notification_ = false; |
| 504 GetErrorScreen()->FixCaptivePortal(); | 504 GetErrorScreen()->FixCaptivePortal(); |
| 505 } | 505 } |
| 506 break; | 506 break; |
| 507 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED: | 507 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED: |
| 508 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_PROXY, | 508 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_PROXY, |
| 509 std::string()); | 509 std::string()); |
| 510 break; | 510 break; |
| 511 default: | 511 default: |
| 512 NOTREACHED(); | 512 NOTREACHED(); |
| 513 break; | 513 break; |
| 514 } | 514 } |
| 515 } | 515 } |
| 516 | 516 |
| 517 } // namespace chromeos | 517 } // namespace chromeos |
| OLD | NEW |