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

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

Issue 2673943002: Fold UpdateModel into UpdateScreen. (Closed)
Patch Set: Address comments 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
38 // If reboot didn't happen, ask user to reboot device manually. 49 // If reboot didn't happen, ask user to reboot device manually.
39 const int kWaitForRebootTimeSec = 3; 50 const int kWaitForRebootTimeSec = 3;
40 51
41 // Progress bar stages. Each represents progress bar value 52 // Progress bar stages. Each represents progress bar value
42 // at the beginning of each stage. 53 // at the beginning of each stage.
43 // TODO(nkostylev): Base stage progress values on approximate time. 54 // TODO(nkostylev): Base stage progress values on approximate time.
44 // TODO(nkostylev): Animate progress during each state. 55 // TODO(nkostylev): Animate progress during each state.
45 const int kBeforeUpdateCheckProgress = 7; 56 const int kBeforeUpdateCheckProgress = 7;
46 const int kBeforeDownloadProgress = 14; 57 const int kBeforeDownloadProgress = 14;
47 const int kBeforeVerifyingProgress = 74; 58 const int kBeforeVerifyingProgress = 74;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 114
104 // static 115 // static
105 UpdateScreen* UpdateScreen::Get(ScreenManager* manager) { 116 UpdateScreen* UpdateScreen::Get(ScreenManager* manager) {
106 return static_cast<UpdateScreen*>( 117 return static_cast<UpdateScreen*>(
107 manager->GetScreen(OobeScreen::SCREEN_OOBE_UPDATE)); 118 manager->GetScreen(OobeScreen::SCREEN_OOBE_UPDATE));
108 } 119 }
109 120
110 UpdateScreen::UpdateScreen(BaseScreenDelegate* base_screen_delegate, 121 UpdateScreen::UpdateScreen(BaseScreenDelegate* base_screen_delegate,
111 UpdateView* view, 122 UpdateView* view,
112 HostPairingController* remora_controller) 123 HostPairingController* remora_controller)
113 : UpdateModel(base_screen_delegate), 124 : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_OOBE_UPDATE),
114 state_(STATE_IDLE),
115 reboot_check_delay_(kWaitForRebootTimeSec), 125 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),
121 view_(view), 126 view_(view),
122 remora_controller_(remora_controller), 127 remora_controller_(remora_controller),
123 is_first_detection_notification_(true),
124 is_first_portal_notification_(true),
125 histogram_helper_(new ErrorScreensHistogramHelper("Update")), 128 histogram_helper_(new ErrorScreensHistogramHelper("Update")),
126 weak_factory_(this) { 129 weak_factory_(this) {
127 if (view_) 130 if (view_)
128 view_->Bind(*this); 131 view_->Bind(this);
129 132
130 GetInstanceSet().insert(this); 133 GetInstanceSet().insert(this);
131 } 134 }
132 135
133 UpdateScreen::~UpdateScreen() { 136 UpdateScreen::~UpdateScreen() {
134 if (view_) 137 if (view_)
135 view_->Unbind(); 138 view_->Unbind();
136 139
137 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this); 140 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this);
138 network_portal_detector::GetInstance()->RemoveObserver(this); 141 network_portal_detector::GetInstance()->RemoveObserver(this);
139 GetInstanceSet().erase(this); 142 GetInstanceSet().erase(this);
140 } 143 }
141 144
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
142 void UpdateScreen::UpdateStatusChanged( 217 void UpdateScreen::UpdateStatusChanged(
143 const UpdateEngineClient::Status& status) { 218 const UpdateEngineClient::Status& status) {
144 if (is_checking_for_update_ && 219 if (is_checking_for_update_ &&
145 status.status > UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE) { 220 status.status > UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE) {
146 is_checking_for_update_ = false; 221 is_checking_for_update_ = false;
147 } 222 }
148 if (ignore_idle_status_ && status.status > 223 if (ignore_idle_status_ && status.status >
149 UpdateEngineClient::UPDATE_STATUS_IDLE) { 224 UpdateEngineClient::UPDATE_STATUS_IDLE) {
150 ignore_idle_status_ = false; 225 ignore_idle_status_ = false;
151 } 226 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 base::ThreadTaskRunnerHandle::Get()->PostTask( 352 base::ThreadTaskRunnerHandle::Get()->PostTask(
278 FROM_HERE, 353 FROM_HERE,
279 base::Bind( 354 base::Bind(
280 base::IgnoreResult(&NetworkPortalDetector::StartDetectionIfIdle), 355 base::IgnoreResult(&NetworkPortalDetector::StartDetectionIfIdle),
281 base::Unretained(network_portal_detector::GetInstance()))); 356 base::Unretained(network_portal_detector::GetInstance())));
282 return; 357 return;
283 } 358 }
284 is_first_detection_notification_ = false; 359 is_first_detection_notification_ = false;
285 360
286 NetworkPortalDetector::CaptivePortalStatus status = state.status; 361 NetworkPortalDetector::CaptivePortalStatus status = state.status;
287 if (state_ == STATE_ERROR) { 362 if (state_ == State::STATE_ERROR) {
288 // In the case of online state hide error message and proceed to 363 // In the case of online state hide error message and proceed to
289 // the update stage. Otherwise, update error message content. 364 // the update stage. Otherwise, update error message content.
290 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE) 365 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE)
291 StartUpdateCheck(); 366 StartUpdateCheck();
292 else 367 else
293 UpdateErrorMessage(network, status); 368 UpdateErrorMessage(network, status);
294 } else if (state_ == STATE_FIRST_PORTAL_CHECK) { 369 } else if (state_ == State::STATE_FIRST_PORTAL_CHECK) {
295 // In the case of online state immediately proceed to the update 370 // In the case of online state immediately proceed to the update
296 // stage. Otherwise, prepare and show error message. 371 // stage. Otherwise, prepare and show error message.
297 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE) { 372 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE) {
298 StartUpdateCheck(); 373 StartUpdateCheck();
299 } else { 374 } else {
300 UpdateErrorMessage(network, status); 375 UpdateErrorMessage(network, status);
301 376
302 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL) 377 if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL)
303 DelayErrorMessage(); 378 DelayErrorMessage();
304 else 379 else
305 ShowErrorMessage(); 380 ShowErrorMessage();
306 } 381 }
307 } 382 }
308 } 383 }
309 384
310 void UpdateScreen::StartNetworkCheck() { 385 void UpdateScreen::CancelUpdate() {
311 // If portal detector is enabled and portal detection before AU is 386 VLOG(1) << "Forced update cancel";
312 // allowed, initiate network state check. Otherwise, directly 387 ExitUpdate(REASON_UPDATE_CANCELED);
313 // proceed to update. 388 }
314 if (!network_portal_detector::GetInstance()->IsEnabled()) { 389
315 StartUpdateCheck(); 390 // TODO(jdufault): This should return a pointer. See crbug.com/672142.
316 return; 391 base::OneShotTimer& UpdateScreen::GetErrorMessageTimerForTesting() {
317 } 392 return error_message_timer_;
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);
322 } 393 }
323 394
324 void UpdateScreen::Show() { 395 void UpdateScreen::Show() {
325 is_shown_ = true; 396 is_shown_ = true;
326 histogram_helper_->OnScreenShow(); 397 histogram_helper_->OnScreenShow();
327 398
328 #if !defined(OFFICIAL_BUILD) 399 #if !defined(OFFICIAL_BUILD)
329 GetContextEditor().SetBoolean(kContextKeyCancelUpdateShortcutEnabled, true); 400 GetContextEditor().SetBoolean(kContextKeyCancelUpdateShortcutEnabled, true);
330 #endif 401 #endif
331 GetContextEditor().SetInteger(kContextKeyProgress, 402 GetContextEditor().SetInteger(kContextKeyProgress,
332 kBeforeUpdateCheckProgress); 403 kBeforeUpdateCheckProgress);
333 404
334 if (view_) 405 if (view_)
335 view_->Show(); 406 view_->Show();
336 } 407 }
337 408
338 void UpdateScreen::Hide() { 409 void UpdateScreen::Hide() {
339 if (view_) 410 if (view_)
340 view_->Hide(); 411 view_->Hide();
341 is_shown_ = false; 412 is_shown_ = false;
342 } 413 }
343 414
344 void UpdateScreen::OnViewDestroyed(UpdateView* view) {
345 if (view_ == view)
346 view_ = nullptr;
347 }
348
349 void UpdateScreen::OnUserAction(const std::string& action_id) { 415 void UpdateScreen::OnUserAction(const std::string& action_id) {
350 #if !defined(OFFICIAL_BUILD) 416 #if !defined(OFFICIAL_BUILD)
351 if (action_id == kUserActionCancelUpdateShortcut) 417 if (action_id == kUserActionCancelUpdateShortcut)
352 CancelUpdate(); 418 CancelUpdate();
353 else 419 else
354 #endif 420 #endif
355 BaseScreen::OnUserAction(action_id); 421 BaseScreen::OnUserAction(action_id);
356 } 422 }
357 423
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
436 void UpdateScreen::UpdateDownloadingStats( 424 void UpdateScreen::UpdateDownloadingStats(
437 const UpdateEngineClient::Status& status) { 425 const UpdateEngineClient::Status& status) {
438 base::Time download_current_time = base::Time::Now(); 426 base::Time download_current_time = base::Time::Now();
439 if (download_current_time >= 427 if (download_current_time >=
440 download_last_time_ + 428 download_last_time_ +
441 base::TimeDelta::FromSeconds(kMinTimeStepInSeconds)) { 429 base::TimeDelta::FromSeconds(kMinTimeStepInSeconds)) {
442 // Estimate downloading rate. 430 // Estimate downloading rate.
443 double progress_delta = 431 double progress_delta =
444 std::max(status.download_progress - download_last_progress_, 0.0); 432 std::max(status.download_progress - download_last_progress_, 0.0);
445 double time_delta = 433 double time_delta =
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 if (!base::ReadFileToString(update_deadline_file_path, &deadline) || 484 if (!base::ReadFileToString(update_deadline_file_path, &deadline) ||
497 deadline.empty()) { 485 deadline.empty()) {
498 return false; 486 return false;
499 } 487 }
500 488
501 // TODO(dpolukhin): Analyze file content. Now we can just assume that 489 // TODO(dpolukhin): Analyze file content. Now we can just assume that
502 // if the file exists and not empty, there is critical update. 490 // if the file exists and not empty, there is critical update.
503 return true; 491 return true;
504 } 492 }
505 493
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
506 ErrorScreen* UpdateScreen::GetErrorScreen() { 513 ErrorScreen* UpdateScreen::GetErrorScreen() {
507 return get_base_screen_delegate()->GetErrorScreen(); 514 return get_base_screen_delegate()->GetErrorScreen();
508 } 515 }
509 516
510 void UpdateScreen::StartUpdateCheck() { 517 void UpdateScreen::StartUpdateCheck() {
511 error_message_timer_.Stop(); 518 error_message_timer_.Stop();
512 GetErrorScreen()->HideCaptivePortal(); 519 GetErrorScreen()->HideCaptivePortal();
513 520
514 network_portal_detector::GetInstance()->RemoveObserver(this); 521 network_portal_detector::GetInstance()->RemoveObserver(this);
515 connect_request_subscription_.reset(); 522 connect_request_subscription_.reset();
516 if (state_ == STATE_ERROR) 523 if (state_ == State::STATE_ERROR)
517 HideErrorMessage(); 524 HideErrorMessage();
518 state_ = STATE_UPDATE; 525 state_ = State::STATE_UPDATE;
519 DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver(this); 526 DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver(this);
520 VLOG(1) << "Initiate update check"; 527 VLOG(1) << "Initiate update check";
521 DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck( 528 DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck(
522 base::Bind(StartUpdateCallback, this)); 529 base::Bind(StartUpdateCallback, this));
523 } 530 }
524 531
525 void UpdateScreen::ShowErrorMessage() { 532 void UpdateScreen::ShowErrorMessage() {
526 LOG(WARNING) << "UpdateScreen::ShowErrorMessage()"; 533 LOG(WARNING) << "UpdateScreen::ShowErrorMessage()";
527 534
528 error_message_timer_.Stop(); 535 error_message_timer_.Stop();
529 536
530 state_ = STATE_ERROR; 537 state_ = State::STATE_ERROR;
531 connect_request_subscription_ = 538 connect_request_subscription_ =
532 GetErrorScreen()->RegisterConnectRequestCallback(base::Bind( 539 GetErrorScreen()->RegisterConnectRequestCallback(base::Bind(
533 &UpdateScreen::OnConnectRequested, base::Unretained(this))); 540 &UpdateScreen::OnConnectRequested, base::Unretained(this)));
534 GetErrorScreen()->SetUIState(NetworkError::UI_STATE_UPDATE); 541 GetErrorScreen()->SetUIState(NetworkError::UI_STATE_UPDATE);
535 get_base_screen_delegate()->ShowErrorScreen(); 542 get_base_screen_delegate()->ShowErrorScreen();
536 histogram_helper_->OnErrorShow(GetErrorScreen()->GetErrorState()); 543 histogram_helper_->OnErrorShow(GetErrorScreen()->GetErrorState());
537 } 544 }
538 545
539 void UpdateScreen::HideErrorMessage() { 546 void UpdateScreen::HideErrorMessage() {
540 LOG(WARNING) << "UpdateScreen::HideErrorMessage()"; 547 LOG(WARNING) << "UpdateScreen::HideErrorMessage()";
(...skipping 25 matching lines...) Expand all
566 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED: 573 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED:
567 GetErrorScreen()->SetErrorState(NetworkError::ERROR_STATE_PROXY, 574 GetErrorScreen()->SetErrorState(NetworkError::ERROR_STATE_PROXY,
568 std::string()); 575 std::string());
569 break; 576 break;
570 default: 577 default:
571 NOTREACHED(); 578 NOTREACHED();
572 break; 579 break;
573 } 580 }
574 } 581 }
575 582
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_ERROR; 587 state_ = 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
597 void UpdateScreen::OnConnectRequested() { 593 void UpdateScreen::OnConnectRequested() {
598 if (state_ == STATE_ERROR) { 594 if (state_ == State::STATE_ERROR) {
599 LOG(WARNING) << "Hiding error message since AP was reselected"; 595 LOG(WARNING) << "Hiding error message since AP was reselected";
600 StartUpdateCheck(); 596 StartUpdateCheck();
601 } 597 }
602 } 598 }
603 599
604 } // namespace chromeos 600 } // 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