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

Unified Diff: chrome/browser/local_discovery/privet_url_fetcher.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/local_discovery/privet_url_fetcher.h
diff --git a/chrome/browser/local_discovery/privet_url_fetcher.h b/chrome/browser/local_discovery/privet_url_fetcher.h
index f3b7405378d0cc73385b7162db9ac81ef0ef5479..07930c5841f69220a3461335b3fcaa44c7e4bff1 100644
--- a/chrome/browser/local_discovery/privet_url_fetcher.h
+++ b/chrome/browser/local_discovery/privet_url_fetcher.h
@@ -54,13 +54,19 @@ class PrivetURLFetcher : public net::URLFetcherDelegate {
};
PrivetURLFetcher(
- const std::string& token,
const GURL& url,
net::URLFetcher::RequestType request_type,
net::URLRequestContextGetter* request_context,
Delegate* delegate);
+
virtual ~PrivetURLFetcher();
+ static void SetTokenForHost(
+ const std::string& host,
+ const std::string& token);
+
+ static void ResetTokenMapForTests();
+
void DoNotRetryOnTransientError();
void AllowEmptyPrivetToken();
@@ -79,13 +85,14 @@ class PrivetURLFetcher : public net::URLFetcherDelegate {
int response_code() const { return url_fetcher_->GetResponseCode(); }
private:
+ std::string GetHostString(); // Get string representing the host.
+ std::string GetPrivetAccessToken();
void Try();
void ScheduleRetry(int timeout_seconds);
bool PrivetErrorTransient(const std::string& error);
void RequestTokenRefresh();
void RefreshToken(const std::string& token);
- std::string privet_access_token_;
GURL url_;
net::URLFetcher::RequestType request_type_;
scoped_refptr<net::URLRequestContextGetter> request_context_;
@@ -104,27 +111,6 @@ class PrivetURLFetcher : public net::URLFetcherDelegate {
DISALLOW_COPY_AND_ASSIGN(PrivetURLFetcher);
};
-class PrivetURLFetcherFactory {
- public:
- explicit PrivetURLFetcherFactory(
- net::URLRequestContextGetter* request_context);
- ~PrivetURLFetcherFactory();
-
- scoped_ptr<PrivetURLFetcher> CreateURLFetcher(
- const GURL& url,
- net::URLFetcher::RequestType request_type,
- PrivetURLFetcher::Delegate* delegate) const;
-
- void set_token(const std::string& token) { token_ = token; }
- const std::string& get_token() const { return token_; }
-
- private:
- scoped_refptr<net::URLRequestContextGetter> request_context_;
- std::string token_;
-
- DISALLOW_COPY_AND_ASSIGN(PrivetURLFetcherFactory);
-};
-
} // namespace local_discovery
#endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_URL_FETCHER_H_

Powered by Google App Engine
This is Rietveld 408576698