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 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_OPERATION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_OPERATION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" | 12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" |
13 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" | 13 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
14 #include "storage/browser/fileapi/async_file_util.h" | 14 #include "storage/browser/fileapi/async_file_util.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class ListValue; | 17 class ListValue; |
18 } // namespace base | 18 } // namespace base |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
21 struct Event; | 21 struct Event; |
22 class EventRouter; | |
23 } // namespace extensions | 22 } // namespace extensions |
24 | 23 |
25 namespace chromeos { | 24 namespace chromeos { |
26 namespace file_system_provider { | 25 namespace file_system_provider { |
27 namespace operations { | 26 namespace operations { |
28 | 27 |
29 // Base class for operation bridges between fileapi and providing extensions. | 28 // Base class for operation bridges between fileapi and providing extensions. |
30 class Operation : public RequestManager::HandlerInterface { | 29 template <int source> |
| 30 class Operation : public RequestManager::HandlerInterface, |
| 31 public Source_Traits<source> { |
31 public: | 32 public: |
| 33 typedef typename Source_Traits<source>::EventRouterType EventRouterType; |
32 typedef base::Callback<bool(scoped_ptr<extensions::Event> event)> | 34 typedef base::Callback<bool(scoped_ptr<extensions::Event> event)> |
33 DispatchEventImplCallback; | 35 DispatchEventImplCallback; |
34 | 36 |
35 Operation(extensions::EventRouter* event_router, | 37 Operation(typename Operation<source>::EventRouterType* event_router, |
36 const ProvidedFileSystemInfo& file_system_info); | 38 const ProvidedFileSystemInfo& file_system_info); |
37 ~Operation() override; | 39 ~Operation() override; |
38 | 40 |
39 // RequestManager::HandlerInterface overrides. | 41 // RequestManager::HandlerInterface overrides. |
40 bool Execute(int request_id) override = 0; | 42 bool Execute(int request_id) override = 0; |
41 void OnSuccess(int request_id, | 43 void OnSuccess(int request_id, |
42 scoped_ptr<RequestValue> result, | 44 scoped_ptr<RequestValue> result, |
43 bool has_more) override = 0; | 45 bool has_more) override = 0; |
44 void OnError(int request_id, | 46 void OnError(int request_id, |
45 scoped_ptr<RequestValue> result, | 47 scoped_ptr<RequestValue> result, |
(...skipping 15 matching lines...) Expand all Loading... |
61 private: | 63 private: |
62 DispatchEventImplCallback dispatch_event_impl_; | 64 DispatchEventImplCallback dispatch_event_impl_; |
63 DISALLOW_COPY_AND_ASSIGN(Operation); | 65 DISALLOW_COPY_AND_ASSIGN(Operation); |
64 }; | 66 }; |
65 | 67 |
66 } // namespace operations | 68 } // namespace operations |
67 } // namespace file_system_provider | 69 } // namespace file_system_provider |
68 } // namespace chromeos | 70 } // namespace chromeos |
69 | 71 |
70 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_OPERATION_H_ | 72 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_OPERATION_H_ |
OLD | NEW |