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 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "content/public/browser/render_frame_host.h" | 11 #include "content/public/browser/render_frame_host.h" |
12 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
13 | 13 |
14 namespace image_writer_api = extensions::api::image_writer_private; | 14 namespace image_writer_api = extensions::api::image_writer_private; |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 | 17 |
18 ImageWriterPrivateWriteFromUrlFunction:: | 18 ImageWriterPrivateWriteFromUrlFunction:: |
19 ImageWriterPrivateWriteFromUrlFunction() { | 19 ImageWriterPrivateWriteFromUrlFunction() { |
20 } | 20 } |
21 | 21 |
22 ImageWriterPrivateWriteFromUrlFunction:: | 22 ImageWriterPrivateWriteFromUrlFunction:: |
23 ~ImageWriterPrivateWriteFromUrlFunction() { | 23 ~ImageWriterPrivateWriteFromUrlFunction() { |
24 } | 24 } |
25 | 25 |
26 bool ImageWriterPrivateWriteFromUrlFunction::RunAsync() { | 26 bool ImageWriterPrivateWriteFromUrlFunction::RunAsync() { |
27 scoped_ptr<image_writer_api::WriteFromUrl::Params> params( | 27 std::unique_ptr<image_writer_api::WriteFromUrl::Params> params( |
28 image_writer_api::WriteFromUrl::Params::Create(*args_)); | 28 image_writer_api::WriteFromUrl::Params::Create(*args_)); |
29 EXTENSION_FUNCTION_VALIDATE(params.get()); | 29 EXTENSION_FUNCTION_VALIDATE(params.get()); |
30 | 30 |
31 GURL url(params->image_url); | 31 GURL url(params->image_url); |
32 if (!url.is_valid()) { | 32 if (!url.is_valid()) { |
33 error_ = image_writer::error::kUrlInvalid; | 33 error_ = image_writer::error::kUrlInvalid; |
34 return false; | 34 return false; |
35 } | 35 } |
36 | 36 |
37 std::string hash; | 37 std::string hash; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 ImageWriterPrivateDestroyPartitionsFunction:: | 128 ImageWriterPrivateDestroyPartitionsFunction:: |
129 ImageWriterPrivateDestroyPartitionsFunction() { | 129 ImageWriterPrivateDestroyPartitionsFunction() { |
130 } | 130 } |
131 | 131 |
132 ImageWriterPrivateDestroyPartitionsFunction:: | 132 ImageWriterPrivateDestroyPartitionsFunction:: |
133 ~ImageWriterPrivateDestroyPartitionsFunction() { | 133 ~ImageWriterPrivateDestroyPartitionsFunction() { |
134 } | 134 } |
135 | 135 |
136 bool ImageWriterPrivateDestroyPartitionsFunction::RunAsync() { | 136 bool ImageWriterPrivateDestroyPartitionsFunction::RunAsync() { |
137 scoped_ptr<image_writer_api::DestroyPartitions::Params> params( | 137 std::unique_ptr<image_writer_api::DestroyPartitions::Params> params( |
138 image_writer_api::DestroyPartitions::Params::Create(*args_)); | 138 image_writer_api::DestroyPartitions::Params::Create(*args_)); |
139 EXTENSION_FUNCTION_VALIDATE(params.get()); | 139 EXTENSION_FUNCTION_VALIDATE(params.get()); |
140 | 140 |
141 image_writer::OperationManager::Get(GetProfile())->DestroyPartitions( | 141 image_writer::OperationManager::Get(GetProfile())->DestroyPartitions( |
142 extension_id(), | 142 extension_id(), |
143 params->storage_unit_id, | 143 params->storage_unit_id, |
144 base::Bind( | 144 base::Bind( |
145 &ImageWriterPrivateDestroyPartitionsFunction::OnDestroyComplete, | 145 &ImageWriterPrivateDestroyPartitionsFunction::OnDestroyComplete, |
146 this)); | 146 this)); |
147 return true; | 147 return true; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 image_writer_api::ListRemovableStorageDevices::Results::Create( | 181 image_writer_api::ListRemovableStorageDevices::Results::Create( |
182 device_list.get()->data); | 182 device_list.get()->data); |
183 SendResponse(true); | 183 SendResponse(true); |
184 } else { | 184 } else { |
185 error_ = image_writer::error::kDeviceListError; | 185 error_ = image_writer::error::kDeviceListError; |
186 SendResponse(false); | 186 SendResponse(false); |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 } // namespace extensions | 190 } // namespace extensions |
OLD | NEW |