Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/browser/chromeos/login/screens/update_screen.cc

Issue 614223006: Revert "UMA: How often are different network error screens encountered during OOBE" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2171
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
15 #include "chrome/browser/chromeos/login/screen_manager.h" 14 #include "chrome/browser/chromeos/login/screen_manager.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/dbus/dbus_thread_manager.h" 20 #include "chromeos/dbus/dbus_thread_manager.h"
22 #include "chromeos/network/network_state.h" 21 #include "chromeos/network/network_state.h"
23 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
24 23
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 InstanceSet::iterator found = instance_set.find(inst); 84 InstanceSet::iterator found = instance_set.find(inst);
86 return (found != instance_set.end()); 85 return (found != instance_set.end());
87 } 86 }
88 87
89 // static 88 // static
90 UpdateScreen* UpdateScreen::Get(ScreenManager* manager) { 89 UpdateScreen* UpdateScreen::Get(ScreenManager* manager) {
91 return static_cast<UpdateScreen*>( 90 return static_cast<UpdateScreen*>(
92 manager->GetScreen(WizardController::kUpdateScreenName)); 91 manager->GetScreen(WizardController::kUpdateScreenName));
93 } 92 }
94 93
95 UpdateScreen::UpdateScreen(ScreenObserver* screen_observer, 94 UpdateScreen::UpdateScreen(
96 UpdateScreenActor* actor) 95 ScreenObserver* screen_observer,
96 UpdateScreenActor* actor)
97 : WizardScreen(screen_observer), 97 : WizardScreen(screen_observer),
98 state_(STATE_IDLE), 98 state_(STATE_IDLE),
99 reboot_check_delay_(0), 99 reboot_check_delay_(0),
100 is_checking_for_update_(true), 100 is_checking_for_update_(true),
101 is_downloading_update_(false), 101 is_downloading_update_(false),
102 is_ignore_update_deadlines_(false), 102 is_ignore_update_deadlines_(false),
103 is_shown_(false), 103 is_shown_(false),
104 ignore_idle_status_(true), 104 ignore_idle_status_(true),
105 actor_(actor), 105 actor_(actor),
106 is_first_detection_notification_(true), 106 is_first_detection_notification_(true),
107 is_first_portal_notification_(true), 107 is_first_portal_notification_(true),
108 histogram_helper_(new ErrorScreensHistogramHelper("Update")),
109 weak_factory_(this) { 108 weak_factory_(this) {
110 DCHECK(actor_); 109 DCHECK(actor_);
111 if (actor_) 110 if (actor_)
112 actor_->SetDelegate(this); 111 actor_->SetDelegate(this);
113 GetInstanceSet().insert(this); 112 GetInstanceSet().insert(this);
114 } 113 }
115 114
116 UpdateScreen::~UpdateScreen() { 115 UpdateScreen::~UpdateScreen() {
117 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this); 116 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this);
118 NetworkPortalDetector::Get()->RemoveObserver(this); 117 NetworkPortalDetector::Get()->RemoveObserver(this);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 NetworkPortalDetector::Get()->AddAndFireObserver(this); 290 NetworkPortalDetector::Get()->AddAndFireObserver(this);
292 } 291 }
293 292
294 void UpdateScreen::CancelUpdate() { 293 void UpdateScreen::CancelUpdate() {
295 VLOG(1) << "Forced update cancel"; 294 VLOG(1) << "Forced update cancel";
296 ExitUpdate(REASON_UPDATE_CANCELED); 295 ExitUpdate(REASON_UPDATE_CANCELED);
297 } 296 }
298 297
299 void UpdateScreen::Show() { 298 void UpdateScreen::Show() {
300 is_shown_ = true; 299 is_shown_ = true;
301 histogram_helper_->OnScreenShow();
302 if (actor_) { 300 if (actor_) {
303 actor_->Show(); 301 actor_->Show();
304 actor_->SetProgress(kBeforeUpdateCheckProgress); 302 actor_->SetProgress(kBeforeUpdateCheckProgress);
305 } 303 }
306 } 304 }
307 305
308 void UpdateScreen::Hide() { 306 void UpdateScreen::Hide() {
309 if (actor_) 307 if (actor_)
310 actor_->Hide(); 308 actor_->Hide();
311 is_shown_ = false; 309 is_shown_ = false;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 VLOG(1) << "Initiate update check"; 481 VLOG(1) << "Initiate update check";
484 DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck( 482 DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck(
485 base::Bind(StartUpdateCallback, this)); 483 base::Bind(StartUpdateCallback, this));
486 } 484 }
487 485
488 void UpdateScreen::ShowErrorMessage() { 486 void UpdateScreen::ShowErrorMessage() {
489 LOG(WARNING) << "UpdateScreen::ShowErrorMessage()"; 487 LOG(WARNING) << "UpdateScreen::ShowErrorMessage()";
490 state_ = STATE_ERROR; 488 state_ = STATE_ERROR;
491 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_UPDATE); 489 GetErrorScreen()->SetUIState(ErrorScreen::UI_STATE_UPDATE);
492 get_screen_observer()->ShowErrorScreen(); 490 get_screen_observer()->ShowErrorScreen();
493 histogram_helper_->OnErrorShow(GetErrorScreen()->GetErrorState());
494 } 491 }
495 492
496 void UpdateScreen::HideErrorMessage() { 493 void UpdateScreen::HideErrorMessage() {
497 LOG(WARNING) << "UpdateScreen::HideErrorMessage()"; 494 LOG(WARNING) << "UpdateScreen::HideErrorMessage()";
498 get_screen_observer()->HideErrorScreen(this); 495 get_screen_observer()->HideErrorScreen(this);
499 histogram_helper_->OnErrorHide();
500 } 496 }
501 497
502 void UpdateScreen::UpdateErrorMessage( 498 void UpdateScreen::UpdateErrorMessage(
503 const NetworkState* network, 499 const NetworkState* network,
504 const NetworkPortalDetector::CaptivePortalStatus status) { 500 const NetworkPortalDetector::CaptivePortalStatus status) {
505 switch (status) { 501 switch (status) {
506 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE: 502 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE:
507 NOTREACHED(); 503 NOTREACHED();
508 break; 504 break;
509 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN: 505 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN:
(...skipping 14 matching lines...) Expand all
524 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_PROXY, 520 GetErrorScreen()->SetErrorState(ErrorScreen::ERROR_STATE_PROXY,
525 std::string()); 521 std::string());
526 break; 522 break;
527 default: 523 default:
528 NOTREACHED(); 524 NOTREACHED();
529 break; 525 break;
530 } 526 }
531 } 527 }
532 528
533 } // namespace chromeos 529 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698