OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" | 6 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
7 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" | 7 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" |
8 #include "chrome/browser/extensions/api/image_writer_private/image_writer_privat
e_api.h" | 8 #include "chrome/browser/extensions/api/image_writer_private/image_writer_privat
e_api.h" |
9 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" | 9 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" |
10 | 10 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 ImageWriterPrivateDestroyPartitionsFunction:: | 145 ImageWriterPrivateDestroyPartitionsFunction:: |
146 ~ImageWriterPrivateDestroyPartitionsFunction() { | 146 ~ImageWriterPrivateDestroyPartitionsFunction() { |
147 } | 147 } |
148 | 148 |
149 bool ImageWriterPrivateDestroyPartitionsFunction::RunImpl() { | 149 bool ImageWriterPrivateDestroyPartitionsFunction::RunImpl() { |
150 scoped_ptr<image_writer_api::DestroyPartitions::Params> params( | 150 scoped_ptr<image_writer_api::DestroyPartitions::Params> params( |
151 image_writer_api::DestroyPartitions::Params::Create(*args_)); | 151 image_writer_api::DestroyPartitions::Params::Create(*args_)); |
152 EXTENSION_FUNCTION_VALIDATE(params.get()); | 152 EXTENSION_FUNCTION_VALIDATE(params.get()); |
153 | 153 |
154 SendResponse(true); | 154 image_writer::OperationManager::Get(GetProfile())->DestroyPartitions( |
| 155 extension_id(), |
| 156 params->storage_unit_id, |
| 157 base::Bind( |
| 158 &ImageWriterPrivateDestroyPartitionsFunction::OnDestroyComplete, |
| 159 this)); |
155 return true; | 160 return true; |
156 } | 161 } |
157 | 162 |
| 163 void ImageWriterPrivateDestroyPartitionsFunction::OnDestroyComplete( |
| 164 bool success, |
| 165 const std::string& error) { |
| 166 if (!success) { |
| 167 error_ = error; |
| 168 } |
| 169 |
| 170 SendResponse(success); |
| 171 } |
| 172 |
158 ImageWriterPrivateListRemovableStorageDevicesFunction:: | 173 ImageWriterPrivateListRemovableStorageDevicesFunction:: |
159 ImageWriterPrivateListRemovableStorageDevicesFunction() { | 174 ImageWriterPrivateListRemovableStorageDevicesFunction() { |
160 } | 175 } |
161 | 176 |
162 ImageWriterPrivateListRemovableStorageDevicesFunction:: | 177 ImageWriterPrivateListRemovableStorageDevicesFunction:: |
163 ~ImageWriterPrivateListRemovableStorageDevicesFunction() { | 178 ~ImageWriterPrivateListRemovableStorageDevicesFunction() { |
164 } | 179 } |
165 | 180 |
166 bool ImageWriterPrivateListRemovableStorageDevicesFunction::RunImpl() { | 181 bool ImageWriterPrivateListRemovableStorageDevicesFunction::RunImpl() { |
167 RemovableStorageProvider::GetAllDevices( | 182 RemovableStorageProvider::GetAllDevices( |
(...skipping 11 matching lines...) Expand all Loading... |
179 image_writer_api::ListRemovableStorageDevices::Results::Create( | 194 image_writer_api::ListRemovableStorageDevices::Results::Create( |
180 device_list.get()->data); | 195 device_list.get()->data); |
181 SendResponse(true); | 196 SendResponse(true); |
182 } else { | 197 } else { |
183 error_ = image_writer::error::kDeviceListError; | 198 error_ = image_writer::error::kDeviceListError; |
184 SendResponse(false); | 199 SendResponse(false); |
185 } | 200 } |
186 } | 201 } |
187 | 202 |
188 } // namespace extensions | 203 } // namespace extensions |
OLD | NEW |