OLD | NEW |
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/imageburner/burn_controller.h" | 5 #include "chrome/browser/chromeos/imageburner/burn_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/chromeos/cros/burn_library.h" | 10 #include "chrome/browser/chromeos/cros/burn_library.h" |
11 #include "chrome/browser/chromeos/cros/cros_library.h" | 11 #include "chrome/browser/chromeos/cros/cros_library.h" |
12 #include "chrome/browser/chromeos/cros/network_library.h" | 12 #include "chrome/browser/chromeos/cros/network_library.h" |
13 #include "chrome/browser/chromeos/imageburner/burn_manager.h" | 13 #include "chrome/browser/chromeos/imageburner/burn_manager.h" |
14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 | 16 |
17 namespace chromeos { | 17 namespace chromeos { |
18 namespace imageburner { | 18 namespace imageburner { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 const char kImageZipFileName[] = "chromeos_image.bin.zip"; | 22 const char kImageZipFileName[] = "chromeos_image.bin.zip"; |
23 | 23 |
24 // 3.9GB. It is less than 4GB because true device size ussually varies a little. | 24 // 3.9GB. It is less than 4GB because true device size ussually varies a little. |
25 const uint64 kMinDeviceSize = static_cast<uint64>(3.9 * 1000 * 1000 * 1000); | 25 const uint64 kMinDeviceSize = static_cast<uint64>(3.9 * 1000 * 1000 * 1000); |
26 | 26 |
27 // Returns true when |disk| is a device on which we can burn recovery image. | 27 // Returns true when |disk| is a device on which we can burn recovery image. |
28 bool IsBurnableDevice(const disks::DiskMountManager::Disk& disk) { | 28 bool IsBurnableDevice(const disks::DiskMountManager::Disk& disk) { |
29 return disk.is_parent() && !disk.on_boot_device() && | 29 return disk.is_parent() && !disk.on_boot_device() && disk.has_media() && |
30 (disk.device_type() == DEVICE_TYPE_USB || | 30 (disk.device_type() == DEVICE_TYPE_USB || |
31 disk.device_type() == DEVICE_TYPE_SD); | 31 disk.device_type() == DEVICE_TYPE_SD); |
32 } | 32 } |
33 | 33 |
34 class BurnControllerImpl | 34 class BurnControllerImpl |
35 : public BurnController, | 35 : public BurnController, |
36 public disks::DiskMountManager::Observer, | 36 public disks::DiskMountManager::Observer, |
37 public BurnLibrary::Observer, | 37 public BurnLibrary::Observer, |
38 public NetworkLibrary::NetworkManagerObserver, | 38 public NetworkLibrary::NetworkManagerObserver, |
39 public StateMachine::Observer, | 39 public StateMachine::Observer, |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 357 |
358 // static | 358 // static |
359 BurnController* BurnController::CreateBurnController( | 359 BurnController* BurnController::CreateBurnController( |
360 content::WebContents* web_contents, | 360 content::WebContents* web_contents, |
361 Delegate* delegate) { | 361 Delegate* delegate) { |
362 return new BurnControllerImpl(delegate); | 362 return new BurnControllerImpl(delegate); |
363 } | 363 } |
364 | 364 |
365 } // namespace imageburner | 365 } // namespace imageburner |
366 } // namespace chromeos | 366 } // namespace chromeos |
OLD | NEW |