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 image_writer::OperationManager::Get(GetProfile())->DestroyPartitions( | 154 SendResponse(true); |
155 extension_id(), | |
156 params->storage_unit_id, | |
157 base::Bind( | |
158 &ImageWriterPrivateDestroyPartitionsFunction::OnDestroyComplete, | |
159 this)); | |
160 return true; | 155 return true; |
161 } | 156 } |
162 | 157 |
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 | |
173 ImageWriterPrivateListRemovableStorageDevicesFunction:: | 158 ImageWriterPrivateListRemovableStorageDevicesFunction:: |
174 ImageWriterPrivateListRemovableStorageDevicesFunction() { | 159 ImageWriterPrivateListRemovableStorageDevicesFunction() { |
175 } | 160 } |
176 | 161 |
177 ImageWriterPrivateListRemovableStorageDevicesFunction:: | 162 ImageWriterPrivateListRemovableStorageDevicesFunction:: |
178 ~ImageWriterPrivateListRemovableStorageDevicesFunction() { | 163 ~ImageWriterPrivateListRemovableStorageDevicesFunction() { |
179 } | 164 } |
180 | 165 |
181 bool ImageWriterPrivateListRemovableStorageDevicesFunction::RunImpl() { | 166 bool ImageWriterPrivateListRemovableStorageDevicesFunction::RunImpl() { |
182 RemovableStorageProvider::GetAllDevices( | 167 RemovableStorageProvider::GetAllDevices( |
(...skipping 11 matching lines...) Expand all Loading... |
194 image_writer_api::ListRemovableStorageDevices::Results::Create( | 179 image_writer_api::ListRemovableStorageDevices::Results::Create( |
195 device_list.get()->data); | 180 device_list.get()->data); |
196 SendResponse(true); | 181 SendResponse(true); |
197 } else { | 182 } else { |
198 error_ = image_writer::error::kDeviceListError; | 183 error_ = image_writer::error::kDeviceListError; |
199 SendResponse(false); | 184 SendResponse(false); |
200 } | 185 } |
201 } | 186 } |
202 | 187 |
203 } // namespace extensions | 188 } // namespace extensions |
OLD | NEW |