| 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" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 class PrivetFileSystemAsyncOperationUtil { | 68 class PrivetFileSystemAsyncOperationUtil { |
| 69 public: | 69 public: |
| 70 class Delegate { | 70 class Delegate { |
| 71 public: | 71 public: |
| 72 Delegate() {} | 72 Delegate() {} |
| 73 virtual ~Delegate() {} | 73 virtual ~Delegate() {} |
| 74 | 74 |
| 75 // |http_client| is the client for the resolved service, or NULL if | 75 // |http_client| is the client for the resolved service, or NULL if |
| 76 // resolution failed. |path| is the canonical path within the privet | 76 // resolution failed. |path| is the canonical path within the privet |
| 77 // service. | 77 // service. |
| 78 virtual void PrivetFileSystemResolved( | 78 virtual void PrivetFileSystemResolved(PrivetV1HTTPClient* http_client, |
| 79 PrivetHTTPClient* http_client, | 79 const std::string& path) = 0; |
| 80 const std::string& path) = 0; | |
| 81 }; | 80 }; |
| 82 | 81 |
| 83 PrivetFileSystemAsyncOperationUtil(const base::FilePath& full_path, | 82 PrivetFileSystemAsyncOperationUtil(const base::FilePath& full_path, |
| 84 content::BrowserContext* browser_context, | 83 content::BrowserContext* browser_context, |
| 85 Delegate* delegate); | 84 Delegate* delegate); |
| 86 ~PrivetFileSystemAsyncOperationUtil(); | 85 ~PrivetFileSystemAsyncOperationUtil(); |
| 87 | 86 |
| 88 void Start(); | 87 void Start(); |
| 89 | 88 |
| 90 private: | 89 private: |
| 91 void OnGotDeviceDescription(bool success, | 90 void OnGotDeviceDescription(bool success, |
| 92 const DeviceDescription& device_description); | 91 const DeviceDescription& device_description); |
| 93 void OnGotPrivetHTTP(scoped_ptr<PrivetHTTPClient> privet_http_client); | 92 void OnGotPrivetHTTP(scoped_ptr<PrivetHTTPClient> privet_http_client); |
| 94 | 93 |
| 95 ParsedPrivetPath parsed_path_; | 94 ParsedPrivetPath parsed_path_; |
| 96 scoped_refptr<net::URLRequestContextGetter> request_context_; | 95 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 97 content::BrowserContext* browser_context_; | 96 content::BrowserContext* browser_context_; |
| 98 Delegate* delegate_; | 97 Delegate* delegate_; |
| 99 | 98 |
| 100 scoped_refptr<ServiceDiscoverySharedClient> service_discovery_client_; | 99 scoped_refptr<ServiceDiscoverySharedClient> service_discovery_client_; |
| 101 scoped_ptr<PrivetDeviceResolver> privet_device_resolver_; | 100 scoped_ptr<PrivetDeviceResolver> privet_device_resolver_; |
| 102 scoped_ptr<PrivetHTTPAsynchronousFactory> privet_async_factory_; | 101 scoped_ptr<PrivetHTTPAsynchronousFactory> privet_async_factory_; |
| 103 scoped_ptr<PrivetHTTPResolution> privet_http_resolution_; | 102 scoped_ptr<PrivetHTTPResolution> privet_http_resolution_; |
| 104 scoped_ptr<PrivetHTTPClient> privet_client_; | 103 scoped_ptr<PrivetV1HTTPClient> privet_client_; |
| 105 | 104 |
| 106 base::WeakPtrFactory<PrivetFileSystemAsyncOperationUtil> weak_factory_; | 105 base::WeakPtrFactory<PrivetFileSystemAsyncOperationUtil> weak_factory_; |
| 107 }; | 106 }; |
| 108 | 107 |
| 109 class PrivetFileSystemListOperation | 108 class PrivetFileSystemListOperation |
| 110 : public PrivetFileSystemAsyncOperationUtil::Delegate, | 109 : public PrivetFileSystemAsyncOperationUtil::Delegate, |
| 111 public local_discovery::PrivetFileSystemAsyncOperation { | 110 public local_discovery::PrivetFileSystemAsyncOperation { |
| 112 public: | 111 public: |
| 113 PrivetFileSystemListOperation( | 112 PrivetFileSystemListOperation( |
| 114 const base::FilePath& full_path, | 113 const base::FilePath& full_path, |
| 115 content::BrowserContext* browser_context, | 114 content::BrowserContext* browser_context, |
| 116 PrivetFileSystemAsyncOperationContainer* container, | 115 PrivetFileSystemAsyncOperationContainer* container, |
| 117 PrivetFileSystemAttributeCache* attribute_cache, | 116 PrivetFileSystemAttributeCache* attribute_cache, |
| 118 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback); | 117 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback); |
| 119 virtual ~PrivetFileSystemListOperation(); | 118 virtual ~PrivetFileSystemListOperation(); |
| 120 | 119 |
| 121 virtual void Start() OVERRIDE; | 120 virtual void Start() OVERRIDE; |
| 122 | 121 |
| 123 virtual void PrivetFileSystemResolved( | 122 virtual void PrivetFileSystemResolved(PrivetV1HTTPClient* http_client, |
| 124 PrivetHTTPClient* http_client, | 123 const std::string& path) OVERRIDE; |
| 125 const std::string& path) OVERRIDE; | |
| 126 | 124 |
| 127 private: | 125 private: |
| 128 void OnStorageListResult(const base::DictionaryValue* value); | 126 void OnStorageListResult(const base::DictionaryValue* value); |
| 129 void SignalError(); | 127 void SignalError(); |
| 130 void TriggerCallbackAndDestroy( | 128 void TriggerCallbackAndDestroy( |
| 131 base::File::Error result, | 129 base::File::Error result, |
| 132 const fileapi::AsyncFileUtil::EntryList& file_list, | 130 const fileapi::AsyncFileUtil::EntryList& file_list, |
| 133 bool has_more); | 131 bool has_more); |
| 134 | 132 |
| 135 PrivetFileSystemAsyncOperationUtil core_; | 133 PrivetFileSystemAsyncOperationUtil core_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 148 PrivetFileSystemDetailsOperation( | 146 PrivetFileSystemDetailsOperation( |
| 149 const base::FilePath& full_path, | 147 const base::FilePath& full_path, |
| 150 content::BrowserContext* browser_context, | 148 content::BrowserContext* browser_context, |
| 151 PrivetFileSystemAsyncOperationContainer* container, | 149 PrivetFileSystemAsyncOperationContainer* container, |
| 152 PrivetFileSystemAttributeCache* attribute_cache, | 150 PrivetFileSystemAttributeCache* attribute_cache, |
| 153 const fileapi::AsyncFileUtil::GetFileInfoCallback& callback); | 151 const fileapi::AsyncFileUtil::GetFileInfoCallback& callback); |
| 154 virtual ~PrivetFileSystemDetailsOperation(); | 152 virtual ~PrivetFileSystemDetailsOperation(); |
| 155 | 153 |
| 156 virtual void Start() OVERRIDE; | 154 virtual void Start() OVERRIDE; |
| 157 | 155 |
| 158 virtual void PrivetFileSystemResolved(PrivetHTTPClient* http_client, | 156 virtual void PrivetFileSystemResolved(PrivetV1HTTPClient* http_client, |
| 159 const std::string& path) OVERRIDE; | 157 const std::string& path) OVERRIDE; |
| 160 | 158 |
| 161 private: | 159 private: |
| 162 void OnStorageListResult(const base::DictionaryValue* value); | 160 void OnStorageListResult(const base::DictionaryValue* value); |
| 163 void SignalError(); | 161 void SignalError(); |
| 164 void TriggerCallbackAndDestroy(base::File::Error result, | 162 void TriggerCallbackAndDestroy(base::File::Error result, |
| 165 const base::File::Info& info); | 163 const base::File::Info& info); |
| 166 | 164 |
| 167 PrivetFileSystemAsyncOperationUtil core_; | 165 PrivetFileSystemAsyncOperationUtil core_; |
| 168 base::FilePath full_path_; | 166 base::FilePath full_path_; |
| 169 PrivetFileSystemAsyncOperationContainer* container_; | 167 PrivetFileSystemAsyncOperationContainer* container_; |
| 170 PrivetFileSystemAttributeCache* attribute_cache_; | 168 PrivetFileSystemAttributeCache* attribute_cache_; |
| 171 fileapi::AsyncFileUtil::GetFileInfoCallback callback_; | 169 fileapi::AsyncFileUtil::GetFileInfoCallback callback_; |
| 172 | 170 |
| 173 scoped_ptr<PrivetJSONOperation> list_operation_; | 171 scoped_ptr<PrivetJSONOperation> list_operation_; |
| 174 }; | 172 }; |
| 175 | 173 |
| 176 } // namespace local_discovery | 174 } // namespace local_discovery |
| 177 | 175 |
| 178 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H
_ | 176 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_STORAGE_PRIVET_FILESYSTEM_OPERATIONS_H
_ |
| OLD | NEW |