| 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" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 virtual ~BurnControllerImpl() { | 57 virtual ~BurnControllerImpl() { |
| 58 CrosLibrary::Get()->GetBurnLibrary()->RemoveObserver(this); | 58 CrosLibrary::Get()->GetBurnLibrary()->RemoveObserver(this); |
| 59 if (state_machine_) | 59 if (state_machine_) |
| 60 state_machine_->RemoveObserver(this); | 60 state_machine_->RemoveObserver(this); |
| 61 burn_manager_->RemoveObserver(this); | 61 burn_manager_->RemoveObserver(this); |
| 62 CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this); | 62 CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this); |
| 63 disks::DiskMountManager::GetInstance()->RemoveObserver(this); | 63 disks::DiskMountManager::GetInstance()->RemoveObserver(this); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // disks::DiskMountManager::Observer interface. | 66 // disks::DiskMountManager::Observer interface. |
| 67 virtual void DiskChanged(disks::DiskMountManagerEventType event, | 67 virtual void OnDiskEvent(disks::DiskMountManager::DiskEvent event, |
| 68 const disks::DiskMountManager::Disk* disk) | 68 const disks::DiskMountManager::Disk* disk) OVERRIDE { |
| 69 OVERRIDE { | |
| 70 if (!IsBurnableDevice(*disk)) | 69 if (!IsBurnableDevice(*disk)) |
| 71 return; | 70 return; |
| 72 if (event == disks::MOUNT_DISK_ADDED) { | 71 if (event == disks::DiskMountManager::DISK_ADDED) { |
| 73 delegate_->OnDeviceAdded(*disk); | 72 delegate_->OnDeviceAdded(*disk); |
| 74 } else if (event == disks::MOUNT_DISK_REMOVED) { | 73 } else if (event == disks::DiskMountManager::DISK_REMOVED) { |
| 75 delegate_->OnDeviceRemoved(*disk); | 74 delegate_->OnDeviceRemoved(*disk); |
| 76 if (burn_manager_->target_device_path().value() == disk->device_path()) | 75 if (burn_manager_->target_device_path().value() == disk->device_path()) |
| 77 ProcessError(IDS_IMAGEBURN_DEVICE_NOT_FOUND_ERROR); | 76 ProcessError(IDS_IMAGEBURN_DEVICE_NOT_FOUND_ERROR); |
| 78 } | 77 } |
| 79 } | 78 } |
| 80 | 79 |
| 81 virtual void DeviceChanged(disks::DiskMountManagerEventType event, | 80 virtual void OnDeviceEvent(disks::DiskMountManager::DeviceEvent event, |
| 82 const std::string& device_path) OVERRIDE { | 81 const std::string& device_path) OVERRIDE { |
| 83 } | 82 } |
| 84 | 83 |
| 85 virtual void MountCompleted( | 84 virtual void OnMountEvent( |
| 86 disks::DiskMountManager::MountEvent event_type, | 85 disks::DiskMountManager::MountEvent event, |
| 87 MountError error_code, | 86 MountError error_code, |
| 88 const disks::DiskMountManager::MountPointInfo& mount_info) | 87 const disks::DiskMountManager::MountPointInfo& mount_info) OVERRIDE { |
| 89 OVERRIDE { | 88 } |
| 89 |
| 90 virtual void OnFormatEvent( |
| 91 disks::DiskMountManager::FormatEvent event, |
| 92 FormatError error_code, |
| 93 const std::string& device_path) OVERRIDE { |
| 90 } | 94 } |
| 91 | 95 |
| 92 // BurnLibrary::Observer interface. | 96 // BurnLibrary::Observer interface. |
| 93 virtual void BurnProgressUpdated(BurnLibrary* object, | 97 virtual void BurnProgressUpdated(BurnLibrary* object, |
| 94 BurnEvent evt, | 98 BurnEvent evt, |
| 95 const ImageBurnStatus& status) OVERRIDE { | 99 const ImageBurnStatus& status) OVERRIDE { |
| 96 switch (evt) { | 100 switch (evt) { |
| 97 case(BURN_SUCCESS): | 101 case(BURN_SUCCESS): |
| 98 FinalizeBurn(); | 102 FinalizeBurn(); |
| 99 break; | 103 break; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 362 |
| 359 // static | 363 // static |
| 360 BurnController* BurnController::CreateBurnController( | 364 BurnController* BurnController::CreateBurnController( |
| 361 content::WebContents* web_contents, | 365 content::WebContents* web_contents, |
| 362 Delegate* delegate) { | 366 Delegate* delegate) { |
| 363 return new BurnControllerImpl(delegate); | 367 return new BurnControllerImpl(delegate); |
| 364 } | 368 } |
| 365 | 369 |
| 366 } // namespace imageburner | 370 } // namespace imageburner |
| 367 } // namespace chromeos | 371 } // namespace chromeos |
| OLD | NEW |