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/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 "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
10 #include "chrome/browser/chromeos/login/screen_observer.h" | 11 #include "chrome/browser/chromeos/login/screen_observer.h" |
11 #include "chrome/browser/chromeos/login/update_view.h" | 12 #include "chrome/browser/chromeos/login/update_view.h" |
12 #include "chrome/browser/chromeos/login/wizard_controller.h" | 13 #include "chrome/browser/chromeos/login/wizard_controller.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // Progress bar stages. Each represents progress bar value | 17 // Progress bar stages. Each represents progress bar value |
17 // at the beginning of each stage. | 18 // at the beginning of each stage. |
18 // TODO(nkostylev): Base stage progress values on approximate time. | 19 // TODO(nkostylev): Base stage progress values on approximate time. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 reboot_timer_.Stop(); | 202 reboot_timer_.Stop(); |
202 DCHECK(!reboot_timer_.IsRunning()); | 203 DCHECK(!reboot_timer_.IsRunning()); |
203 reboot_check_delay_ = seconds; | 204 reboot_check_delay_ = seconds; |
204 } | 205 } |
205 | 206 |
206 bool UpdateScreen::HasCriticalUpdate() { | 207 bool UpdateScreen::HasCriticalUpdate() { |
207 if (is_all_updates_critical_) | 208 if (is_all_updates_critical_) |
208 return true; | 209 return true; |
209 | 210 |
210 std::string deadline; | 211 std::string deadline; |
| 212 // Checking for update flag file causes us to do blocking IO on UI thread. |
| 213 // Temporarily allow it until we fix http://crosbug.com/11106 |
| 214 base::ThreadRestrictions::ScopedAllowIO allow_io; |
211 FilePath update_deadline_file_path(kUpdateDeadlineFile); | 215 FilePath update_deadline_file_path(kUpdateDeadlineFile); |
212 if (!file_util::ReadFileToString(update_deadline_file_path, &deadline) || | 216 if (!file_util::ReadFileToString(update_deadline_file_path, &deadline) || |
213 deadline.empty()) { | 217 deadline.empty()) { |
214 return false; | 218 return false; |
215 } | 219 } |
216 | 220 |
217 // TODO(dpolukhin): Analyze file content. Now we can just assume that | 221 // TODO(dpolukhin): Analyze file content. Now we can just assume that |
218 // if the file exists and not empty, there is critical update. | 222 // if the file exists and not empty, there is critical update. |
219 return true; | 223 return true; |
220 } | 224 } |
221 | 225 |
222 void UpdateScreen::SetAllUpdatesCritical(bool is_critical) { | 226 void UpdateScreen::SetAllUpdatesCritical(bool is_critical) { |
223 is_all_updates_critical_ = is_critical; | 227 is_all_updates_critical_ = is_critical; |
224 } | 228 } |
225 | 229 |
226 } // namespace chromeos | 230 } // namespace chromeos |
OLD | NEW |