| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 base::WeakPtrFactory<PrivetLocalPrintOperationImpl> weak_factory_; | 234 base::WeakPtrFactory<PrivetLocalPrintOperationImpl> weak_factory_; |
| 235 }; | 235 }; |
| 236 #endif // ENABLE_PRINT_PREVIEW | 236 #endif // ENABLE_PRINT_PREVIEW |
| 237 | 237 |
| 238 class PrivetHTTPClientImpl : public PrivetHTTPClient { | 238 class PrivetHTTPClientImpl : public PrivetHTTPClient { |
| 239 public: | 239 public: |
| 240 PrivetHTTPClientImpl( | 240 PrivetHTTPClientImpl( |
| 241 const std::string& name, | 241 const std::string& name, |
| 242 const net::HostPortPair& host_port, | 242 const net::HostPortPair& host_port, |
| 243 net::URLRequestContextGetter* request_context); | 243 net::URLRequestContextGetter* request_context); |
| 244 PrivetHTTPClientImpl( |
| 245 const std::string& name, |
| 246 const net::HostPortPair& host_port, |
| 247 const scoped_refptr<base::SingleThreadTaskRunner>& net_task_runner); |
| 244 ~PrivetHTTPClientImpl() override; | 248 ~PrivetHTTPClientImpl() override; |
| 245 | 249 |
| 246 // PrivetHTTPClient implementation. | 250 // PrivetHTTPClient implementation. |
| 247 const std::string& GetName() override; | 251 const std::string& GetName() override; |
| 248 scoped_ptr<PrivetJSONOperation> CreateInfoOperation( | 252 scoped_ptr<PrivetJSONOperation> CreateInfoOperation( |
| 249 const PrivetJSONOperation::ResultCallback& callback) override; | 253 const PrivetJSONOperation::ResultCallback& callback) override; |
| 250 scoped_ptr<PrivetURLFetcher> CreateURLFetcher( | 254 scoped_ptr<PrivetURLFetcher> CreateURLFetcher( |
| 251 const GURL& url, | 255 const GURL& url, |
| 252 net::URLFetcher::RequestType request_type, | 256 net::URLFetcher::RequestType request_type, |
| 253 PrivetURLFetcher::Delegate* delegate) override; | 257 PrivetURLFetcher::Delegate* delegate) override; |
| 254 void RefreshPrivetToken( | 258 void RefreshPrivetToken( |
| 255 const PrivetURLFetcher::TokenCallback& token_callback) override; | 259 const PrivetURLFetcher::TokenCallback& token_callback) override; |
| 260 void SwitchToHttps( |
| 261 uint16_t port, |
| 262 const net::SHA256HashValue& certificate_fingerprint) override; |
| 263 bool IsInHttpsMode() const override; |
| 256 | 264 |
| 257 private: | 265 private: |
| 258 typedef std::vector<PrivetURLFetcher::TokenCallback> TokenCallbackVector; | 266 typedef std::vector<PrivetURLFetcher::TokenCallback> TokenCallbackVector; |
| 259 | 267 |
| 260 void OnPrivetInfoDone(const base::DictionaryValue* value); | 268 void OnPrivetInfoDone(const base::DictionaryValue* value); |
| 261 | 269 |
| 262 std::string name_; | 270 std::string name_; |
| 263 scoped_refptr<net::URLRequestContextGetter> request_context_; | 271 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
| 272 bool use_https_ = false; |
| 264 net::HostPortPair host_port_; | 273 net::HostPortPair host_port_; |
| 265 | 274 |
| 266 scoped_ptr<PrivetJSONOperation> info_operation_; | 275 scoped_ptr<PrivetJSONOperation> info_operation_; |
| 267 TokenCallbackVector token_callbacks_; | 276 TokenCallbackVector token_callbacks_; |
| 268 | 277 |
| 269 DISALLOW_COPY_AND_ASSIGN(PrivetHTTPClientImpl); | 278 DISALLOW_COPY_AND_ASSIGN(PrivetHTTPClientImpl); |
| 270 }; | 279 }; |
| 271 | 280 |
| 272 class PrivetV1HTTPClientImpl : public PrivetV1HTTPClient { | 281 class PrivetV1HTTPClientImpl : public PrivetV1HTTPClient { |
| 273 public: | 282 public: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 288 private: | 297 private: |
| 289 PrivetHTTPClient* info_client() { return info_client_.get(); } | 298 PrivetHTTPClient* info_client() { return info_client_.get(); } |
| 290 | 299 |
| 291 scoped_ptr<PrivetHTTPClient> info_client_; | 300 scoped_ptr<PrivetHTTPClient> info_client_; |
| 292 | 301 |
| 293 DISALLOW_COPY_AND_ASSIGN(PrivetV1HTTPClientImpl); | 302 DISALLOW_COPY_AND_ASSIGN(PrivetV1HTTPClientImpl); |
| 294 }; | 303 }; |
| 295 | 304 |
| 296 } // namespace local_discovery | 305 } // namespace local_discovery |
| 297 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_ | 306 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_ |
| OLD | NEW |