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_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H_ | 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H_ |
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H_ |
7 | 7 |
8 #include "chrome/browser/local_discovery/privet_device_resolver.h" | 8 #include "chrome/browser/local_discovery/privet_device_resolver.h" |
9 #include "chrome/browser/local_discovery/privet_http.h" | 9 #include "chrome/browser/local_discovery/privet_http.h" |
10 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h" | 10 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h" |
11 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" | 11 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" |
12 #include "chrome/browser/local_discovery/storage/path_util.h" | 12 #include "chrome/browser/local_discovery/storage/path_util.h" |
13 #include "chrome/browser/local_discovery/storage/privet_filesystem_attribute_cac
he.h" | 13 #include "chrome/browser/local_discovery/storage/privet_filesystem_attribute_cac
he.h" |
14 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 #include "net/url_request/url_request_context.h" | 16 #include "net/url_request/url_request_context.h" |
17 #include "webkit/browser/fileapi/async_file_util.h" | 17 #include "storage/browser/fileapi/async_file_util.h" |
18 #include "webkit/browser/fileapi/file_system_url.h" | 18 #include "storage/browser/fileapi/file_system_url.h" |
19 | 19 |
20 namespace local_discovery { | 20 namespace local_discovery { |
21 | 21 |
22 class PrivetFileSystemAsyncOperation { | 22 class PrivetFileSystemAsyncOperation { |
23 public: | 23 public: |
24 virtual ~PrivetFileSystemAsyncOperation() {} | 24 virtual ~PrivetFileSystemAsyncOperation() {} |
25 | 25 |
26 virtual void Start() = 0; | 26 virtual void Start() = 0; |
27 }; | 27 }; |
28 | 28 |
29 class PrivetFileSystemAsyncOperationContainer { | 29 class PrivetFileSystemAsyncOperationContainer { |
30 public: | 30 public: |
31 virtual ~PrivetFileSystemAsyncOperationContainer() {} | 31 virtual ~PrivetFileSystemAsyncOperationContainer() {} |
32 | 32 |
33 virtual void RemoveOperation( | 33 virtual void RemoveOperation( |
34 PrivetFileSystemAsyncOperation* operation) = 0; | 34 PrivetFileSystemAsyncOperation* operation) = 0; |
35 virtual void RemoveAllOperations() = 0; | 35 virtual void RemoveAllOperations() = 0; |
36 }; | 36 }; |
37 | 37 |
38 // This object is a counterpart to PrivetFileSystemAsyncUtil that lives on the | 38 // This object is a counterpart to PrivetFileSystemAsyncUtil that lives on the |
39 // UI thread. | 39 // UI thread. |
40 class PrivetFileSystemOperationFactory | 40 class PrivetFileSystemOperationFactory |
41 : public PrivetFileSystemAsyncOperationContainer { | 41 : public PrivetFileSystemAsyncOperationContainer { |
42 public: | 42 public: |
43 explicit PrivetFileSystemOperationFactory( | 43 explicit PrivetFileSystemOperationFactory( |
44 content::BrowserContext* browser_context); | 44 content::BrowserContext* browser_context); |
45 virtual ~PrivetFileSystemOperationFactory(); | 45 virtual ~PrivetFileSystemOperationFactory(); |
46 | 46 |
47 void GetFileInfo(const fileapi::FileSystemURL& url, | 47 void GetFileInfo(const storage::FileSystemURL& url, |
48 const fileapi::AsyncFileUtil::GetFileInfoCallback& callback); | 48 const storage::AsyncFileUtil::GetFileInfoCallback& callback); |
49 void ReadDirectory( | 49 void ReadDirectory( |
50 const fileapi::FileSystemURL& url, | 50 const storage::FileSystemURL& url, |
51 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback); | 51 const storage::AsyncFileUtil::ReadDirectoryCallback& callback); |
52 | 52 |
53 base::WeakPtr<PrivetFileSystemOperationFactory> GetWeakPtr() { | 53 base::WeakPtr<PrivetFileSystemOperationFactory> GetWeakPtr() { |
54 return weak_factory_.GetWeakPtr(); | 54 return weak_factory_.GetWeakPtr(); |
55 } | 55 } |
56 | 56 |
57 private: | 57 private: |
58 virtual void RemoveOperation(PrivetFileSystemAsyncOperation* operation) | 58 virtual void RemoveOperation(PrivetFileSystemAsyncOperation* operation) |
59 OVERRIDE; | 59 OVERRIDE; |
60 virtual void RemoveAllOperations() OVERRIDE; | 60 virtual void RemoveAllOperations() OVERRIDE; |
61 | 61 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 class PrivetFileSystemListOperation | 108 class PrivetFileSystemListOperation |
109 : public PrivetFileSystemAsyncOperationUtil::Delegate, | 109 : public PrivetFileSystemAsyncOperationUtil::Delegate, |
110 public local_discovery::PrivetFileSystemAsyncOperation { | 110 public local_discovery::PrivetFileSystemAsyncOperation { |
111 public: | 111 public: |
112 PrivetFileSystemListOperation( | 112 PrivetFileSystemListOperation( |
113 const base::FilePath& full_path, | 113 const base::FilePath& full_path, |
114 content::BrowserContext* browser_context, | 114 content::BrowserContext* browser_context, |
115 PrivetFileSystemAsyncOperationContainer* container, | 115 PrivetFileSystemAsyncOperationContainer* container, |
116 PrivetFileSystemAttributeCache* attribute_cache, | 116 PrivetFileSystemAttributeCache* attribute_cache, |
117 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback); | 117 const storage::AsyncFileUtil::ReadDirectoryCallback& callback); |
118 virtual ~PrivetFileSystemListOperation(); | 118 virtual ~PrivetFileSystemListOperation(); |
119 | 119 |
120 virtual void Start() OVERRIDE; | 120 virtual void Start() OVERRIDE; |
121 | 121 |
122 virtual void PrivetFileSystemResolved(PrivetV1HTTPClient* http_client, | 122 virtual void PrivetFileSystemResolved(PrivetV1HTTPClient* http_client, |
123 const std::string& path) OVERRIDE; | 123 const std::string& path) OVERRIDE; |
124 | 124 |
125 private: | 125 private: |
126 void OnStorageListResult(const base::DictionaryValue* value); | 126 void OnStorageListResult(const base::DictionaryValue* value); |
127 void SignalError(); | 127 void SignalError(); |
128 void TriggerCallbackAndDestroy( | 128 void TriggerCallbackAndDestroy( |
129 base::File::Error result, | 129 base::File::Error result, |
130 const fileapi::AsyncFileUtil::EntryList& file_list, | 130 const storage::AsyncFileUtil::EntryList& file_list, |
131 bool has_more); | 131 bool has_more); |
132 | 132 |
133 PrivetFileSystemAsyncOperationUtil core_; | 133 PrivetFileSystemAsyncOperationUtil core_; |
134 base::FilePath full_path_; | 134 base::FilePath full_path_; |
135 PrivetFileSystemAsyncOperationContainer* container_; | 135 PrivetFileSystemAsyncOperationContainer* container_; |
136 PrivetFileSystemAttributeCache* attribute_cache_; | 136 PrivetFileSystemAttributeCache* attribute_cache_; |
137 fileapi::AsyncFileUtil::ReadDirectoryCallback callback_; | 137 storage::AsyncFileUtil::ReadDirectoryCallback callback_; |
138 | 138 |
139 scoped_ptr<PrivetJSONOperation> list_operation_; | 139 scoped_ptr<PrivetJSONOperation> list_operation_; |
140 }; | 140 }; |
141 | 141 |
142 class PrivetFileSystemDetailsOperation | 142 class PrivetFileSystemDetailsOperation |
143 : public PrivetFileSystemAsyncOperationUtil::Delegate, | 143 : public PrivetFileSystemAsyncOperationUtil::Delegate, |
144 public local_discovery::PrivetFileSystemAsyncOperation { | 144 public local_discovery::PrivetFileSystemAsyncOperation { |
145 public: | 145 public: |
146 PrivetFileSystemDetailsOperation( | 146 PrivetFileSystemDetailsOperation( |
147 const base::FilePath& full_path, | 147 const base::FilePath& full_path, |
148 content::BrowserContext* browser_context, | 148 content::BrowserContext* browser_context, |
149 PrivetFileSystemAsyncOperationContainer* container, | 149 PrivetFileSystemAsyncOperationContainer* container, |
150 PrivetFileSystemAttributeCache* attribute_cache, | 150 PrivetFileSystemAttributeCache* attribute_cache, |
151 const fileapi::AsyncFileUtil::GetFileInfoCallback& callback); | 151 const storage::AsyncFileUtil::GetFileInfoCallback& callback); |
152 virtual ~PrivetFileSystemDetailsOperation(); | 152 virtual ~PrivetFileSystemDetailsOperation(); |
153 | 153 |
154 virtual void Start() OVERRIDE; | 154 virtual void Start() OVERRIDE; |
155 | 155 |
156 virtual void PrivetFileSystemResolved(PrivetV1HTTPClient* http_client, | 156 virtual void PrivetFileSystemResolved(PrivetV1HTTPClient* http_client, |
157 const std::string& path) OVERRIDE; | 157 const std::string& path) OVERRIDE; |
158 | 158 |
159 private: | 159 private: |
160 void OnStorageListResult(const base::DictionaryValue* value); | 160 void OnStorageListResult(const base::DictionaryValue* value); |
161 void SignalError(); | 161 void SignalError(); |
162 void TriggerCallbackAndDestroy(base::File::Error result, | 162 void TriggerCallbackAndDestroy(base::File::Error result, |
163 const base::File::Info& info); | 163 const base::File::Info& info); |
164 | 164 |
165 PrivetFileSystemAsyncOperationUtil core_; | 165 PrivetFileSystemAsyncOperationUtil core_; |
166 base::FilePath full_path_; | 166 base::FilePath full_path_; |
167 PrivetFileSystemAsyncOperationContainer* container_; | 167 PrivetFileSystemAsyncOperationContainer* container_; |
168 PrivetFileSystemAttributeCache* attribute_cache_; | 168 PrivetFileSystemAttributeCache* attribute_cache_; |
169 fileapi::AsyncFileUtil::GetFileInfoCallback callback_; | 169 storage::AsyncFileUtil::GetFileInfoCallback callback_; |
170 | 170 |
171 scoped_ptr<PrivetJSONOperation> list_operation_; | 171 scoped_ptr<PrivetJSONOperation> list_operation_; |
172 }; | 172 }; |
173 | 173 |
174 } // namespace local_discovery | 174 } // namespace local_discovery |
175 | 175 |
176 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H
_ | 176 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H
_ |
OLD | NEW |