OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/unmount.h" | 5 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.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 Unmount::Unmount(extensions::EventRouter* event_router, | 14 template <class DestinationPolicy> |
15 const ProvidedFileSystemInfo& file_system_info, | 15 Unmount<DestinationPolicy>::Unmount( |
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) { |
18 } | 21 } |
19 | 22 |
20 Unmount::~Unmount() { | 23 template <class DestinationPolicy> |
| 24 Unmount<DestinationPolicy>::~Unmount() { |
21 } | 25 } |
22 | 26 |
23 bool Unmount::Execute(int request_id) { | 27 template <class DestinationPolicy> |
| 28 bool Unmount<DestinationPolicy>::Execute(int request_id) { |
24 using extensions::api::file_system_provider::UnmountRequestedOptions; | 29 using extensions::api::file_system_provider::UnmountRequestedOptions; |
25 | 30 |
26 UnmountRequestedOptions options; | 31 UnmountRequestedOptions options; |
27 options.file_system_id = file_system_info_.file_system_id(); | 32 options.file_system_id = this->file_system_info_.file_system_id(); |
28 options.request_id = request_id; | 33 options.request_id = request_id; |
29 | 34 |
30 return SendEvent( | 35 return this->SendEvent( |
31 request_id, | 36 request_id, |
32 extensions::api::file_system_provider::OnUnmountRequested::kEventName, | 37 extensions::api::file_system_provider::OnUnmountRequested::kEventName, |
33 extensions::api::file_system_provider::OnUnmountRequested::Create( | 38 extensions::api::file_system_provider::OnUnmountRequested::Create( |
34 options)); | 39 options)); |
35 } | 40 } |
36 | 41 |
37 void Unmount::OnSuccess(int /* request_id */, | 42 template <class DestinationPolicy> |
38 scoped_ptr<RequestValue> /* result */, | 43 void Unmount<DestinationPolicy>::OnSuccess(int /* request_id */, |
39 bool /* has_more */) { | 44 scoped_ptr<RequestValue> /* result */, |
| 45 bool /* has_more */) { |
40 callback_.Run(base::File::FILE_OK); | 46 callback_.Run(base::File::FILE_OK); |
41 } | 47 } |
42 | 48 |
43 void Unmount::OnError(int /* request_id */, | 49 template <class DestinationPolicy> |
44 scoped_ptr<RequestValue> /* result */, | 50 void Unmount<DestinationPolicy>::OnError(int /* request_id */, |
45 base::File::Error error) { | 51 scoped_ptr<RequestValue> /* result */, |
| 52 base::File::Error error) { |
46 callback_.Run(error); | 53 callback_.Run(error); |
47 } | 54 } |
48 | 55 |
| 56 FOR_EACH_DESTINATION_SPECIALIZE(Unmount) |
| 57 |
49 } // namespace operations | 58 } // namespace operations |
50 } // namespace file_system_provider | 59 } // namespace file_system_provider |
51 } // namespace chromeos | 60 } // namespace chromeos |
OLD | NEW |