Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Side by Side Diff: chrome/browser/local_discovery/privet_http_impl.h

Issue 166373006: Use persistent map of privet tokens for PrivetURLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 }; 281 };
282 282
283 class PrivetHTTPClientImpl : public PrivetHTTPClient { 283 class PrivetHTTPClientImpl : public PrivetHTTPClient {
284 public: 284 public:
285 PrivetHTTPClientImpl( 285 PrivetHTTPClientImpl(
286 const std::string& name, 286 const std::string& name,
287 const net::HostPortPair& host_port, 287 const net::HostPortPair& host_port,
288 net::URLRequestContextGetter* request_context); 288 net::URLRequestContextGetter* request_context);
289 virtual ~PrivetHTTPClientImpl(); 289 virtual ~PrivetHTTPClientImpl();
290 290
291 virtual const base::DictionaryValue* GetCachedInfo() const OVERRIDE;
292
293 virtual scoped_ptr<PrivetRegisterOperation> CreateRegisterOperation( 291 virtual scoped_ptr<PrivetRegisterOperation> CreateRegisterOperation(
294 const std::string& user, 292 const std::string& user,
295 PrivetRegisterOperation::Delegate* delegate) OVERRIDE; 293 PrivetRegisterOperation::Delegate* delegate) OVERRIDE;
296 294
297 virtual scoped_ptr<PrivetJSONOperation> CreateInfoOperation( 295 virtual scoped_ptr<PrivetJSONOperation> CreateInfoOperation(
298 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE; 296 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE;
299 297
300 virtual scoped_ptr<PrivetJSONOperation> CreateCapabilitiesOperation( 298 virtual scoped_ptr<PrivetJSONOperation> CreateCapabilitiesOperation(
301 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE; 299 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE;
302 300
303 virtual scoped_ptr<PrivetLocalPrintOperation> CreateLocalPrintOperation( 301 virtual scoped_ptr<PrivetLocalPrintOperation> CreateLocalPrintOperation(
304 PrivetLocalPrintOperation::Delegate* delegate) OVERRIDE; 302 PrivetLocalPrintOperation::Delegate* delegate) OVERRIDE;
305 303
306 virtual scoped_ptr<PrivetJSONOperation> CreateStorageListOperation( 304 virtual scoped_ptr<PrivetJSONOperation> CreateStorageListOperation(
307 const std::string& path, 305 const std::string& path,
308 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE; 306 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE;
309 307
310 virtual scoped_ptr<PrivetDataReadOperation> CreateStorageReadOperation( 308 virtual scoped_ptr<PrivetDataReadOperation> CreateStorageReadOperation(
311 const std::string& path, 309 const std::string& path,
312 const PrivetDataReadOperation::ResultCallback& callback) OVERRIDE; 310 const PrivetDataReadOperation::ResultCallback& callback) OVERRIDE;
313 311
314 virtual const std::string& GetName() OVERRIDE; 312 virtual const std::string& GetName() OVERRIDE;
315 313
316 scoped_ptr<PrivetURLFetcher> CreateURLFetcher( 314 scoped_ptr<PrivetURLFetcher> CreateURLFetcher(
317 const GURL& url, 315 const GURL& url,
318 net::URLFetcher::RequestType request_type, 316 net::URLFetcher::RequestType request_type,
319 PrivetURLFetcher::Delegate* delegate) const; 317 PrivetURLFetcher::Delegate* delegate) const;
320 318
321 void CacheInfo(const base::DictionaryValue* cached_info);
322
323 bool HasToken() const;
324
325 void RefreshPrivetToken( 319 void RefreshPrivetToken(
326 const PrivetURLFetcher::TokenCallback& token_callback); 320 const PrivetURLFetcher::TokenCallback& token_callback);
327 321
328 private: 322 private:
329 typedef std::vector<PrivetURLFetcher::TokenCallback> TokenCallbackVector; 323 typedef std::vector<PrivetURLFetcher::TokenCallback> TokenCallbackVector;
330 324
331 void OnPrivetInfoDone(const base::DictionaryValue* value); 325 void OnPrivetInfoDone(const base::DictionaryValue* value);
332 326
333 std::string name_; 327 std::string name_;
334 PrivetURLFetcherFactory fetcher_factory_; 328 scoped_refptr<net::URLRequestContextGetter> request_context_;
335 net::HostPortPair host_port_; 329 net::HostPortPair host_port_;
336 scoped_ptr<base::DictionaryValue> cached_info_;
337 330
338 scoped_ptr<PrivetJSONOperation> info_operation_; 331 scoped_ptr<PrivetJSONOperation> info_operation_;
339 TokenCallbackVector token_callbacks_; 332 TokenCallbackVector token_callbacks_;
340 }; 333 };
341 334
342 } // namespace local_discovery 335 } // namespace local_discovery
343 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_ 336 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/local_discovery/privet_http.h ('k') | chrome/browser/local_discovery/privet_http_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698