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

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 a6dcab7be630b0af734feaaf9b5cc500531b702b..0514441c8aca99c9303adfd69d8b9bb557dfdac0 100644
--- a/chrome/browser/local_discovery/privet_http_impl.cc
+++ b/chrome/browser/local_discovery/privet_http_impl.cc
@@ -107,8 +107,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);
}
@@ -787,18 +785,11 @@ PrivetHTTPClientImpl::PrivetHTTPClientImpl(
const std::string& name,
const net::HostPortPair& host_port,
net::URLRequestContextGetter* request_context)
- : name_(name),
- fetcher_factory_(request_context),
- host_port_(host_port) {
-}
+ : name_(name), 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,
@@ -861,22 +852,13 @@ 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);
-}
-
-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);
- }
+ return scoped_ptr<PrivetURLFetcher>(
+ new PrivetURLFetcher(url.ReplaceComponents(replacements),
+ request_type,
+ request_context_.get(),
+ delegate));
}
-bool PrivetHTTPClientImpl::HasToken() const {
- return fetcher_factory_.get_token() != "";
-};
-
void PrivetHTTPClientImpl::RefreshPrivetToken(
const PrivetURLFetcher::TokenCallback& callback) {
token_callbacks_.push_back(callback);
« no previous file with comments | « chrome/browser/local_discovery/privet_http_impl.h ('k') | chrome/browser/local_discovery/privet_http_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698