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

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

Issue 699123004: Updated comments for gcdPrivate API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wed Nov 5 00:43:56 PST 2014 Created 6 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privetv3_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e26a062ffe5cb5f9944e5f946d6fa2be0a64a4ce..627278eabcb46c02c0b1e1a326d8d3404647b0a1 100644
--- a/chrome/browser/local_discovery/privet_url_fetcher.cc
+++ b/chrome/browser/local_discovery/privet_url_fetcher.cc
@@ -283,13 +283,16 @@ bool PrivetURLFetcher::OnURLFetchCompleteDoNotParseData(
void PrivetURLFetcher::OnURLFetchCompleteParseData(
const net::URLFetcher* source) {
- if (source->GetResponseCode() != net::HTTP_OK) {
+ // Response contains error description.
+ bool is_error_response = false;
+ if (v3_mode_ && source->GetResponseCode() == net::HTTP_BAD_REQUEST) {
+ is_error_response = true;
+ } else if (source->GetResponseCode() != net::HTTP_OK) {
delegate_->OnError(this, RESPONSE_CODE_ERROR);
return;
}
std::string response_str;
-
if (!source->GetResponseAsString(&response_str)) {
delegate_->OnError(this, URL_FETCH_ERROR);
return;
@@ -313,7 +316,7 @@ void PrivetURLFetcher::OnURLFetchCompleteParseData(
}
std::string error;
- if (dictionary_value->GetString(kPrivetKeyError, &error)) {
+ if (!v3_mode_ && dictionary_value->GetString(kPrivetKeyError, &error)) {
if (error == kPrivetErrorInvalidXPrivetToken) {
RequestTokenRefresh();
return;
@@ -329,10 +332,10 @@ void PrivetURLFetcher::OnURLFetchCompleteParseData(
return;
}
}
+ is_error_response = true;
}
- delegate_->OnParsedJson(
- this, *dictionary_value, dictionary_value->HasKey(kPrivetKeyError));
+ delegate_->OnParsedJson(this, *dictionary_value, is_error_response);
}
void PrivetURLFetcher::ScheduleRetry(int timeout_seconds) {
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privetv3_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698