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/screen_manager.h" | 15 #include "chrome/browser/chromeos/login/screen_manager.h" |
15 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 16 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
16 #include "chrome/browser/chromeos/login/screens/screen_observer.h" | 17 #include "chrome/browser/chromeos/login/screens/screen_observer.h" |
17 #include "chrome/browser/chromeos/login/screens/update_screen_actor.h" | 18 #include "chrome/browser/chromeos/login/screens/update_screen_actor.h" |
18 #include "chrome/browser/chromeos/login/startup_utils.h" | 19 #include "chrome/browser/chromeos/login/startup_utils.h" |
19 #include "chrome/browser/chromeos/login/wizard_controller.h" | 20 #include "chrome/browser/chromeos/login/wizard_controller.h" |
20 #include "chromeos/dbus/dbus_thread_manager.h" | 21 #include "chromeos/dbus/dbus_thread_manager.h" |
21 #include "chromeos/network/network_state.h" | 22 #include "chromeos/network/network_state.h" |
22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
23 | 24 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 reboot_check_delay_(0), | 101 reboot_check_delay_(0), |
101 is_checking_for_update_(true), | 102 is_checking_for_update_(true), |
102 is_downloading_update_(false), | 103 is_downloading_update_(false), |
103 is_ignore_update_deadlines_(false), | 104 is_ignore_update_deadlines_(false), |
104 is_shown_(false), | 105 is_shown_(false), |
105 ignore_idle_status_(true), | 106 ignore_idle_status_(true), |
106 actor_(actor), | 107 actor_(actor), |
107 remora_controller_(remora_controller), | 108 remora_controller_(remora_controller), |
108 is_first_detection_notification_(true), | 109 is_first_detection_notification_(true), |
109 is_first_portal_notification_(true), | 110 is_first_portal_notification_(true), |
| 111 histogram_helper_(new ErrorScreensHistogramHelper("Update")), |
110 weak_factory_(this) { | 112 weak_factory_(this) { |
111 DCHECK(actor_); | 113 DCHECK(actor_); |
112 if (actor_) | 114 if (actor_) |
113 actor_->SetDelegate(this); | 115 actor_->SetDelegate(this); |
114 GetInstanceSet().insert(this); | 116 GetInstanceSet().insert(this); |
115 } | 117 } |
116 | 118 |
117 UpdateScreen::~UpdateScreen() { | 119 UpdateScreen::~UpdateScreen() { |
118 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this); | 120 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this); |
119 NetworkPortalDetector::Get()->RemoveObserver(this); | 121 NetworkPortalDetector::Get()->RemoveObserver(this); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 NetworkPortalDetector::Get()->AddAndFireObserver(this); | 298 NetworkPortalDetector::Get()->AddAndFireObserver(this); |
297 } | 299 } |
298 | 300 |
299 void UpdateScreen::CancelUpdate() { | 301 void UpdateScreen::CancelUpdate() { |
300 VLOG(1) << "Forced update cancel"; | 302 VLOG(1) << "Forced update cancel"; |
301 ExitUpdate(REASON_UPDATE_CANCELED); | 303 ExitUpdate(REASON_UPDATE_CANCELED); |
302 } | 304 } |
303 | 305 |
304 void UpdateScreen::Show() { | 306 void UpdateScreen::Show() { |
305 is_shown_ = true; | 307 is_shown_ = true; |
| 308 histogram_helper_->OnScreenShow(); |
306 if (actor_) { | 309 if (actor_) { |
307 actor_->Show(); | 310 actor_->Show(); |
308 actor_->SetProgress(kBeforeUpdateCheckProgress); | 311 actor_->SetProgress(kBeforeUpdateCheckProgress); |
309 } | 312 } |
310 } | 313 } |
311 | 314 |
312 void UpdateScreen::Hide() { | 315 void UpdateScreen::Hide() { |
313 if (actor_) | 316 if (actor_) |
314 actor_->Hide(); | 317 actor_->Hide(); |
315 is_shown_ = false; | 318 is_shown_ = false; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 VLOG(1) << "Initiate update check"; | 492 VLOG(1) << "Initiate update check"; |
490 DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck( | 493 DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck( |
491 base::Bind(StartUpdateCallback, this)); | 494 base::Bind(StartUpdateCallback, this)); |
492 } | 495 } |
493 | 496 |
494 void UpdateScreen::ShowErrorMessage() { | 497 void UpdateScreen::ShowErrorMessage() { |
495 LOG(WARNING) << "UpdateScreen::ShowErrorMessage()"; | 498 LOG(WARNING) << "UpdateScreen::ShowErrorMessage()"; |
496 state_ = STATE_ERROR; | 499 state_ = STATE_ERROR; |
497 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_UPDATE); | 500 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_UPDATE); |
498 get_screen_observer()->ShowErrorScreen(); | 501 get_screen_observer()->ShowErrorScreen(); |
| 502 histogram_helper_->OnErrorShow(GetErrorScreen()->GetErrorState()); |
499 } | 503 } |
500 | 504 |
501 void UpdateScreen::HideErrorMessage() { | 505 void UpdateScreen::HideErrorMessage() { |
502 LOG(WARNING) << "UpdateScreen::HideErrorMessage()"; | 506 LOG(WARNING) << "UpdateScreen::HideErrorMessage()"; |
503 get_screen_observer()->HideErrorScreen(this); | 507 get_screen_observer()->HideErrorScreen(this); |
| 508 histogram_helper_->OnErrorHide(); |
504 } | 509 } |
505 | 510 |
506 void UpdateScreen::UpdateErrorMessage( | 511 void UpdateScreen::UpdateErrorMessage( |
507 const NetworkState* network, | 512 const NetworkState* network, |
508 const NetworkPortalDetector::CaptivePortalStatus status) { | 513 const NetworkPortalDetector::CaptivePortalStatus status) { |
509 switch (status) { | 514 switch (status) { |
510 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE: | 515 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE: |
511 NOTREACHED(); | 516 NOTREACHED(); |
512 break; | 517 break; |
513 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN: | 518 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN: |
(...skipping 21 matching lines...) Expand all Loading... |
535 } | 540 } |
536 | 541 |
537 void UpdateScreen::SetHostPairingControllerStatus( | 542 void UpdateScreen::SetHostPairingControllerStatus( |
538 HostPairingController::UpdateStatus update_status) { | 543 HostPairingController::UpdateStatus update_status) { |
539 if (remora_controller_) { | 544 if (remora_controller_) { |
540 remora_controller_->OnUpdateStatusChanged(update_status); | 545 remora_controller_->OnUpdateStatusChanged(update_status); |
541 } | 546 } |
542 } | 547 } |
543 | 548 |
544 } // namespace chromeos | 549 } // namespace chromeos |
OLD | NEW |