OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/file_system_provider/operations/configure.h" | 5 #include "chrome/browser/chromeos/file_system_provider/operations/configure.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/common/extensions/api/file_system_provider.h" | 8 #include "chrome/common/extensions/api/file_system_provider.h" |
9 | 9 |
10 namespace chromeos { | 10 namespace chromeos { |
11 namespace file_system_provider { | 11 namespace file_system_provider { |
12 namespace operations { | 12 namespace operations { |
13 | 13 |
14 Configure::Configure(extensions::EventRouter* event_router, | 14 template <int source> |
15 const ProvidedFileSystemInfo& file_system_info, | 15 Configure<source>::Configure( |
16 const storage::AsyncFileUtil::StatusCallback& callback) | 16 typename Operation<source>::EventRouterType* event_router, |
17 : Operation(event_router, file_system_info), callback_(callback) { | 17 const ProvidedFileSystemInfo& file_system_info, |
| 18 const storage::AsyncFileUtil::StatusCallback& callback) |
| 19 : Operation<source>(event_router, file_system_info), callback_(callback) { |
| 20 } |
| 21 template <int source> |
| 22 Configure<source>::~Configure() { |
18 } | 23 } |
19 | 24 |
20 Configure::~Configure() { | 25 template <int source> |
21 } | 26 bool Configure<source>::Execute(int request_id) { |
22 | |
23 bool Configure::Execute(int request_id) { | |
24 using extensions::api::file_system_provider::ConfigureRequestedOptions; | 27 using extensions::api::file_system_provider::ConfigureRequestedOptions; |
25 | 28 |
26 ConfigureRequestedOptions options; | 29 ConfigureRequestedOptions options; |
27 options.file_system_id = file_system_info_.file_system_id(); | 30 options.file_system_id = this->file_system_info_.file_system_id(); |
28 options.request_id = request_id; | 31 options.request_id = request_id; |
29 | 32 |
30 return SendEvent( | 33 return this->SendEvent( |
31 request_id, | 34 request_id, |
32 extensions::api::file_system_provider::OnConfigureRequested::kEventName, | 35 extensions::api::file_system_provider::OnConfigureRequested::kEventName, |
33 extensions::api::file_system_provider::OnConfigureRequested::Create( | 36 extensions::api::file_system_provider::OnConfigureRequested::Create( |
34 options)); | 37 options)); |
35 } | 38 } |
36 | 39 |
37 void Configure::OnSuccess(int /* request_id */, | 40 template <int source> |
38 scoped_ptr<RequestValue> /* result */, | 41 void Configure<source>::OnSuccess(int /* request_id */, |
39 bool /* has_more */) { | 42 scoped_ptr<RequestValue> /* result */, |
| 43 bool /* has_more */) { |
40 callback_.Run(base::File::FILE_OK); | 44 callback_.Run(base::File::FILE_OK); |
41 } | 45 } |
42 | 46 |
43 void Configure::OnError(int /* request_id */, | 47 template <int source> |
44 scoped_ptr<RequestValue> /* result */, | 48 void Configure<source>::OnError(int /* request_id */, |
45 base::File::Error error) { | 49 scoped_ptr<RequestValue> /* result */, |
| 50 base::File::Error error) { |
46 callback_.Run(error); | 51 callback_.Run(error); |
47 } | 52 } |
48 | 53 |
| 54 template class Configure<Source_Type::extension>; |
| 55 template class Configure<Source_Type::plugin>; |
| 56 |
49 } // namespace operations | 57 } // namespace operations |
50 } // namespace file_system_provider | 58 } // namespace file_system_provider |
51 } // namespace chromeos | 59 } // namespace chromeos |
OLD | NEW |