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/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
14 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" | 14 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" |
15 #include "chrome/browser/chromeos/login/screen_manager.h" | 15 #include "chrome/browser/chromeos/login/screen_manager.h" |
16 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" | 16 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" |
17 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 17 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
| 18 #include "chrome/browser/chromeos/login/screens/network_error.h" |
18 #include "chrome/browser/chromeos/login/screens/update_view.h" | 19 #include "chrome/browser/chromeos/login/screens/update_view.h" |
19 #include "chrome/browser/chromeos/login/startup_utils.h" | 20 #include "chrome/browser/chromeos/login/startup_utils.h" |
20 #include "chrome/browser/chromeos/login/wizard_controller.h" | 21 #include "chrome/browser/chromeos/login/wizard_controller.h" |
21 #include "chrome/grit/chromium_strings.h" | 22 #include "chrome/grit/chromium_strings.h" |
22 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
23 #include "chromeos/dbus/dbus_thread_manager.h" | 24 #include "chromeos/dbus/dbus_thread_manager.h" |
24 #include "chromeos/network/network_state.h" | 25 #include "chromeos/network/network_state.h" |
25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
27 | 28 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 343 |
343 void UpdateScreen::OnViewDestroyed(UpdateView* view) { | 344 void UpdateScreen::OnViewDestroyed(UpdateView* view) { |
344 if (view_ == view) | 345 if (view_ == view) |
345 view_ = nullptr; | 346 view_ = nullptr; |
346 } | 347 } |
347 | 348 |
348 void UpdateScreen::OnUserAction(const std::string& action_id) { | 349 void UpdateScreen::OnUserAction(const std::string& action_id) { |
349 #if !defined(OFFICIAL_BUILD) | 350 #if !defined(OFFICIAL_BUILD) |
350 if (action_id == kUserActionCancelUpdateShortcut) | 351 if (action_id == kUserActionCancelUpdateShortcut) |
351 CancelUpdate(); | 352 CancelUpdate(); |
| 353 else |
352 #endif | 354 #endif |
| 355 BaseScreen::OnUserAction(action_id); |
353 } | 356 } |
354 | 357 |
355 void UpdateScreen::OnContextKeyUpdated( | 358 void UpdateScreen::OnContextKeyUpdated( |
356 const ::login::ScreenContext::KeyType& key) { | 359 const ::login::ScreenContext::KeyType& key) { |
357 UpdateModel::OnContextKeyUpdated(key); | 360 UpdateModel::OnContextKeyUpdated(key); |
358 } | 361 } |
359 | 362 |
360 void UpdateScreen::OnConnectToNetworkRequested() { | 363 void UpdateScreen::OnConnectToNetworkRequested() { |
361 if (state_ == STATE_ERROR) { | 364 if (state_ == STATE_ERROR) { |
362 LOG(WARNING) << "Hiding error message since AP was reselected"; | 365 LOG(WARNING) << "Hiding error message since AP was reselected"; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 state_ = STATE_UPDATE; | 515 state_ = STATE_UPDATE; |
513 DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver(this); | 516 DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver(this); |
514 VLOG(1) << "Initiate update check"; | 517 VLOG(1) << "Initiate update check"; |
515 DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck( | 518 DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck( |
516 base::Bind(StartUpdateCallback, this)); | 519 base::Bind(StartUpdateCallback, this)); |
517 } | 520 } |
518 | 521 |
519 void UpdateScreen::ShowErrorMessage() { | 522 void UpdateScreen::ShowErrorMessage() { |
520 LOG(WARNING) << "UpdateScreen::ShowErrorMessage()"; | 523 LOG(WARNING) << "UpdateScreen::ShowErrorMessage()"; |
521 state_ = STATE_ERROR; | 524 state_ = STATE_ERROR; |
522 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_UPDATE); | 525 GetErrorScreen()->SetUIState(NetworkError::UI_STATE_UPDATE); |
523 get_base_screen_delegate()->ShowErrorScreen(); | 526 get_base_screen_delegate()->ShowErrorScreen(); |
524 histogram_helper_->OnErrorShow(GetErrorScreen()->GetErrorState()); | 527 histogram_helper_->OnErrorShow(GetErrorScreen()->GetErrorState()); |
525 } | 528 } |
526 | 529 |
527 void UpdateScreen::HideErrorMessage() { | 530 void UpdateScreen::HideErrorMessage() { |
528 LOG(WARNING) << "UpdateScreen::HideErrorMessage()"; | 531 LOG(WARNING) << "UpdateScreen::HideErrorMessage()"; |
529 get_base_screen_delegate()->HideErrorScreen(this); | 532 get_base_screen_delegate()->HideErrorScreen(this); |
530 histogram_helper_->OnErrorHide(); | 533 histogram_helper_->OnErrorHide(); |
531 } | 534 } |
532 | 535 |
533 void UpdateScreen::UpdateErrorMessage( | 536 void UpdateScreen::UpdateErrorMessage( |
534 const NetworkState* network, | 537 const NetworkState* network, |
535 const NetworkPortalDetector::CaptivePortalStatus status) { | 538 const NetworkPortalDetector::CaptivePortalStatus status) { |
536 switch (status) { | 539 switch (status) { |
537 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE: | 540 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE: |
538 NOTREACHED(); | 541 NOTREACHED(); |
539 break; | 542 break; |
540 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN: | 543 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN: |
541 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE: | 544 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE: |
542 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_OFFLINE, | 545 GetErrorScreen()->SetErrorState(NetworkError::ERROR_STATE_OFFLINE, |
543 std::string()); | 546 std::string()); |
544 break; | 547 break; |
545 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL: | 548 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL: |
546 DCHECK(network); | 549 DCHECK(network); |
547 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_PORTAL, | 550 GetErrorScreen()->SetErrorState(NetworkError::ERROR_STATE_PORTAL, |
548 network->name()); | 551 network->name()); |
549 if (is_first_portal_notification_) { | 552 if (is_first_portal_notification_) { |
550 is_first_portal_notification_ = false; | 553 is_first_portal_notification_ = false; |
551 GetErrorScreen()->FixCaptivePortal(); | 554 GetErrorScreen()->FixCaptivePortal(); |
552 } | 555 } |
553 break; | 556 break; |
554 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED: | 557 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED: |
555 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_PROXY, | 558 GetErrorScreen()->SetErrorState(NetworkError::ERROR_STATE_PROXY, |
556 std::string()); | 559 std::string()); |
557 break; | 560 break; |
558 default: | 561 default: |
559 NOTREACHED(); | 562 NOTREACHED(); |
560 break; | 563 break; |
561 } | 564 } |
562 } | 565 } |
563 | 566 |
564 void UpdateScreen::SetHostPairingControllerStatus( | 567 void UpdateScreen::SetHostPairingControllerStatus( |
565 HostPairingController::UpdateStatus update_status) { | 568 HostPairingController::UpdateStatus update_status) { |
566 if (remora_controller_) { | 569 if (remora_controller_) { |
567 remora_controller_->OnUpdateStatusChanged(update_status); | 570 remora_controller_->OnUpdateStatusChanged(update_status); |
568 } | 571 } |
569 } | 572 } |
570 | 573 |
571 } // namespace chromeos | 574 } // namespace chromeos |
OLD | NEW |