| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/update_screen.h" | 5 #include "chrome/browser/chromeos/login/update_screen.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/chromeos/cros/cros_library.h" | 8 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 9 #include "chrome/browser/chromeos/login/screen_observer.h" | 9 #include "chrome/browser/chromeos/login/screen_observer.h" |
| 10 #include "chrome/browser/chromeos/login/update_view.h" | 10 #include "chrome/browser/chromeos/login/update_view.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 checking_for_update_ = false; | 54 checking_for_update_ = false; |
| 55 } | 55 } |
| 56 | 56 |
| 57 switch (status) { | 57 switch (status) { |
| 58 case UPDATE_STATUS_CHECKING_FOR_UPDATE: | 58 case UPDATE_STATUS_CHECKING_FOR_UPDATE: |
| 59 // Do nothing in these cases, we don't want to notify the user of the | 59 // Do nothing in these cases, we don't want to notify the user of the |
| 60 // check unless there is an update. | 60 // check unless there is an update. |
| 61 break; | 61 break; |
| 62 case UPDATE_STATUS_UPDATE_AVAILABLE: | 62 case UPDATE_STATUS_UPDATE_AVAILABLE: |
| 63 view()->SetProgress(kBeforeDownloadProgress); | 63 view()->SetProgress(kBeforeDownloadProgress); |
| 64 LOG(INFO) << "Update available: " << library->status().new_version; | 64 VLOG(1) << "Update available: " << library->status().new_version; |
| 65 break; | 65 break; |
| 66 case UPDATE_STATUS_DOWNLOADING: | 66 case UPDATE_STATUS_DOWNLOADING: |
| 67 { | 67 { |
| 68 view()->ShowCurtain(false); | 68 view()->ShowCurtain(false); |
| 69 int download_progress = static_cast<int>( | 69 int download_progress = static_cast<int>( |
| 70 library->status().download_progress * kDownloadProgressIncrement); | 70 library->status().download_progress * kDownloadProgressIncrement); |
| 71 view()->SetProgress(kBeforeDownloadProgress + download_progress); | 71 view()->SetProgress(kBeforeDownloadProgress + download_progress); |
| 72 } | 72 } |
| 73 break; | 73 break; |
| 74 case UPDATE_STATUS_VERIFYING: | 74 case UPDATE_STATUS_VERIFYING: |
| 75 view()->SetProgress(kBeforeVerifyingProgress); | 75 view()->SetProgress(kBeforeVerifyingProgress); |
| 76 break; | 76 break; |
| 77 case UPDATE_STATUS_FINALIZING: | 77 case UPDATE_STATUS_FINALIZING: |
| 78 view()->SetProgress(kBeforeFinalizingProgress); | 78 view()->SetProgress(kBeforeFinalizingProgress); |
| 79 break; | 79 break; |
| 80 case UPDATE_STATUS_UPDATED_NEED_REBOOT: | 80 case UPDATE_STATUS_UPDATED_NEED_REBOOT: |
| 81 view()->SetProgress(kProgressComplete); | 81 view()->SetProgress(kProgressComplete); |
| 82 view()->ShowCurtain(false); | 82 view()->ShowCurtain(false); |
| 83 CrosLibrary::Get()->GetUpdateLibrary()->RebootAfterUpdate(); | 83 CrosLibrary::Get()->GetUpdateLibrary()->RebootAfterUpdate(); |
| 84 LOG(INFO) << "Reboot API was called. Waiting for reboot."; | 84 VLOG(1) << "Reboot API was called. Waiting for reboot."; |
| 85 reboot_timer_.Start(base::TimeDelta::FromSeconds(reboot_check_delay_), | 85 reboot_timer_.Start(base::TimeDelta::FromSeconds(reboot_check_delay_), |
| 86 this, | 86 this, |
| 87 &UpdateScreen::OnWaitForRebootTimeElapsed); | 87 &UpdateScreen::OnWaitForRebootTimeElapsed); |
| 88 break; | 88 break; |
| 89 case UPDATE_STATUS_IDLE: | 89 case UPDATE_STATUS_IDLE: |
| 90 case UPDATE_STATUS_ERROR: | 90 case UPDATE_STATUS_ERROR: |
| 91 case UPDATE_STATUS_REPORTING_ERROR_EVENT: | 91 case UPDATE_STATUS_REPORTING_ERROR_EVENT: |
| 92 ExitUpdate(); | 92 ExitUpdate(); |
| 93 break; | 93 break; |
| 94 default: | 94 default: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 111 } else { | 111 } else { |
| 112 view()->ShowCurtain(false); | 112 view()->ShowCurtain(false); |
| 113 } | 113 } |
| 114 | 114 |
| 115 view()->SetProgress(kBeforeUpdateCheckProgress); | 115 view()->SetProgress(kBeforeUpdateCheckProgress); |
| 116 | 116 |
| 117 if (!CrosLibrary::Get()->EnsureLoaded()) { | 117 if (!CrosLibrary::Get()->EnsureLoaded()) { |
| 118 LOG(ERROR) << "Error loading CrosLibrary"; | 118 LOG(ERROR) << "Error loading CrosLibrary"; |
| 119 } else { | 119 } else { |
| 120 CrosLibrary::Get()->GetUpdateLibrary()->AddObserver(this); | 120 CrosLibrary::Get()->GetUpdateLibrary()->AddObserver(this); |
| 121 LOG(INFO) << "Checking for update"; | 121 VLOG(1) << "Checking for update"; |
| 122 if (!CrosLibrary::Get()->GetUpdateLibrary()->CheckForUpdate()) { | 122 if (!CrosLibrary::Get()->GetUpdateLibrary()->CheckForUpdate()) { |
| 123 ExitUpdate(); | 123 ExitUpdate(); |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 void UpdateScreen::CancelUpdate() { | 128 void UpdateScreen::CancelUpdate() { |
| 129 #if !defined(OFFICIAL_BUILD) | 129 #if !defined(OFFICIAL_BUILD) |
| 130 ExitUpdate(); | 130 ExitUpdate(); |
| 131 #endif | 131 #endif |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 void UpdateScreen::SetRebootCheckDelay(int seconds) { | 175 void UpdateScreen::SetRebootCheckDelay(int seconds) { |
| 176 if (seconds <= 0) | 176 if (seconds <= 0) |
| 177 reboot_timer_.Stop(); | 177 reboot_timer_.Stop(); |
| 178 DCHECK(!reboot_timer_.IsRunning()); | 178 DCHECK(!reboot_timer_.IsRunning()); |
| 179 reboot_check_delay_ = seconds; | 179 reboot_check_delay_ = seconds; |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace chromeos | 182 } // namespace chromeos |
| OLD | NEW |