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

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

Issue 2684473002: Revert of Fold UpdateModel into UpdateScreen. (Closed)
Patch Set: Created 3 years, 10 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"
(...skipping 17 matching lines...) Expand all
28 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
29 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
30 30
31 using content::BrowserThread; 31 using content::BrowserThread;
32 using pairing_chromeos::HostPairingController; 32 using pairing_chromeos::HostPairingController;
33 33
34 namespace chromeos { 34 namespace chromeos {
35 35
36 namespace { 36 namespace {
37 37
38 constexpr const char kUserActionCancelUpdateShortcut[] = "cancel-update";
39 constexpr const char kContextKeyEstimatedTimeLeftSec[] = "time-left-sec";
40 constexpr const char kContextKeyShowEstimatedTimeLeft[] = "show-time-left";
41 constexpr const char kContextKeyUpdateMessage[] = "update-msg";
42 constexpr const char kContextKeyShowCurtain[] = "show-curtain";
43 constexpr const char kContextKeyShowProgressMessage[] = "show-progress-msg";
44 constexpr const char kContextKeyProgress[] = "progress";
45 constexpr const char kContextKeyProgressMessage[] = "progress-msg";
46 constexpr const char kContextKeyCancelUpdateShortcutEnabled[] =
47 "cancel-update-enabled";
48
49 // If reboot didn't happen, ask user to reboot device manually. 38 // If reboot didn't happen, ask user to reboot device manually.
50 const int kWaitForRebootTimeSec = 3; 39 const int kWaitForRebootTimeSec = 3;
51 40
52 // Progress bar stages. Each represents progress bar value 41 // Progress bar stages. Each represents progress bar value
53 // at the beginning of each stage. 42 // at the beginning of each stage.
54 // TODO(nkostylev): Base stage progress values on approximate time. 43 // TODO(nkostylev): Base stage progress values on approximate time.
55 // TODO(nkostylev): Animate progress during each state. 44 // TODO(nkostylev): Animate progress during each state.
56 const int kBeforeUpdateCheckProgress = 7; 45 const int kBeforeUpdateCheckProgress = 7;
57 const int kBeforeDownloadProgress = 14; 46 const int kBeforeDownloadProgress = 14;
58 const int kBeforeVerifyingProgress = 74; 47 const int kBeforeVerifyingProgress = 74;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 103
115 // static 104 // static
116 UpdateScreen* UpdateScreen::Get(ScreenManager* manager) { 105 UpdateScreen* UpdateScreen::Get(ScreenManager* manager) {
117 return static_cast<UpdateScreen*>( 106 return static_cast<UpdateScreen*>(
118 manager->GetScreen(OobeScreen::SCREEN_OOBE_UPDATE)); 107 manager->GetScreen(OobeScreen::SCREEN_OOBE_UPDATE));
119 } 108 }
120 109
121 UpdateScreen::UpdateScreen(BaseScreenDelegate* base_screen_delegate, 110 UpdateScreen::UpdateScreen(BaseScreenDelegate* base_screen_delegate,
122 UpdateView* view, 111 UpdateView* view,
123 HostPairingController* remora_controller) 112 HostPairingController* remora_controller)
124 : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_OOBE_UPDATE), 113 : UpdateModel(base_screen_delegate),
114 state_(STATE_IDLE),
125 reboot_check_delay_(kWaitForRebootTimeSec), 115 reboot_check_delay_(kWaitForRebootTimeSec),
116 is_checking_for_update_(true),
117 is_downloading_update_(false),
118 is_ignore_update_deadlines_(false),
119 is_shown_(false),
120 ignore_idle_status_(true),
126 view_(view), 121 view_(view),
127 remora_controller_(remora_controller), 122 remora_controller_(remora_controller),
123 is_first_detection_notification_(true),
124 is_first_portal_notification_(true),
128 histogram_helper_(new ErrorScreensHistogramHelper("Update")), 125 histogram_helper_(new ErrorScreensHistogramHelper("Update")),
129 weak_factory_(this) { 126 weak_factory_(this) {
130 if (view_) 127 if (view_)
131 view_->Bind(this); 128 view_->Bind(*this);
132 129
133 GetInstanceSet().insert(this); 130 GetInstanceSet().insert(this);
134 } 131 }
135 132
136 UpdateScreen::~UpdateScreen() { 133 UpdateScreen::~UpdateScreen() {
137 if (view_) 134 if (view_)
138 view_->Unbind(); 135 view_->Unbind();
139 136
140 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this); 137 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this);
141 network_portal_detector::GetInstance()->RemoveObserver(this); 138 network_portal_detector::GetInstance()->RemoveObserver(this);
142 GetInstanceSet().erase(this); 139 GetInstanceSet().erase(this);
143 } 140 }
144 141
145 void UpdateScreen::OnViewDestroyed(UpdateView* view) {
146 if (view_ == view)
147 view_ = nullptr;
148 }
149
150 void UpdateScreen::StartNetworkCheck() {
151 // If portal detector is enabled and portal detection before AU is
152 // allowed, initiate network state check. Otherwise, directly
153 // proceed to update.
154 if (!network_portal_detector::GetInstance()->IsEnabled()) {
155 StartUpdateCheck();
156 return;
157 }
158 state_ = State::STATE_FIRST_PORTAL_CHECK;
159 is_first_detection_notification_ = true;
160 is_first_portal_notification_ = true;
161 network_portal_detector::GetInstance()->AddAndFireObserver(this);
162 }
163
164 void UpdateScreen::SetIgnoreIdleStatus(bool ignore_idle_status) {
165 ignore_idle_status_ = ignore_idle_status;
166 }
167
168 void UpdateScreen::ExitUpdate(UpdateScreen::ExitReason reason) {
169 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this);
170 network_portal_detector::GetInstance()->RemoveObserver(this);
171 SetHostPairingControllerStatus(HostPairingController::UPDATE_STATUS_UPDATED);
172
173 switch (reason) {
174 case REASON_UPDATE_CANCELED:
175 Finish(BaseScreenDelegate::UPDATE_NOUPDATE);
176 break;
177 case REASON_UPDATE_INIT_FAILED:
178 Finish(BaseScreenDelegate::UPDATE_ERROR_CHECKING_FOR_UPDATE);
179 break;
180 case REASON_UPDATE_NON_CRITICAL:
181 case REASON_UPDATE_ENDED: {
182 UpdateEngineClient* update_engine_client =
183 DBusThreadManager::Get()->GetUpdateEngineClient();
184 switch (update_engine_client->GetLastStatus().status) {
185 case UpdateEngineClient::UPDATE_STATUS_ATTEMPTING_ROLLBACK:
186 break;
187 case UpdateEngineClient::UPDATE_STATUS_UPDATE_AVAILABLE:
188 case UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT:
189 case UpdateEngineClient::UPDATE_STATUS_DOWNLOADING:
190 case UpdateEngineClient::UPDATE_STATUS_FINALIZING:
191 case UpdateEngineClient::UPDATE_STATUS_VERIFYING:
192 DCHECK(!HasCriticalUpdate());
193 // Noncritical update, just exit screen as if there is no update.
194 // no break
195 case UpdateEngineClient::UPDATE_STATUS_IDLE:
196 Finish(BaseScreenDelegate::UPDATE_NOUPDATE);
197 break;
198 case UpdateEngineClient::UPDATE_STATUS_ERROR:
199 case UpdateEngineClient::UPDATE_STATUS_REPORTING_ERROR_EVENT:
200 if (is_checking_for_update_) {
201 Finish(BaseScreenDelegate::UPDATE_ERROR_CHECKING_FOR_UPDATE);
202 } else if (HasCriticalUpdate()) {
203 Finish(BaseScreenDelegate::UPDATE_ERROR_UPDATING_CRITICAL_UPDATE);
204 } else {
205 Finish(BaseScreenDelegate::UPDATE_ERROR_UPDATING);
206 }
207 break;
208 default:
209 NOTREACHED();
210 }
211 } break;
212 default:
213 NOTREACHED();
214 }
215 }
216
217 void UpdateScreen::UpdateStatusChanged( 142 void UpdateScreen::UpdateStatusChanged(
218 const UpdateEngineClient::Status& status) { 143 const UpdateEngineClient::Status& status) {
219 if (is_checking_for_update_ && 144 if (is_checking_for_update_ &&
220 status.status > UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE) { 145 status.status > UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE) {
221 is_checking_for_update_ = false; 146 is_checking_for_update_ = false;
222 } 147 }
223 if (ignore_idle_status_ && status.status > 148 if (ignore_idle_status_ && status.status >
224 UpdateEngineClient::UPDATE_STATUS_IDLE) { 149 UpdateEngineClient::UPDATE_STATUS_IDLE) {
225 ignore_idle_status_ = false; 150 ignore_idle_status_ = false;
226 } 151 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 base::ThreadTaskRunnerHandle::Get()->PostTask( 277 base::ThreadTaskRunnerHandle::Get()->PostTask(
353 FROM_HERE, 278 FROM_HERE,
354 base::Bind( 279 base::Bind(
355 base::IgnoreResult(&NetworkPortalDetector::StartDetectionIfIdle), 280 base::IgnoreResult(&NetworkPortalDetector::StartDetectionIfIdle),
356 base::Unretained(network_portal_detector::GetInstance()))); 281 base::Unretained(network_portal_detector::GetInstance())));
357 return; 282 return;
358 } 283 }
359 is_first_detection_notification_ = false; 284 is_first_detection_notification_ = false;
360 285
361 NetworkPortalDetector::CaptivePortalStatus status = state.status; 286 NetworkPortalDetector::CaptivePortalStatus status = state.status;
362 if (state_ == State::STATE_ERROR) { 287 if (state_ == STATE_ERROR) {
363 // In the case of online state hide error message and proceed to 288 // In the case of online state hide error message and proceed to
364 // the update stage. Otherwise, update error message content. 289 // the update stage. Otherwise, update error message content.
365 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE) 290 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE)
366 StartUpdateCheck(); 291 StartUpdateCheck();
367 else 292 else
368 UpdateErrorMessage(network, status); 293 UpdateErrorMessage(network, status);
369 } else if (state_ == State::STATE_FIRST_PORTAL_CHECK) { 294 } else if (state_ == STATE_FIRST_PORTAL_CHECK) {
370 // In the case of online state immediately proceed to the update 295 // In the case of online state immediately proceed to the update
371 // stage. Otherwise, prepare and show error message. 296 // stage. Otherwise, prepare and show error message.
372 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE) { 297 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE) {
373 StartUpdateCheck(); 298 StartUpdateCheck();
374 } else { 299 } else {
375 UpdateErrorMessage(network, status); 300 UpdateErrorMessage(network, status);
376 301
377 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL) 302 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL)
378 DelayErrorMessage(); 303 DelayErrorMessage();
379 else 304 else
380 ShowErrorMessage(); 305 ShowErrorMessage();
381 } 306 }
382 } 307 }
383 } 308 }
384 309
385 void UpdateScreen::CancelUpdate() { 310 void UpdateScreen::StartNetworkCheck() {
386 VLOG(1) << "Forced update cancel"; 311 // If portal detector is enabled and portal detection before AU is
387 ExitUpdate(REASON_UPDATE_CANCELED); 312 // allowed, initiate network state check. Otherwise, directly
388 } 313 // proceed to update.
389 314 if (!network_portal_detector::GetInstance()->IsEnabled()) {
390 // TODO(jdufault): This should return a pointer. See crbug.com/672142. 315 StartUpdateCheck();
391 base::OneShotTimer& UpdateScreen::GetErrorMessageTimerForTesting() { 316 return;
392 return error_message_timer_; 317 }
318 state_ = STATE_FIRST_PORTAL_CHECK;
319 is_first_detection_notification_ = true;
320 is_first_portal_notification_ = true;
321 network_portal_detector::GetInstance()->AddAndFireObserver(this);
393 } 322 }
394 323
395 void UpdateScreen::Show() { 324 void UpdateScreen::Show() {
396 is_shown_ = true; 325 is_shown_ = true;
397 histogram_helper_->OnScreenShow(); 326 histogram_helper_->OnScreenShow();
398 327
399 #if !defined(OFFICIAL_BUILD) 328 #if !defined(OFFICIAL_BUILD)
400 GetContextEditor().SetBoolean(kContextKeyCancelUpdateShortcutEnabled, true); 329 GetContextEditor().SetBoolean(kContextKeyCancelUpdateShortcutEnabled, true);
401 #endif 330 #endif
402 GetContextEditor().SetInteger(kContextKeyProgress, 331 GetContextEditor().SetInteger(kContextKeyProgress,
403 kBeforeUpdateCheckProgress); 332 kBeforeUpdateCheckProgress);
404 333
405 if (view_) 334 if (view_)
406 view_->Show(); 335 view_->Show();
407 } 336 }
408 337
409 void UpdateScreen::Hide() { 338 void UpdateScreen::Hide() {
410 if (view_) 339 if (view_)
411 view_->Hide(); 340 view_->Hide();
412 is_shown_ = false; 341 is_shown_ = false;
413 } 342 }
414 343
344 void UpdateScreen::OnViewDestroyed(UpdateView* view) {
345 if (view_ == view)
346 view_ = nullptr;
347 }
348
415 void UpdateScreen::OnUserAction(const std::string& action_id) { 349 void UpdateScreen::OnUserAction(const std::string& action_id) {
416 #if !defined(OFFICIAL_BUILD) 350 #if !defined(OFFICIAL_BUILD)
417 if (action_id == kUserActionCancelUpdateShortcut) 351 if (action_id == kUserActionCancelUpdateShortcut)
418 CancelUpdate(); 352 CancelUpdate();
419 else 353 else
420 #endif 354 #endif
421 BaseScreen::OnUserAction(action_id); 355 BaseScreen::OnUserAction(action_id);
422 } 356 }
423 357
358 void UpdateScreen::OnContextKeyUpdated(
359 const ::login::ScreenContext::KeyType& key) {
360 UpdateModel::OnContextKeyUpdated(key);
361 }
362
363 void UpdateScreen::ExitUpdate(UpdateScreen::ExitReason reason) {
364 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this);
365 network_portal_detector::GetInstance()->RemoveObserver(this);
366 SetHostPairingControllerStatus(HostPairingController::UPDATE_STATUS_UPDATED);
367
368
369 switch (reason) {
370 case REASON_UPDATE_CANCELED:
371 Finish(BaseScreenDelegate::UPDATE_NOUPDATE);
372 break;
373 case REASON_UPDATE_INIT_FAILED:
374 Finish(BaseScreenDelegate::UPDATE_ERROR_CHECKING_FOR_UPDATE);
375 break;
376 case REASON_UPDATE_NON_CRITICAL:
377 case REASON_UPDATE_ENDED:
378 {
379 UpdateEngineClient* update_engine_client =
380 DBusThreadManager::Get()->GetUpdateEngineClient();
381 switch (update_engine_client->GetLastStatus().status) {
382 case UpdateEngineClient::UPDATE_STATUS_ATTEMPTING_ROLLBACK:
383 break;
384 case UpdateEngineClient::UPDATE_STATUS_UPDATE_AVAILABLE:
385 case UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT:
386 case UpdateEngineClient::UPDATE_STATUS_DOWNLOADING:
387 case UpdateEngineClient::UPDATE_STATUS_FINALIZING:
388 case UpdateEngineClient::UPDATE_STATUS_VERIFYING:
389 DCHECK(!HasCriticalUpdate());
390 // Noncritical update, just exit screen as if there is no update.
391 // no break
392 case UpdateEngineClient::UPDATE_STATUS_IDLE:
393 Finish(BaseScreenDelegate::UPDATE_NOUPDATE);
394 break;
395 case UpdateEngineClient::UPDATE_STATUS_ERROR:
396 case UpdateEngineClient::UPDATE_STATUS_REPORTING_ERROR_EVENT:
397 if (is_checking_for_update_) {
398 Finish(BaseScreenDelegate::UPDATE_ERROR_CHECKING_FOR_UPDATE);
399 } else if (HasCriticalUpdate()) {
400 Finish(BaseScreenDelegate::UPDATE_ERROR_UPDATING_CRITICAL_UPDATE);
401 } else {
402 Finish(BaseScreenDelegate::UPDATE_ERROR_UPDATING);
403 }
404 break;
405 default:
406 NOTREACHED();
407 }
408 }
409 break;
410 default:
411 NOTREACHED();
412 }
413 }
414
415 void UpdateScreen::OnWaitForRebootTimeElapsed() {
416 LOG(ERROR) << "Unable to reboot - asking user for a manual reboot.";
417 MakeSureScreenIsShown();
418 GetContextEditor().SetString(kContextKeyUpdateMessage,
419 l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED));
420 }
421
422 void UpdateScreen::MakeSureScreenIsShown() {
423 if (!is_shown_)
424 get_base_screen_delegate()->ShowCurrentScreen();
425 }
426
427 void UpdateScreen::SetIgnoreIdleStatus(bool ignore_idle_status) {
428 ignore_idle_status_ = ignore_idle_status;
429 }
430
431 void UpdateScreen::CancelUpdate() {
432 VLOG(1) << "Forced update cancel";
433 ExitUpdate(REASON_UPDATE_CANCELED);
434 }
435
424 void UpdateScreen::UpdateDownloadingStats( 436 void UpdateScreen::UpdateDownloadingStats(
425 const UpdateEngineClient::Status& status) { 437 const UpdateEngineClient::Status& status) {
426 base::Time download_current_time = base::Time::Now(); 438 base::Time download_current_time = base::Time::Now();
427 if (download_current_time >= 439 if (download_current_time >=
428 download_last_time_ + 440 download_last_time_ +
429 base::TimeDelta::FromSeconds(kMinTimeStepInSeconds)) { 441 base::TimeDelta::FromSeconds(kMinTimeStepInSeconds)) {
430 // Estimate downloading rate. 442 // Estimate downloading rate.
431 double progress_delta = 443 double progress_delta =
432 std::max(status.download_progress - download_last_progress_, 0.0); 444 std::max(status.download_progress - download_last_progress_, 0.0);
433 double time_delta = 445 double time_delta =
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 if (!base::ReadFileToString(update_deadline_file_path, &deadline) || 496 if (!base::ReadFileToString(update_deadline_file_path, &deadline) ||
485 deadline.empty()) { 497 deadline.empty()) {
486 return false; 498 return false;
487 } 499 }
488 500
489 // TODO(dpolukhin): Analyze file content. Now we can just assume that 501 // TODO(dpolukhin): Analyze file content. Now we can just assume that
490 // if the file exists and not empty, there is critical update. 502 // if the file exists and not empty, there is critical update.
491 return true; 503 return true;
492 } 504 }
493 505
494 void UpdateScreen::OnWaitForRebootTimeElapsed() {
495 LOG(ERROR) << "Unable to reboot - asking user for a manual reboot.";
496 MakeSureScreenIsShown();
497 GetContextEditor().SetString(kContextKeyUpdateMessage,
498 l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED));
499 }
500
501 void UpdateScreen::MakeSureScreenIsShown() {
502 if (!is_shown_)
503 get_base_screen_delegate()->ShowCurrentScreen();
504 }
505
506 void UpdateScreen::SetHostPairingControllerStatus(
507 HostPairingController::UpdateStatus update_status) {
508 if (remora_controller_) {
509 remora_controller_->OnUpdateStatusChanged(update_status);
510 }
511 }
512
513 ErrorScreen* UpdateScreen::GetErrorScreen() { 506 ErrorScreen* UpdateScreen::GetErrorScreen() {
514 return get_base_screen_delegate()->GetErrorScreen(); 507 return get_base_screen_delegate()->GetErrorScreen();
515 } 508 }
516 509
517 void UpdateScreen::StartUpdateCheck() { 510 void UpdateScreen::StartUpdateCheck() {
518 error_message_timer_.Stop(); 511 error_message_timer_.Stop();
519 GetErrorScreen()->HideCaptivePortal(); 512 GetErrorScreen()->HideCaptivePortal();
520 513
521 network_portal_detector::GetInstance()->RemoveObserver(this); 514 network_portal_detector::GetInstance()->RemoveObserver(this);
522 connect_request_subscription_.reset(); 515 connect_request_subscription_.reset();
523 if (state_ == State::STATE_ERROR) 516 if (state_ == STATE_ERROR)
524 HideErrorMessage(); 517 HideErrorMessage();
525 state_ = State::STATE_UPDATE; 518 state_ = STATE_UPDATE;
526 DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver(this); 519 DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver(this);
527 VLOG(1) << "Initiate update check"; 520 VLOG(1) << "Initiate update check";
528 DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck( 521 DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck(
529 base::Bind(StartUpdateCallback, this)); 522 base::Bind(StartUpdateCallback, this));
530 } 523 }
531 524
532 void UpdateScreen::ShowErrorMessage() { 525 void UpdateScreen::ShowErrorMessage() {
533 LOG(WARNING) << "UpdateScreen::ShowErrorMessage()"; 526 LOG(WARNING) << "UpdateScreen::ShowErrorMessage()";
534 527
535 error_message_timer_.Stop(); 528 error_message_timer_.Stop();
536 529
537 state_ = State::STATE_ERROR; 530 state_ = STATE_ERROR;
538 connect_request_subscription_ = 531 connect_request_subscription_ =
539 GetErrorScreen()->RegisterConnectRequestCallback(base::Bind( 532 GetErrorScreen()->RegisterConnectRequestCallback(base::Bind(
540 &UpdateScreen::OnConnectRequested, base::Unretained(this))); 533 &UpdateScreen::OnConnectRequested, base::Unretained(this)));
541 GetErrorScreen()->SetUIState(NetworkError::UI_STATE_UPDATE); 534 GetErrorScreen()->SetUIState(NetworkError::UI_STATE_UPDATE);
542 get_base_screen_delegate()->ShowErrorScreen(); 535 get_base_screen_delegate()->ShowErrorScreen();
543 histogram_helper_->OnErrorShow(GetErrorScreen()->GetErrorState()); 536 histogram_helper_->OnErrorShow(GetErrorScreen()->GetErrorState());
544 } 537 }
545 538
546 void UpdateScreen::HideErrorMessage() { 539 void UpdateScreen::HideErrorMessage() {
547 LOG(WARNING) << "UpdateScreen::HideErrorMessage()"; 540 LOG(WARNING) << "UpdateScreen::HideErrorMessage()";
(...skipping 25 matching lines...) Expand all
573 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED: 566 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED:
574 GetErrorScreen()->SetErrorState(NetworkError::ERROR_STATE_PROXY, 567 GetErrorScreen()->SetErrorState(NetworkError::ERROR_STATE_PROXY,
575 std::string()); 568 std::string());
576 break; 569 break;
577 default: 570 default:
578 NOTREACHED(); 571 NOTREACHED();
579 break; 572 break;
580 } 573 }
581 } 574 }
582 575
576 void UpdateScreen::SetHostPairingControllerStatus(
577 HostPairingController::UpdateStatus update_status) {
578 if (remora_controller_) {
579 remora_controller_->OnUpdateStatusChanged(update_status);
580 }
581 }
582
583 void UpdateScreen::DelayErrorMessage() { 583 void UpdateScreen::DelayErrorMessage() {
584 if (error_message_timer_.IsRunning()) 584 if (error_message_timer_.IsRunning())
585 return; 585 return;
586 586
587 state_ = State::STATE_ERROR; 587 state_ = STATE_ERROR;
588 error_message_timer_.Start( 588 error_message_timer_.Start(
589 FROM_HERE, base::TimeDelta::FromSeconds(kDelayErrorMessageSec), this, 589 FROM_HERE, base::TimeDelta::FromSeconds(kDelayErrorMessageSec), this,
590 &UpdateScreen::ShowErrorMessage); 590 &UpdateScreen::ShowErrorMessage);
591 } 591 }
592 592
593 base::OneShotTimer& UpdateScreen::GetErrorMessageTimerForTesting() {
594 return error_message_timer_;
595 }
596
593 void UpdateScreen::OnConnectRequested() { 597 void UpdateScreen::OnConnectRequested() {
594 if (state_ == State::STATE_ERROR) { 598 if (state_ == STATE_ERROR) {
595 LOG(WARNING) << "Hiding error message since AP was reselected"; 599 LOG(WARNING) << "Hiding error message since AP was reselected";
596 StartUpdateCheck(); 600 StartUpdateCheck();
597 } 601 }
598 } 602 }
599 603
600 } // namespace chromeos 604 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/screens/update_screen.h ('k') | chrome/browser/chromeos/login/screens/update_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698