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

Unified Diff: chrome/service/cloud_print/cloud_print_url_fetcher.cc

Issue 8373021: Convert URLFetcher::Delegates to use an interface in content/public/common. Also remove the old U... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync and remove unncessary forward declares Created 9 years, 2 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/service/cloud_print/cloud_print_url_fetcher.cc
===================================================================
--- chrome/service/cloud_print/cloud_print_url_fetcher.cc (revision 106929)
+++ chrome/service/cloud_print/cloud_print_url_fetcher.cc (working copy)
@@ -50,38 +50,34 @@
additional_headers);
}
- // URLFetcher::Delegate implementation.
-void CloudPrintURLFetcher::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
- VLOG(1) << "CP_PROXY: OnURLFetchComplete, url: " << url
- << ", response code: " << response_code;
+void CloudPrintURLFetcher::OnURLFetchComplete(const URLFetcher* source) {
+ VLOG(1) << "CP_PROXY: OnURLFetchComplete, url: " << source->url()
+ << ", response code: " << source->response_code();
// Make sure we stay alive through the body of this function.
scoped_refptr<CloudPrintURLFetcher> keep_alive(this);
- ResponseAction action = delegate_->HandleRawResponse(source,
- url,
- status,
- response_code,
- cookies,
- data);
+ std::string data;
+ source->GetResponseAsString(&data);
+ ResponseAction action = delegate_->HandleRawResponse(
+ source,
+ source->url(),
+ source->status(),
+ source->response_code(),
+ source->cookies(),
+ data);
if (action == CONTINUE_PROCESSING) {
// If we are not using an OAuth token, and we got an auth error, we are
// done. Else, the token may have been refreshed. Let us try again.
- if ((RC_FORBIDDEN == response_code) &&
+ if ((RC_FORBIDDEN == source->response_code()) &&
(!CloudPrintTokenStore::current() ||
!CloudPrintTokenStore::current()->token_is_oauth())) {
delegate_->OnRequestAuthError();
return;
}
// We need to retry on all network errors.
- if (!status.is_success() || (response_code != 200))
+ if (!source->status().is_success() || (source->response_code() != 200))
action = RETRY_REQUEST;
else
- action = delegate_->HandleRawData(source, url, data);
+ action = delegate_->HandleRawData(source, source->url(), data);
if (action == CONTINUE_PROCESSING) {
// If the delegate is not interested in handling the raw response data,
@@ -93,7 +89,7 @@
CloudPrintHelpers::ParseResponseJSON(data, &succeeded, &response_dict);
if (response_dict)
action = delegate_->HandleJSONData(source,
- url,
+ source->url(),
response_dict,
succeeded);
else

Powered by Google App Engine
This is Rietveld 408576698