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 <class DestinationPolicy> |
15 const ProvidedFileSystemInfo& file_system_info, | 15 Configure<DestinationPolicy>::Configure( |
16 const storage::AsyncFileUtil::StatusCallback& callback) | 16 typename DestinationPolicy::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<DestinationPolicy>(event_router, file_system_info), |
| 20 callback_(callback) { |
| 21 } |
| 22 template <class DestinationPolicy> |
| 23 Configure<DestinationPolicy>::~Configure() { |
18 } | 24 } |
19 | 25 |
20 Configure::~Configure() { | 26 template <class DestinationPolicy> |
21 } | 27 bool Configure<DestinationPolicy>::Execute(int request_id) { |
22 | |
23 bool Configure::Execute(int request_id) { | |
24 using extensions::api::file_system_provider::ConfigureRequestedOptions; | 28 using extensions::api::file_system_provider::ConfigureRequestedOptions; |
25 | 29 |
26 ConfigureRequestedOptions options; | 30 ConfigureRequestedOptions options; |
27 options.file_system_id = file_system_info_.file_system_id(); | 31 options.file_system_id = this->file_system_info_.file_system_id(); |
28 options.request_id = request_id; | 32 options.request_id = request_id; |
29 | 33 |
30 return SendEvent( | 34 return this->SendEvent( |
31 request_id, | 35 request_id, |
32 extensions::api::file_system_provider::OnConfigureRequested::kEventName, | 36 extensions::api::file_system_provider::OnConfigureRequested::kEventName, |
33 extensions::api::file_system_provider::OnConfigureRequested::Create( | 37 extensions::api::file_system_provider::OnConfigureRequested::Create( |
34 options)); | 38 options)); |
35 } | 39 } |
36 | 40 |
37 void Configure::OnSuccess(int /* request_id */, | 41 template <class DestinationPolicy> |
38 scoped_ptr<RequestValue> /* result */, | 42 void Configure<DestinationPolicy>::OnSuccess(int /* request_id */, |
39 bool /* has_more */) { | 43 scoped_ptr<RequestValue> /* result */, |
| 44 bool /* has_more */) { |
40 callback_.Run(base::File::FILE_OK); | 45 callback_.Run(base::File::FILE_OK); |
41 } | 46 } |
42 | 47 |
43 void Configure::OnError(int /* request_id */, | 48 template <class DestinationPolicy> |
44 scoped_ptr<RequestValue> /* result */, | 49 void Configure<DestinationPolicy>::OnError(int /* request_id */, |
45 base::File::Error error) { | 50 scoped_ptr<RequestValue> /* result */, |
| 51 base::File::Error error) { |
46 callback_.Run(error); | 52 callback_.Run(error); |
47 } | 53 } |
48 | 54 |
| 55 FOR_EACH_DESTINATION_SPECIALIZE(Configure) |
| 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 |