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 <int source> |
15 const ProvidedFileSystemInfo& file_system_info, | 15 Unmount<source>::Unmount( |
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) { |
18 } | 20 } |
19 | 21 |
20 Unmount::~Unmount() { | 22 template <int source> |
| 23 Unmount<source>::~Unmount() { |
21 } | 24 } |
22 | 25 |
23 bool Unmount::Execute(int request_id) { | 26 template <int source> |
| 27 bool Unmount<source>::Execute(int request_id) { |
24 using extensions::api::file_system_provider::UnmountRequestedOptions; | 28 using extensions::api::file_system_provider::UnmountRequestedOptions; |
25 | 29 |
26 UnmountRequestedOptions options; | 30 UnmountRequestedOptions 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::OnUnmountRequested::kEventName, | 36 extensions::api::file_system_provider::OnUnmountRequested::kEventName, |
33 extensions::api::file_system_provider::OnUnmountRequested::Create( | 37 extensions::api::file_system_provider::OnUnmountRequested::Create( |
34 options)); | 38 options)); |
35 } | 39 } |
36 | 40 |
37 void Unmount::OnSuccess(int /* request_id */, | 41 template <int source> |
38 scoped_ptr<RequestValue> /* result */, | 42 void Unmount<source>::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 Unmount::OnError(int /* request_id */, | 48 template <int source> |
44 scoped_ptr<RequestValue> /* result */, | 49 void Unmount<source>::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 template class Unmount<Source_Type::extension>; |
| 56 template class Unmount<Source_Type::plugin>; |
| 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 |