| 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/cros/burn_library.h" | 5 #include "chrome/browser/chromeos/cros/burn_library.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| 11 #include "chrome/browser/chromeos/cros/cros_library.h" | 11 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 12 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
| 12 #include "chrome/common/zip.h" | 13 #include "chrome/common/zip.h" |
| 13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 14 | 15 |
| 15 using content::BrowserThread; | 16 using content::BrowserThread; |
| 16 | 17 |
| 17 namespace chromeos { | 18 namespace chromeos { |
| 18 | 19 |
| 19 class BurnLibraryImpl : public BurnLibrary, | 20 class BurnLibraryImpl : public BurnLibrary, |
| 20 public base::SupportsWeakPtr<BurnLibraryImpl> { | 21 public base::SupportsWeakPtr<BurnLibraryImpl> { |
| 21 public: | 22 public: |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 if (cancelled_) { | 179 if (cancelled_) { |
| 179 cancelled_ = false; | 180 cancelled_ = false; |
| 180 return; | 181 return; |
| 181 } | 182 } |
| 182 | 183 |
| 183 if (!success) | 184 if (!success) |
| 184 return; | 185 return; |
| 185 | 186 |
| 186 burning_ = true; | 187 burning_ = true; |
| 187 | 188 |
| 188 chromeos::CrosLibrary::Get()->GetMountLibrary()->UnmountDeviceRecursive( | 189 chromeos::DBusThreadManager::Get()->GetCrosDisksClient()-> |
| 189 target_device_path_.c_str(), &BurnLibraryImpl::DevicesUnmountedCallback, | 190 UnmountDeviceRecursive(target_device_path_.c_str(), |
| 190 this); | 191 &BurnLibraryImpl::DevicesUnmountedCallback, |
| 192 this); |
| 191 } | 193 } |
| 192 | 194 |
| 193 void BurnLibraryImpl::DevicesUnmountedCallback(void* object, bool success) { | 195 void BurnLibraryImpl::DevicesUnmountedCallback(void* object, bool success) { |
| 194 DCHECK(object); | 196 DCHECK(object); |
| 195 BurnLibraryImpl* self = static_cast<BurnLibraryImpl*>(object); | 197 BurnLibraryImpl* self = static_cast<BurnLibraryImpl*>(object); |
| 196 if (success) { | 198 if (success) { |
| 197 self->BurnImage(); | 199 self->BurnImage(); |
| 198 } else { | 200 } else { |
| 199 self->UpdateBurnStatus(ImageBurnStatus(self->target_file_path_.c_str(), | 201 self->UpdateBurnStatus(ImageBurnStatus(self->target_file_path_.c_str(), |
| 200 0, 0, "Error unmounting device"), BURN_FAIL); | 202 0, 0, "Error unmounting device"), BURN_FAIL); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 BurnLibrary* impl; | 277 BurnLibrary* impl; |
| 276 if (stub) | 278 if (stub) |
| 277 impl = new BurnLibraryStubImpl(); | 279 impl = new BurnLibraryStubImpl(); |
| 278 else | 280 else |
| 279 impl = new BurnLibraryImpl(); | 281 impl = new BurnLibraryImpl(); |
| 280 impl->Init(); | 282 impl->Init(); |
| 281 return impl; | 283 return impl; |
| 282 } | 284 } |
| 283 | 285 |
| 284 } // namespace chromeos | 286 } // namespace chromeos |
| OLD | NEW |