OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PRIVET_HTTP_IMPL_H_ | 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_ |
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 scoped_ptr<PrivetJSONOperation> info_operation_; | 114 scoped_ptr<PrivetJSONOperation> info_operation_; |
115 std::string expected_id_; | 115 std::string expected_id_; |
116 }; | 116 }; |
117 | 117 |
118 class PrivetJSONOperationImpl : public PrivetJSONOperation, | 118 class PrivetJSONOperationImpl : public PrivetJSONOperation, |
119 public PrivetURLFetcher::Delegate { | 119 public PrivetURLFetcher::Delegate { |
120 public: | 120 public: |
121 PrivetJSONOperationImpl( | 121 PrivetJSONOperationImpl( |
122 PrivetHTTPClientImpl* privet_client, | 122 PrivetHTTPClientImpl* privet_client, |
123 const std::string& path, | 123 const std::string& path, |
| 124 const std::string& query_params, |
124 const PrivetJSONOperation::ResultCallback& callback); | 125 const PrivetJSONOperation::ResultCallback& callback); |
125 virtual ~PrivetJSONOperationImpl(); | 126 virtual ~PrivetJSONOperationImpl(); |
126 virtual void Start() OVERRIDE; | 127 virtual void Start() OVERRIDE; |
127 | 128 |
128 virtual PrivetHTTPClient* GetHTTPClient() OVERRIDE; | 129 virtual PrivetHTTPClient* GetHTTPClient() OVERRIDE; |
129 | 130 |
130 virtual void OnError(PrivetURLFetcher* fetcher, | 131 virtual void OnError(PrivetURLFetcher* fetcher, |
131 PrivetURLFetcher::ErrorType error) OVERRIDE; | 132 PrivetURLFetcher::ErrorType error) OVERRIDE; |
132 virtual void OnParsedJson(PrivetURLFetcher* fetcher, | 133 virtual void OnParsedJson(PrivetURLFetcher* fetcher, |
133 const base::DictionaryValue* value, | 134 const base::DictionaryValue* value, |
134 bool has_error) OVERRIDE; | 135 bool has_error) OVERRIDE; |
135 virtual void OnNeedPrivetToken( | 136 virtual void OnNeedPrivetToken( |
136 PrivetURLFetcher* fetcher, | 137 PrivetURLFetcher* fetcher, |
137 const PrivetURLFetcher::TokenCallback& callback) OVERRIDE; | 138 const PrivetURLFetcher::TokenCallback& callback) OVERRIDE; |
138 | 139 |
139 private: | 140 private: |
140 PrivetHTTPClientImpl* privet_client_; | 141 PrivetHTTPClientImpl* privet_client_; |
141 std::string path_; | 142 std::string path_; |
| 143 std::string query_params_; |
142 PrivetJSONOperation::ResultCallback callback_; | 144 PrivetJSONOperation::ResultCallback callback_; |
143 | 145 |
144 scoped_ptr<PrivetURLFetcher> url_fetcher_; | 146 scoped_ptr<PrivetURLFetcher> url_fetcher_; |
145 }; | 147 }; |
146 | 148 |
147 class PrivetLocalPrintOperationImpl | 149 class PrivetLocalPrintOperationImpl |
148 : public PrivetLocalPrintOperation, | 150 : public PrivetLocalPrintOperation, |
149 public PrivetURLFetcher::Delegate { | 151 public PrivetURLFetcher::Delegate { |
150 public: | 152 public: |
151 PrivetLocalPrintOperationImpl( | 153 PrivetLocalPrintOperationImpl( |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 251 |
250 virtual scoped_ptr<PrivetJSONOperation> CreateInfoOperation( | 252 virtual scoped_ptr<PrivetJSONOperation> CreateInfoOperation( |
251 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE; | 253 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE; |
252 | 254 |
253 virtual scoped_ptr<PrivetJSONOperation> CreateCapabilitiesOperation( | 255 virtual scoped_ptr<PrivetJSONOperation> CreateCapabilitiesOperation( |
254 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE; | 256 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE; |
255 | 257 |
256 virtual scoped_ptr<PrivetLocalPrintOperation> CreateLocalPrintOperation( | 258 virtual scoped_ptr<PrivetLocalPrintOperation> CreateLocalPrintOperation( |
257 PrivetLocalPrintOperation::Delegate* delegate) OVERRIDE; | 259 PrivetLocalPrintOperation::Delegate* delegate) OVERRIDE; |
258 | 260 |
| 261 virtual scoped_ptr<PrivetJSONOperation> CreateStorageListOperation( |
| 262 const std::string& path, |
| 263 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE; |
| 264 |
259 virtual const std::string& GetName() OVERRIDE; | 265 virtual const std::string& GetName() OVERRIDE; |
260 | 266 |
261 scoped_ptr<PrivetURLFetcher> CreateURLFetcher( | 267 scoped_ptr<PrivetURLFetcher> CreateURLFetcher( |
262 const GURL& url, | 268 const GURL& url, |
263 net::URLFetcher::RequestType request_type, | 269 net::URLFetcher::RequestType request_type, |
264 PrivetURLFetcher::Delegate* delegate) const; | 270 PrivetURLFetcher::Delegate* delegate) const; |
265 | 271 |
266 void CacheInfo(const base::DictionaryValue* cached_info); | 272 void CacheInfo(const base::DictionaryValue* cached_info); |
267 | 273 |
268 bool HasToken() const; | 274 bool HasToken() const; |
(...skipping 10 matching lines...) Expand all Loading... |
279 PrivetURLFetcherFactory fetcher_factory_; | 285 PrivetURLFetcherFactory fetcher_factory_; |
280 net::HostPortPair host_port_; | 286 net::HostPortPair host_port_; |
281 scoped_ptr<base::DictionaryValue> cached_info_; | 287 scoped_ptr<base::DictionaryValue> cached_info_; |
282 | 288 |
283 scoped_ptr<PrivetJSONOperation> info_operation_; | 289 scoped_ptr<PrivetJSONOperation> info_operation_; |
284 TokenCallbackVector token_callbacks_; | 290 TokenCallbackVector token_callbacks_; |
285 }; | 291 }; |
286 | 292 |
287 } // namespace local_discovery | 293 } // namespace local_discovery |
288 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_ | 294 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_ |
OLD | NEW |