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

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

Issue 215573003: Send an empty Privet token with /privet/info always (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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.cc
diff --git a/chrome/browser/local_discovery/privet_url_fetcher.cc b/chrome/browser/local_discovery/privet_url_fetcher.cc
index 97828930a2ab00328517818a60cb3c64e55d6b6c..cb519553b834610cc2b00f26313925b916038e7d 100644
--- a/chrome/browser/local_discovery/privet_url_fetcher.cc
+++ b/chrome/browser/local_discovery/privet_url_fetcher.cc
@@ -72,7 +72,7 @@ PrivetURLFetcher::PrivetURLFetcher(
request_context_(request_context),
delegate_(delegate),
do_not_retry_on_transient_error_(false),
- allow_empty_privet_token_(false),
+ send_empty_privet_token_(false),
has_byte_range_(false),
make_response_file_(false),
byte_range_start_(0),
@@ -99,12 +99,16 @@ void PrivetURLFetcher::DoNotRetryOnTransientError() {
do_not_retry_on_transient_error_ = true;
}
-void PrivetURLFetcher::AllowEmptyPrivetToken() {
+void PrivetURLFetcher::SendEmptyPrivetToken() {
DCHECK(tries_ == 0);
- allow_empty_privet_token_ = true;
+ send_empty_privet_token_ = true;
}
std::string PrivetURLFetcher::GetPrivetAccessToken() {
+ if (send_empty_privet_token_) {
+ return std::string();
+ }
+
TokenMapHolder* token_map_holder = TokenMapHolder::GetInstance();
TokenMap::iterator found = token_map_holder->map.find(GetHostString());
return found != token_map_holder->map.end() ? found->second : std::string();
@@ -173,12 +177,16 @@ void PrivetURLFetcher::Try() {
void PrivetURLFetcher::Start() {
DCHECK_EQ(tries_, 0); // We haven't called |Start()| yet.
- std::string privet_access_token = GetPrivetAccessToken();
- if (privet_access_token.empty() && !allow_empty_privet_token_) {
- RequestTokenRefresh();
- } else {
- Try();
+ if (!send_empty_privet_token_) {
+ std::string privet_access_token;
+ privet_access_token = GetPrivetAccessToken();
+ if (privet_access_token.empty()) {
+ RequestTokenRefresh();
+ return;
+ }
}
+
+ Try();
}
void PrivetURLFetcher::SetUploadData(const std::string& upload_content_type,
« no previous file with comments | « chrome/browser/local_discovery/privet_url_fetcher.h ('k') | chrome/browser/local_discovery/privet_url_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698