| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 11 #include "chrome/browser/chromeos/login/screen_observer.h" | 11 #include "chrome/browser/chromeos/login/screen_observer.h" |
| 12 #include "chrome/browser/chromeos/login/update_view.h" | 12 #include "chrome/browser/chromeos/login/update_screen_actor.h" |
| 13 #include "chrome/browser/chromeos/login/views_update_screen_actor.h" |
| 13 #include "chrome/browser/chromeos/login/wizard_controller.h" | 14 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 14 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
| 15 | 16 |
| 17 namespace chromeos { |
| 18 |
| 16 namespace { | 19 namespace { |
| 17 | 20 |
| 18 // Progress bar stages. Each represents progress bar value | 21 // Progress bar stages. Each represents progress bar value |
| 19 // at the beginning of each stage. | 22 // at the beginning of each stage. |
| 20 // TODO(nkostylev): Base stage progress values on approximate time. | 23 // TODO(nkostylev): Base stage progress values on approximate time. |
| 21 // TODO(nkostylev): Animate progress during each state. | 24 // TODO(nkostylev): Animate progress during each state. |
| 22 const int kBeforeUpdateCheckProgress = 7; | 25 const int kBeforeUpdateCheckProgress = 7; |
| 23 const int kBeforeDownloadProgress = 14; | 26 const int kBeforeDownloadProgress = 14; |
| 24 const int kBeforeVerifyingProgress = 74; | 27 const int kBeforeVerifyingProgress = 74; |
| 25 const int kBeforeFinalizingProgress = 81; | 28 const int kBeforeFinalizingProgress = 81; |
| 26 const int kProgressComplete = 100; | 29 const int kProgressComplete = 100; |
| 27 | 30 |
| 28 // Defines what part of update progress does download part takes. | 31 // Defines what part of update progress does download part takes. |
| 29 const int kDownloadProgressIncrement = 60; | 32 const int kDownloadProgressIncrement = 60; |
| 30 | 33 |
| 31 // Considering 10px shadow from each side. | 34 // Considering 10px shadow from each side. |
| 32 const int kUpdateScreenWidth = 580; | 35 const int kUpdateScreenWidth = 580; |
| 33 const int kUpdateScreenHeight = 305; | 36 const int kUpdateScreenHeight = 305; |
| 34 | 37 |
| 35 const char kUpdateDeadlineFile[] = "/tmp/update-check-response-deadline"; | 38 const char kUpdateDeadlineFile[] = "/tmp/update-check-response-deadline"; |
| 36 | 39 |
| 40 // Invoked from call to RequestUpdateCheck upon completion of the DBus call. |
| 41 void StartUpdateCallback(void* user_data, |
| 42 UpdateResult result, |
| 43 const char* msg) { |
| 44 if (result != chromeos::UPDATE_RESULT_SUCCESS) { |
| 45 DCHECK(user_data); |
| 46 UpdateScreen* screen = static_cast<UpdateScreen*>(user_data); |
| 47 if (UpdateScreen::HasInstance(screen)) |
| 48 screen->ExitUpdate(UpdateScreen::REASON_UPDATE_INIT_FAILED); |
| 49 } |
| 50 } |
| 51 |
| 37 } // anonymous namespace | 52 } // anonymous namespace |
| 38 | 53 |
| 39 namespace chromeos { | |
| 40 | |
| 41 | |
| 42 // static | 54 // static |
| 43 UpdateScreen::InstanceSet& UpdateScreen::GetInstanceSet() { | 55 UpdateScreen::InstanceSet& UpdateScreen::GetInstanceSet() { |
| 44 static std::set<UpdateScreen*> instance_set; | 56 static std::set<UpdateScreen*> instance_set; |
| 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // not threadsafe. | 57 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // not threadsafe. |
| 46 return instance_set; | 58 return instance_set; |
| 47 } | 59 } |
| 48 | 60 |
| 49 // static | 61 // static |
| 50 bool UpdateScreen::HasInstance(UpdateScreen* inst) { | 62 bool UpdateScreen::HasInstance(UpdateScreen* inst) { |
| 51 InstanceSet& instance_set = GetInstanceSet(); | 63 InstanceSet& instance_set = GetInstanceSet(); |
| 52 InstanceSet::iterator found = instance_set.find(inst); | 64 InstanceSet::iterator found = instance_set.find(inst); |
| 53 return (found != instance_set.end()); | 65 return (found != instance_set.end()); |
| 54 } | 66 } |
| 55 | 67 |
| 68 |
| 56 UpdateScreen::UpdateScreen(WizardScreenDelegate* delegate) | 69 UpdateScreen::UpdateScreen(WizardScreenDelegate* delegate) |
| 57 : DefaultViewScreen<chromeos::UpdateView>(delegate, | 70 : WizardScreen(delegate), |
| 58 kUpdateScreenWidth, | |
| 59 kUpdateScreenHeight), | |
| 60 checking_for_update_(true), | |
| 61 reboot_check_delay_(0), | 71 reboot_check_delay_(0), |
| 72 is_checking_for_update_(true), |
| 62 is_downloading_update_(false), | 73 is_downloading_update_(false), |
| 63 is_all_updates_critical_(true) { // See http://crosbug.com/10068 | 74 is_ignore_update_deadlines_(true), // See http://crosbug.com/10068 |
| 75 is_shown_(false), |
| 76 actor_(new ViewsUpdateScreenActor(delegate, |
| 77 kUpdateScreenWidth, |
| 78 kUpdateScreenHeight)) { |
| 64 GetInstanceSet().insert(this); | 79 GetInstanceSet().insert(this); |
| 65 } | 80 } |
| 66 | 81 |
| 67 UpdateScreen::~UpdateScreen() { | 82 UpdateScreen::~UpdateScreen() { |
| 68 // Remove pointer to this object from view. | |
| 69 if (view()) | |
| 70 view()->set_controller(NULL); | |
| 71 CrosLibrary::Get()->GetUpdateLibrary()->RemoveObserver(this); | 83 CrosLibrary::Get()->GetUpdateLibrary()->RemoveObserver(this); |
| 72 GetInstanceSet().erase(this); | 84 GetInstanceSet().erase(this); |
| 73 } | 85 } |
| 74 | 86 |
| 75 void UpdateScreen::UpdateStatusChanged(UpdateLibrary* library) { | 87 void UpdateScreen::UpdateStatusChanged(UpdateLibrary* library) { |
| 76 UpdateStatusOperation status = library->status().status; | 88 UpdateStatusOperation status = library->status().status; |
| 77 if (checking_for_update_ && status > UPDATE_STATUS_CHECKING_FOR_UPDATE) { | 89 if (is_checking_for_update_ && status > UPDATE_STATUS_CHECKING_FOR_UPDATE) { |
| 78 checking_for_update_ = false; | 90 is_checking_for_update_ = false; |
| 79 } | 91 } |
| 80 | 92 |
| 81 switch (status) { | 93 switch (status) { |
| 82 case UPDATE_STATUS_CHECKING_FOR_UPDATE: | 94 case UPDATE_STATUS_CHECKING_FOR_UPDATE: |
| 83 // Do nothing in these cases, we don't want to notify the user of the | 95 // Do nothing in these cases, we don't want to notify the user of the |
| 84 // check unless there is an update. | 96 // check unless there is an update. |
| 85 break; | 97 break; |
| 86 case UPDATE_STATUS_UPDATE_AVAILABLE: | 98 case UPDATE_STATUS_UPDATE_AVAILABLE: |
| 87 MakeSureScreenIsShown(); | 99 MakeSureScreenIsShown(); |
| 88 view()->SetProgress(kBeforeDownloadProgress); | 100 actor_->SetProgress(kBeforeDownloadProgress); |
| 89 if (!HasCriticalUpdate()) { | 101 if (!HasCriticalUpdate()) { |
| 90 LOG(INFO) << "Noncritical update available: " | 102 LOG(INFO) << "Noncritical update available: " |
| 91 << library->status().new_version; | 103 << library->status().new_version; |
| 92 ExitUpdate(REASON_UPDATE_NON_CRITICAL); | 104 ExitUpdate(REASON_UPDATE_NON_CRITICAL); |
| 93 } else { | 105 } else { |
| 94 LOG(INFO) << "Critical update available: " | 106 LOG(INFO) << "Critical update available: " |
| 95 << library->status().new_version; | 107 << library->status().new_version; |
| 96 } | 108 } |
| 97 break; | 109 break; |
| 98 case UPDATE_STATUS_DOWNLOADING: | 110 case UPDATE_STATUS_DOWNLOADING: |
| 99 { | 111 { |
| 100 MakeSureScreenIsShown(); | 112 MakeSureScreenIsShown(); |
| 101 if (!is_downloading_update_) { | 113 if (!is_downloading_update_) { |
| 102 // Because update engine doesn't send UPDATE_STATUS_UPDATE_AVAILABLE | 114 // Because update engine doesn't send UPDATE_STATUS_UPDATE_AVAILABLE |
| 103 // we need to is update critical on first downloading notification. | 115 // we need to is update critical on first downloading notification. |
| 104 is_downloading_update_ = true; | 116 is_downloading_update_ = true; |
| 105 if (!HasCriticalUpdate()) { | 117 if (!HasCriticalUpdate()) { |
| 106 LOG(INFO) << "Non-critical update available: " | 118 LOG(INFO) << "Non-critical update available: " |
| 107 << library->status().new_version; | 119 << library->status().new_version; |
| 108 ExitUpdate(REASON_UPDATE_NON_CRITICAL); | 120 ExitUpdate(REASON_UPDATE_NON_CRITICAL); |
| 109 } else { | 121 } else { |
| 110 LOG(INFO) << "Critical update available: " | 122 LOG(INFO) << "Critical update available: " |
| 111 << library->status().new_version; | 123 << library->status().new_version; |
| 112 } | 124 } |
| 113 } | 125 } |
| 114 view()->ShowCurtain(false); | 126 actor_->ShowCurtain(false); |
| 115 int download_progress = static_cast<int>( | 127 int download_progress = static_cast<int>( |
| 116 library->status().download_progress * kDownloadProgressIncrement); | 128 library->status().download_progress * kDownloadProgressIncrement); |
| 117 view()->SetProgress(kBeforeDownloadProgress + download_progress); | 129 actor_->SetProgress(kBeforeDownloadProgress + download_progress); |
| 118 } | 130 } |
| 119 break; | 131 break; |
| 120 case UPDATE_STATUS_VERIFYING: | 132 case UPDATE_STATUS_VERIFYING: |
| 121 MakeSureScreenIsShown(); | 133 MakeSureScreenIsShown(); |
| 122 view()->SetProgress(kBeforeVerifyingProgress); | 134 actor_->SetProgress(kBeforeVerifyingProgress); |
| 123 break; | 135 break; |
| 124 case UPDATE_STATUS_FINALIZING: | 136 case UPDATE_STATUS_FINALIZING: |
| 125 MakeSureScreenIsShown(); | 137 MakeSureScreenIsShown(); |
| 126 view()->SetProgress(kBeforeFinalizingProgress); | 138 actor_->SetProgress(kBeforeFinalizingProgress); |
| 127 break; | 139 break; |
| 128 case UPDATE_STATUS_UPDATED_NEED_REBOOT: | 140 case UPDATE_STATUS_UPDATED_NEED_REBOOT: |
| 129 MakeSureScreenIsShown(); | 141 MakeSureScreenIsShown(); |
| 130 // Make sure that first OOBE stage won't be shown after reboot. | 142 // Make sure that first OOBE stage won't be shown after reboot. |
| 131 WizardController::MarkOobeCompleted(); | 143 WizardController::MarkOobeCompleted(); |
| 132 view()->SetProgress(kProgressComplete); | 144 actor_->SetProgress(kProgressComplete); |
| 133 if (HasCriticalUpdate()) { | 145 if (HasCriticalUpdate()) { |
| 134 view()->ShowCurtain(false); | 146 actor_->ShowCurtain(false); |
| 135 VLOG(1) << "Initiate reboot after update"; | 147 VLOG(1) << "Initiate reboot after update"; |
| 136 CrosLibrary::Get()->GetUpdateLibrary()->RebootAfterUpdate(); | 148 CrosLibrary::Get()->GetUpdateLibrary()->RebootAfterUpdate(); |
| 137 reboot_timer_.Start(base::TimeDelta::FromSeconds(reboot_check_delay_), | 149 reboot_timer_.Start(base::TimeDelta::FromSeconds(reboot_check_delay_), |
| 138 this, | 150 this, |
| 139 &UpdateScreen::OnWaitForRebootTimeElapsed); | 151 &UpdateScreen::OnWaitForRebootTimeElapsed); |
| 140 } else { | 152 } else { |
| 141 ExitUpdate(REASON_UPDATE_NON_CRITICAL); | 153 ExitUpdate(REASON_UPDATE_NON_CRITICAL); |
| 142 } | 154 } |
| 143 break; | 155 break; |
| 144 case UPDATE_STATUS_IDLE: | 156 case UPDATE_STATUS_IDLE: |
| 145 case UPDATE_STATUS_ERROR: | 157 case UPDATE_STATUS_ERROR: |
| 146 case UPDATE_STATUS_REPORTING_ERROR_EVENT: | 158 case UPDATE_STATUS_REPORTING_ERROR_EVENT: |
| 147 ExitUpdate(REASON_UPDATE_ENDED); | 159 ExitUpdate(REASON_UPDATE_ENDED); |
| 148 break; | 160 break; |
| 149 default: | 161 default: |
| 150 NOTREACHED(); | 162 NOTREACHED(); |
| 151 break; | 163 break; |
| 152 } | 164 } |
| 153 } | 165 } |
| 154 | 166 |
| 155 namespace { | |
| 156 // Invoked from call to RequestUpdateCheck upon completion of the DBus call. | |
| 157 void StartUpdateCallback(void* user_data, | |
| 158 UpdateResult result, | |
| 159 const char* msg) { | |
| 160 if (result != UPDATE_RESULT_SUCCESS) { | |
| 161 DCHECK(user_data); | |
| 162 UpdateScreen* screen = static_cast<UpdateScreen*>(user_data); | |
| 163 if (UpdateScreen::HasInstance(screen)) | |
| 164 screen->ExitUpdate(UpdateScreen::REASON_UPDATE_INIT_FAILED); | |
| 165 } | |
| 166 } | |
| 167 } // namespace | |
| 168 | |
| 169 void UpdateScreen::StartUpdate() { | 167 void UpdateScreen::StartUpdate() { |
| 170 // Reset view if view was created. | |
| 171 if (view()) { | |
| 172 view()->Reset(); | |
| 173 view()->set_controller(this); | |
| 174 is_downloading_update_ = false; | |
| 175 view()->SetProgress(kBeforeUpdateCheckProgress); | |
| 176 } | |
| 177 | |
| 178 if (!CrosLibrary::Get()->EnsureLoaded()) { | 168 if (!CrosLibrary::Get()->EnsureLoaded()) { |
| 179 LOG(ERROR) << "Error loading CrosLibrary"; | 169 LOG(ERROR) << "Error loading CrosLibrary"; |
| 180 ExitUpdate(REASON_UPDATE_INIT_FAILED); | 170 ExitUpdate(REASON_UPDATE_INIT_FAILED); |
| 181 } else { | 171 } else { |
| 182 CrosLibrary::Get()->GetUpdateLibrary()->AddObserver(this); | 172 CrosLibrary::Get()->GetUpdateLibrary()->AddObserver(this); |
| 183 VLOG(1) << "Initiate update check"; | 173 VLOG(1) << "Initiate update check"; |
| 184 CrosLibrary::Get()->GetUpdateLibrary()->RequestUpdateCheck( | 174 CrosLibrary::Get()->GetUpdateLibrary()->RequestUpdateCheck( |
| 185 StartUpdateCallback, this); | 175 StartUpdateCallback, this); |
| 186 } | 176 } |
| 187 } | 177 } |
| 188 | 178 |
| 189 void UpdateScreen::CancelUpdate() { | 179 void UpdateScreen::CancelUpdate() { |
| 190 // Screen has longer lifetime than it's view. | 180 ExitUpdate(REASON_UPDATE_CANCELED); |
| 191 // View is deleted after wizard proceeds to the next screen. | |
| 192 if (view()) | |
| 193 ExitUpdate(REASON_UPDATE_CANCELED); | |
| 194 } | 181 } |
| 195 | 182 |
| 196 void UpdateScreen::Show() { | 183 void UpdateScreen::Show() { |
| 197 DefaultViewScreen<UpdateView>::Show(); | 184 is_shown_ = true; |
| 198 view()->set_controller(this); | 185 actor_->Show(); |
| 199 is_downloading_update_ = false; | 186 actor_->SetProgress(kBeforeUpdateCheckProgress); |
| 200 view()->SetProgress(kBeforeUpdateCheckProgress); | 187 } |
| 188 |
| 189 void UpdateScreen::Hide() { |
| 190 actor_->Hide(); |
| 191 is_shown_ = false; |
| 192 } |
| 193 |
| 194 gfx::Size UpdateScreen::GetScreenSize() const { |
| 195 return gfx::Size(kUpdateScreenWidth, kUpdateScreenHeight); |
| 201 } | 196 } |
| 202 | 197 |
| 203 void UpdateScreen::ExitUpdate(UpdateScreen::ExitReason reason) { | 198 void UpdateScreen::ExitUpdate(UpdateScreen::ExitReason reason) { |
| 204 ScreenObserver* observer = delegate()->GetObserver(this); | 199 ScreenObserver* observer = delegate()->GetObserver(this); |
| 205 if (CrosLibrary::Get()->EnsureLoaded()) | 200 if (CrosLibrary::Get()->EnsureLoaded()) |
| 206 CrosLibrary::Get()->GetUpdateLibrary()->RemoveObserver(this); | 201 CrosLibrary::Get()->GetUpdateLibrary()->RemoveObserver(this); |
| 207 | 202 |
| 208 switch(reason) { | 203 switch (reason) { |
| 209 case REASON_UPDATE_CANCELED: | 204 case REASON_UPDATE_CANCELED: |
| 210 observer->OnExit(ScreenObserver::UPDATE_NOUPDATE); | 205 observer->OnExit(ScreenObserver::UPDATE_NOUPDATE); |
| 211 break; | 206 break; |
| 212 case REASON_UPDATE_INIT_FAILED: | 207 case REASON_UPDATE_INIT_FAILED: |
| 213 observer->OnExit(ScreenObserver::UPDATE_ERROR_CHECKING_FOR_UPDATE); | 208 observer->OnExit(ScreenObserver::UPDATE_ERROR_CHECKING_FOR_UPDATE); |
| 214 break; | 209 break; |
| 215 case REASON_UPDATE_NON_CRITICAL: | 210 case REASON_UPDATE_NON_CRITICAL: |
| 216 case REASON_UPDATE_ENDED: | 211 case REASON_UPDATE_ENDED: |
| 217 { | 212 { |
| 218 UpdateLibrary* update_library = CrosLibrary::Get()->GetUpdateLibrary(); | 213 UpdateLibrary* update_library = CrosLibrary::Get()->GetUpdateLibrary(); |
| 219 switch (update_library->status().status) { | 214 switch (update_library->status().status) { |
| 220 case UPDATE_STATUS_UPDATE_AVAILABLE: | 215 case UPDATE_STATUS_UPDATE_AVAILABLE: |
| 221 case UPDATE_STATUS_UPDATED_NEED_REBOOT: | 216 case UPDATE_STATUS_UPDATED_NEED_REBOOT: |
| 222 case UPDATE_STATUS_DOWNLOADING: | 217 case UPDATE_STATUS_DOWNLOADING: |
| 223 case UPDATE_STATUS_FINALIZING: | 218 case UPDATE_STATUS_FINALIZING: |
| 224 case UPDATE_STATUS_VERIFYING: | 219 case UPDATE_STATUS_VERIFYING: |
| 225 DCHECK(!HasCriticalUpdate()); | 220 DCHECK(!HasCriticalUpdate()); |
| 226 // Noncritical update, just exit screen as if there is no update. | 221 // Noncritical update, just exit screen as if there is no update. |
| 227 // no break | 222 // no break |
| 228 case UPDATE_STATUS_IDLE: | 223 case UPDATE_STATUS_IDLE: |
| 229 observer->OnExit(ScreenObserver::UPDATE_NOUPDATE); | 224 observer->OnExit(ScreenObserver::UPDATE_NOUPDATE); |
| 230 break; | 225 break; |
| 231 case UPDATE_STATUS_ERROR: | 226 case UPDATE_STATUS_ERROR: |
| 232 case UPDATE_STATUS_REPORTING_ERROR_EVENT: | 227 case UPDATE_STATUS_REPORTING_ERROR_EVENT: |
| 233 observer->OnExit(checking_for_update_ ? | 228 observer->OnExit(is_checking_for_update_ ? |
| 234 ScreenObserver::UPDATE_ERROR_CHECKING_FOR_UPDATE : | 229 ScreenObserver::UPDATE_ERROR_CHECKING_FOR_UPDATE : |
| 235 ScreenObserver::UPDATE_ERROR_UPDATING); | 230 ScreenObserver::UPDATE_ERROR_UPDATING); |
| 236 break; | 231 break; |
| 237 default: | 232 default: |
| 238 NOTREACHED(); | 233 NOTREACHED(); |
| 239 } | 234 } |
| 240 } | 235 } |
| 241 break; | 236 break; |
| 242 default: | 237 default: |
| 243 NOTREACHED(); | 238 NOTREACHED(); |
| 244 } | 239 } |
| 245 } | 240 } |
| 246 | 241 |
| 247 void UpdateScreen::OnWaitForRebootTimeElapsed() { | 242 void UpdateScreen::OnWaitForRebootTimeElapsed() { |
| 248 LOG(ERROR) << "Unable to reboot - asking user for a manual reboot."; | 243 LOG(ERROR) << "Unable to reboot - asking user for a manual reboot."; |
| 249 MakeSureScreenIsShown(); | 244 MakeSureScreenIsShown(); |
| 250 view()->ShowManualRebootInfo(); | 245 actor_->ShowManualRebootInfo(); |
| 251 } | 246 } |
| 252 | 247 |
| 253 void UpdateScreen::MakeSureScreenIsShown() { | 248 void UpdateScreen::MakeSureScreenIsShown() { |
| 254 if (!view()) { | 249 if (!is_shown_) |
| 255 delegate()->ShowCurrentScreen(); | 250 delegate()->ShowCurrentScreen(); |
| 256 } | |
| 257 } | 251 } |
| 258 | 252 |
| 259 void UpdateScreen::SetRebootCheckDelay(int seconds) { | 253 void UpdateScreen::SetRebootCheckDelay(int seconds) { |
| 260 if (seconds <= 0) | 254 if (seconds <= 0) |
| 261 reboot_timer_.Stop(); | 255 reboot_timer_.Stop(); |
| 262 DCHECK(!reboot_timer_.IsRunning()); | 256 DCHECK(!reboot_timer_.IsRunning()); |
| 263 reboot_check_delay_ = seconds; | 257 reboot_check_delay_ = seconds; |
| 264 } | 258 } |
| 265 | 259 |
| 266 bool UpdateScreen::HasCriticalUpdate() { | 260 bool UpdateScreen::HasCriticalUpdate() { |
| 267 if (is_all_updates_critical_) | 261 if (is_ignore_update_deadlines_) |
| 268 return true; | 262 return true; |
| 269 | 263 |
| 270 std::string deadline; | 264 std::string deadline; |
| 271 // Checking for update flag file causes us to do blocking IO on UI thread. | 265 // Checking for update flag file causes us to do blocking IO on UI thread. |
| 272 // Temporarily allow it until we fix http://crosbug.com/11106 | 266 // Temporarily allow it until we fix http://crosbug.com/11106 |
| 273 base::ThreadRestrictions::ScopedAllowIO allow_io; | 267 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 274 FilePath update_deadline_file_path(kUpdateDeadlineFile); | 268 FilePath update_deadline_file_path(kUpdateDeadlineFile); |
| 275 if (!file_util::ReadFileToString(update_deadline_file_path, &deadline) || | 269 if (!file_util::ReadFileToString(update_deadline_file_path, &deadline) || |
| 276 deadline.empty()) { | 270 deadline.empty()) { |
| 277 return false; | 271 return false; |
| 278 } | 272 } |
| 279 | 273 |
| 280 // TODO(dpolukhin): Analyze file content. Now we can just assume that | 274 // TODO(dpolukhin): Analyze file content. Now we can just assume that |
| 281 // if the file exists and not empty, there is critical update. | 275 // if the file exists and not empty, there is critical update. |
| 282 return true; | 276 return true; |
| 283 } | 277 } |
| 284 | 278 |
| 285 void UpdateScreen::SetAllUpdatesCritical(bool is_critical) { | |
| 286 is_all_updates_critical_ = is_critical; | |
| 287 } | |
| 288 | |
| 289 } // namespace chromeos | 279 } // namespace chromeos |
| OLD | NEW |