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

Unified Diff: chrome/browser/local_discovery/privet_http_impl.cc

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_http_impl.cc
diff --git a/chrome/browser/local_discovery/privet_http_impl.cc b/chrome/browser/local_discovery/privet_http_impl.cc
index 8dd6c3dd7747de0235e7d14085f7e6876ae47b67..cabb81ef6bc1dac7ae455493a4990b77e33b61d1 100644
--- a/chrome/browser/local_discovery/privet_http_impl.cc
+++ b/chrome/browser/local_discovery/privet_http_impl.cc
@@ -109,8 +109,6 @@ void PrivetInfoOperationImpl::OnError(PrivetURLFetcher* fetcher,
void PrivetInfoOperationImpl::OnParsedJson(PrivetURLFetcher* fetcher,
const base::DictionaryValue* value,
bool has_error) {
- if (!has_error)
- privet_client_->CacheInfo(value);
callback_.Run(value);
}
@@ -711,17 +709,13 @@ PrivetHTTPClientImpl::PrivetHTTPClientImpl(
const net::HostPortPair& host_port,
net::URLRequestContextGetter* request_context)
: name_(name),
- fetcher_factory_(request_context),
+ request_context_(request_context),
host_port_(host_port) {
}
PrivetHTTPClientImpl::~PrivetHTTPClientImpl() {
}
-const base::DictionaryValue* PrivetHTTPClientImpl::GetCachedInfo() const {
- return cached_info_.get();
-}
-
scoped_ptr<PrivetRegisterOperation>
PrivetHTTPClientImpl::CreateRegisterOperation(
const std::string& user,
@@ -772,22 +766,11 @@ scoped_ptr<PrivetURLFetcher> PrivetHTTPClientImpl::CreateURLFetcher(
replacements.SetHostStr(host_port_.host());
std::string port(base::IntToString(host_port_.port())); // Keep string alive.
replacements.SetPortStr(port);
- return fetcher_factory_.CreateURLFetcher(url.ReplaceComponents(replacements),
- request_type, delegate);
+ return scoped_ptr<PrivetURLFetcher>(
+ new PrivetURLFetcher(url.ReplaceComponents(replacements), request_type,
+ request_context_.get(), delegate));
}
-void PrivetHTTPClientImpl::CacheInfo(const base::DictionaryValue* cached_info) {
- cached_info_.reset(cached_info->DeepCopy());
- std::string token;
- if (cached_info_->GetString(kPrivetInfoKeyToken, &token)) {
- fetcher_factory_.set_token(token);
- }
-}
-
-bool PrivetHTTPClientImpl::HasToken() const {
- return fetcher_factory_.get_token() != "";
-};
-
void PrivetHTTPClientImpl::RefreshPrivetToken(
const PrivetURLFetcher::TokenCallback& callback) {
token_callbacks_.push_back(callback);

Powered by Google App Engine
This is Rietveld 408576698