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/file_util.h" | 10 #include "base/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/screens/error_screen.h" | 15 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
15 #include "chrome/browser/chromeos/login/screens/screen_observer.h" | 16 #include "chrome/browser/chromeos/login/screens/screen_observer.h" |
16 #include "chrome/browser/chromeos/login/screens/update_screen_actor.h" | 17 #include "chrome/browser/chromeos/login/screens/update_screen_actor.h" |
17 #include "chrome/browser/chromeos/login/startup_utils.h" | 18 #include "chrome/browser/chromeos/login/startup_utils.h" |
18 #include "chrome/browser/chromeos/login/wizard_controller.h" | 19 #include "chrome/browser/chromeos/login/wizard_controller.h" |
19 #include "chromeos/dbus/dbus_thread_manager.h" | 20 #include "chromeos/dbus/dbus_thread_manager.h" |
20 #include "chromeos/network/network_state.h" | 21 #include "chromeos/network/network_state.h" |
21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
22 | 23 |
23 using content::BrowserThread; | 24 using content::BrowserThread; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 state_(STATE_IDLE), | 92 state_(STATE_IDLE), |
92 reboot_check_delay_(0), | 93 reboot_check_delay_(0), |
93 is_checking_for_update_(true), | 94 is_checking_for_update_(true), |
94 is_downloading_update_(false), | 95 is_downloading_update_(false), |
95 is_ignore_update_deadlines_(false), | 96 is_ignore_update_deadlines_(false), |
96 is_shown_(false), | 97 is_shown_(false), |
97 ignore_idle_status_(true), | 98 ignore_idle_status_(true), |
98 actor_(actor), | 99 actor_(actor), |
99 is_first_detection_notification_(true), | 100 is_first_detection_notification_(true), |
100 is_first_portal_notification_(true), | 101 is_first_portal_notification_(true), |
| 102 histogram_helper_(new ErrorScreensHistogramHelper("Update")), |
101 weak_factory_(this) { | 103 weak_factory_(this) { |
102 DCHECK(actor_); | 104 DCHECK(actor_); |
103 if (actor_) | 105 if (actor_) |
104 actor_->SetDelegate(this); | 106 actor_->SetDelegate(this); |
105 GetInstanceSet().insert(this); | 107 GetInstanceSet().insert(this); |
106 } | 108 } |
107 | 109 |
108 UpdateScreen::~UpdateScreen() { | 110 UpdateScreen::~UpdateScreen() { |
109 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this); | 111 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this); |
110 NetworkPortalDetector::Get()->RemoveObserver(this); | 112 NetworkPortalDetector::Get()->RemoveObserver(this); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 NetworkPortalDetector::Get()->AddAndFireObserver(this); | 285 NetworkPortalDetector::Get()->AddAndFireObserver(this); |
284 } | 286 } |
285 | 287 |
286 void UpdateScreen::CancelUpdate() { | 288 void UpdateScreen::CancelUpdate() { |
287 VLOG(1) << "Forced update cancel"; | 289 VLOG(1) << "Forced update cancel"; |
288 ExitUpdate(REASON_UPDATE_CANCELED); | 290 ExitUpdate(REASON_UPDATE_CANCELED); |
289 } | 291 } |
290 | 292 |
291 void UpdateScreen::Show() { | 293 void UpdateScreen::Show() { |
292 is_shown_ = true; | 294 is_shown_ = true; |
| 295 histogram_helper_->OnScreenShow(); |
293 if (actor_) { | 296 if (actor_) { |
294 actor_->Show(); | 297 actor_->Show(); |
295 actor_->SetProgress(kBeforeUpdateCheckProgress); | 298 actor_->SetProgress(kBeforeUpdateCheckProgress); |
296 } | 299 } |
297 } | 300 } |
298 | 301 |
299 void UpdateScreen::Hide() { | 302 void UpdateScreen::Hide() { |
300 if (actor_) | 303 if (actor_) |
301 actor_->Hide(); | 304 actor_->Hide(); |
302 is_shown_ = false; | 305 is_shown_ = false; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 VLOG(1) << "Initiate update check"; | 477 VLOG(1) << "Initiate update check"; |
475 DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck( | 478 DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck( |
476 base::Bind(StartUpdateCallback, this)); | 479 base::Bind(StartUpdateCallback, this)); |
477 } | 480 } |
478 | 481 |
479 void UpdateScreen::ShowErrorMessage() { | 482 void UpdateScreen::ShowErrorMessage() { |
480 LOG(WARNING) << "UpdateScreen::ShowErrorMessage()"; | 483 LOG(WARNING) << "UpdateScreen::ShowErrorMessage()"; |
481 state_ = STATE_ERROR; | 484 state_ = STATE_ERROR; |
482 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_UPDATE); | 485 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_UPDATE); |
483 get_screen_observer()->ShowErrorScreen(); | 486 get_screen_observer()->ShowErrorScreen(); |
| 487 histogram_helper_->OnErrorShow(GetErrorScreen()->GetErrorState()); |
484 } | 488 } |
485 | 489 |
486 void UpdateScreen::HideErrorMessage() { | 490 void UpdateScreen::HideErrorMessage() { |
487 LOG(WARNING) << "UpdateScreen::HideErrorMessage()"; | 491 LOG(WARNING) << "UpdateScreen::HideErrorMessage()"; |
488 get_screen_observer()->HideErrorScreen(this); | 492 get_screen_observer()->HideErrorScreen(this); |
| 493 histogram_helper_->OnErrorHide(); |
489 } | 494 } |
490 | 495 |
491 void UpdateScreen::UpdateErrorMessage( | 496 void UpdateScreen::UpdateErrorMessage( |
492 const NetworkState* network, | 497 const NetworkState* network, |
493 const NetworkPortalDetector::CaptivePortalStatus status) { | 498 const NetworkPortalDetector::CaptivePortalStatus status) { |
494 switch (status) { | 499 switch (status) { |
495 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE: | 500 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE: |
496 NOTREACHED(); | 501 NOTREACHED(); |
497 break; | 502 break; |
498 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN: | 503 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN: |
(...skipping 14 matching lines...) Expand all Loading... |
513 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_PROXY, | 518 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_PROXY, |
514 std::string()); | 519 std::string()); |
515 break; | 520 break; |
516 default: | 521 default: |
517 NOTREACHED(); | 522 NOTREACHED(); |
518 break; | 523 break; |
519 } | 524 } |
520 } | 525 } |
521 | 526 |
522 } // namespace chromeos | 527 } // namespace chromeos |
OLD | NEW |