summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/alternate_nav_url_fetcher.cc12
-rw-r--r--chrome/browser/alternate_nav_url_fetcher.h17
-rw-r--r--chrome/browser/autocomplete/search_provider.cc15
-rw-r--r--chrome/browser/autocomplete/search_provider.h13
-rw-r--r--chrome/browser/autocomplete/search_provider_unittest.cc25
-rw-r--r--chrome/browser/autofill/autofill_browsertest.cc10
-rw-r--r--chrome/browser/autofill/autofill_download.cc4
-rw-r--r--chrome/browser/autofill/autofill_download.h7
-rw-r--r--chrome/browser/bug_report_util.cc25
-rw-r--r--chrome/browser/chromeos/customization_document.cc16
-rw-r--r--chrome/browser/chromeos/customization_document.h13
-rw-r--r--chrome/browser/chromeos/login/auth_response_handler.h4
-rw-r--r--chrome/browser/chromeos/login/client_login_response_handler.cc2
-rw-r--r--chrome/browser/chromeos/login/client_login_response_handler.h2
-rw-r--r--chrome/browser/chromeos/login/cookie_fetcher.cc15
-rw-r--r--chrome/browser/chromeos/login/cookie_fetcher.h13
-rw-r--r--chrome/browser/chromeos/login/image_downloader.cc16
-rw-r--r--chrome/browser/chromeos/login/image_downloader.h13
-rw-r--r--chrome/browser/chromeos/login/issue_response_handler.cc2
-rw-r--r--chrome/browser/chromeos/login/issue_response_handler.h2
-rw-r--r--chrome/browser/chromeos/login/mock_auth_response_handler.cc27
-rw-r--r--chrome/browser/chromeos/login/mock_auth_response_handler.h7
-rw-r--r--chrome/browser/chromeos/login/mock_url_fetchers.cc165
-rw-r--r--chrome/browser/chromeos/login/mock_url_fetchers.h46
-rw-r--r--chrome/browser/chromeos/login/profile_image_downloader.cc9
-rw-r--r--chrome/browser/chromeos/login/profile_image_downloader.h6
-rw-r--r--chrome/browser/component_updater/component_updater_service.cc5
-rw-r--r--chrome/browser/extensions/app_notify_channel_setup.cc1
-rw-r--r--chrome/browser/extensions/app_notify_channel_setup.h6
-rw-r--r--chrome/browser/extensions/apps_promo.cc3
-rw-r--r--chrome/browser/extensions/apps_promo.h4
-rw-r--r--chrome/browser/extensions/extension_management_browsertest.cc1
-rw-r--r--chrome/browser/extensions/extension_updater.cc5
-rw-r--r--chrome/browser/extensions/extension_updater.h10
-rw-r--r--chrome/browser/extensions/webstore_inline_installer.cc1
-rw-r--r--chrome/browser/extensions/webstore_inline_installer.h6
-rw-r--r--chrome/browser/extensions/webstore_install_helper.cc1
-rw-r--r--chrome/browser/extensions/webstore_install_helper.h10
-rw-r--r--chrome/browser/google/google_url_tracker.cc13
-rw-r--r--chrome/browser/google/google_url_tracker.h13
-rw-r--r--chrome/browser/google/google_url_tracker_unittest.cc7
-rw-r--r--chrome/browser/importer/toolbar_importer.cc13
-rw-r--r--chrome/browser/importer/toolbar_importer.h13
-rw-r--r--chrome/browser/intranet_redirect_detector.cc15
-rw-r--r--chrome/browser/intranet_redirect_detector.h13
-rw-r--r--chrome/browser/metrics/metrics_service.cc22
-rw-r--r--chrome/browser/metrics/metrics_service.h13
-rw-r--r--chrome/browser/net/gaia/gaia_oauth_fetcher.cc17
-rw-r--r--chrome/browser/net/gaia/gaia_oauth_fetcher.h22
-rw-r--r--chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc39
-rw-r--r--chrome/browser/net/sdch_dictionary_fetcher.cc7
-rw-r--r--chrome/browser/net/sdch_dictionary_fetcher.h6
-rw-r--r--chrome/browser/plugin_download_helper.cc1
-rw-r--r--chrome/browser/plugin_download_helper.h16
-rw-r--r--chrome/browser/policy/device_management_backend_impl.cc1
-rw-r--r--chrome/browser/policy/device_management_service.cc18
-rw-r--r--chrome/browser/policy/device_management_service.h17
-rw-r--r--chrome/browser/policy/device_management_service_browsertest.cc1
-rw-r--r--chrome/browser/policy/device_management_service_unittest.cc96
-rw-r--r--chrome/browser/policy/testing_policy_url_fetcher_factory.cc33
-rw-r--r--chrome/browser/policy/testing_policy_url_fetcher_factory.h4
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_proxy_service.h1
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_service.cc19
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_service.h14
-rw-r--r--chrome/browser/safe_browsing/download_protection_service.cc28
-rw-r--r--chrome/browser/safe_browsing/download_protection_service.h13
-rw-r--r--chrome/browser/safe_browsing/malware_details_cache.cc24
-rw-r--r--chrome/browser/safe_browsing/malware_details_cache.h11
-rw-r--r--chrome/browser/safe_browsing/protocol_manager.cc49
-rw-r--r--chrome/browser/safe_browsing/protocol_manager.h13
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_test.cc15
-rw-r--r--chrome/browser/search_engines/template_url_fetcher.cc25
-rw-r--r--chrome/browser/spellchecker/spellcheck_host_impl.cc14
-rw-r--r--chrome/browser/spellchecker/spellcheck_host_impl.h15
-rw-r--r--chrome/browser/sync/glue/http_bridge.cc16
-rw-r--r--chrome/browser/sync/glue/http_bridge.h17
-rw-r--r--chrome/browser/sync/glue/http_bridge_unittest.cc8
-rw-r--r--chrome/browser/sync/signin_manager_unittest.cc19
-rw-r--r--chrome/browser/sync/test/integration/sync_test.cc16
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.h2
-rw-r--r--chrome/browser/tab_contents/spelling_menu_observer.cc13
-rw-r--r--chrome/browser/tab_contents/spelling_menu_observer.h19
-rw-r--r--chrome/browser/translate/translate_manager.cc21
-rw-r--r--chrome/browser/translate/translate_manager.h13
-rw-r--r--chrome/browser/translate/translate_manager_browsertest.cc17
-rw-r--r--chrome/browser/web_resource/web_resource_service.cc16
-rw-r--r--chrome/chrome_common.gypi1
-rw-r--r--chrome/common/net/gaia/gaia_auth_fetcher.cc15
-rw-r--r--chrome/common/net/gaia/gaia_auth_fetcher.h20
-rw-r--r--chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc200
-rw-r--r--chrome/common/net/gaia/gaia_auth_fetcher_unittest.h26
-rw-r--r--chrome/common/net/gaia/gaia_oauth_client.cc45
-rw-r--r--chrome/common/net/gaia/gaia_oauth_client_unittest.cc33
-rw-r--r--chrome/service/cloud_print/cloud_print_url_fetcher.cc36
-rw-r--r--chrome/service/cloud_print/cloud_print_url_fetcher.h14
-rw-r--r--chrome/service/gaia/service_gaia_authenticator.cc5
-rw-r--r--chrome/service/gaia/service_gaia_authenticator.h7
97 files changed, 892 insertions, 867 deletions
diff --git a/chrome/browser/alternate_nav_url_fetcher.cc b/chrome/browser/alternate_nav_url_fetcher.cc
index 3f7153e..0b4dc20 100644
--- a/chrome/browser/alternate_nav_url_fetcher.cc
+++ b/chrome/browser/alternate_nav_url_fetcher.cc
@@ -14,6 +14,7 @@
#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/public/browser/notification_service.h"
+#include "content/common/net/url_fetcher.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources_standard.h"
#include "net/base/registry_controlled_domain.h"
@@ -161,15 +162,10 @@ void AlternateNavURLFetcher::Observe(
}
}
-void AlternateNavURLFetcher::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void AlternateNavURLFetcher::OnURLFetchComplete(const URLFetcher* source) {
DCHECK_EQ(fetcher_.get(), source);
- SetStatusFromURLFetch(url, status, response_code);
+ SetStatusFromURLFetch(
+ source->url(), source->status(), source->response_code());
ShowInfobarIfPossible();
// WARNING: |this| may be deleted!
}
diff --git a/chrome/browser/alternate_nav_url_fetcher.h b/chrome/browser/alternate_nav_url_fetcher.h
index 1f71dd7..2bf5bbb 100644
--- a/chrome/browser/alternate_nav_url_fetcher.h
+++ b/chrome/browser/alternate_nav_url_fetcher.h
@@ -9,13 +9,17 @@
#include <string>
#include "base/memory/scoped_ptr.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "googleurl/src/gurl.h"
class NavigationController;
+namespace net {
+class URLRequestStatus;
+}
+
// Attempts to get the HEAD of a host name and displays an info bar if the
// request was successful. This is used for single-word queries where we can't
// tell if the entry was a search or an intranet hostname. The autocomplete bar
@@ -33,7 +37,7 @@ class NavigationController;
// * The intranet fetch fails
// * None of the above apply, so we successfully show an infobar
class AlternateNavURLFetcher : public content::NotificationObserver,
- public URLFetcher::Delegate {
+ public content::URLFetcherDelegate {
public:
enum State {
NOT_STARTED,
@@ -53,13 +57,8 @@ class AlternateNavURLFetcher : public content::NotificationObserver,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- // URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) OVERRIDE;
+ // content::URLFetcherDelegate
+ virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
// Sets |controller_| to the supplied pointer and begins fetching
// |alternate_nav_url_|.
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 240e969..6d0b188 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "content/common/net/url_fetcher.h"
#include "googleurl/src/url_util.h"
#include "grit/generated_resources.h"
#include "net/base/escape.h"
@@ -243,18 +244,14 @@ void SearchProvider::Stop() {
default_provider_suggest_text_.clear();
}
-void SearchProvider::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookie,
- const std::string& data) {
+void SearchProvider::OnURLFetchComplete(const URLFetcher* source) {
DCHECK(!done_);
suggest_results_pending_--;
DCHECK_GE(suggest_results_pending_, 0); // Should never go negative.
const net::HttpResponseHeaders* const response_headers =
source->response_headers();
- std::string json_data(data);
+ std::string json_data;
+ source->GetResponseAsString(&json_data);
// JSON is supposed to be UTF-8, but some suggest service providers send JSON
// files in non-UTF-8 encodings. The actual encoding is usually specified in
// the Content-Type header field.
@@ -263,7 +260,7 @@ void SearchProvider::OnURLFetchComplete(const URLFetcher* source,
if (response_headers->GetCharset(&charset)) {
string16 data_16;
// TODO(jungshik): Switch to CodePageToUTF8 after it's added.
- if (base::CodepageToUTF16(data, charset.c_str(),
+ if (base::CodepageToUTF16(json_data, charset.c_str(),
base::OnStringConversionError::FAIL,
&data_16))
json_data = UTF16ToUTF8(data_16);
@@ -274,7 +271,7 @@ void SearchProvider::OnURLFetchComplete(const URLFetcher* source,
SuggestResults* suggest_results = is_keyword_results ?
&keyword_suggest_results_ : &default_suggest_results_;
- if (status.is_success() && response_code == 200) {
+ if (source->status().is_success() && source->response_code() == 200) {
JSONStringValueSerializer deserializer(json_data);
deserializer.set_allow_trailing_comma(true);
scoped_ptr<Value> root_val(deserializer.Deserialize(NULL, NULL));
diff --git a/chrome/browser/autocomplete/search_provider.h b/chrome/browser/autocomplete/search_provider.h
index acdc719..e53be0b 100644
--- a/chrome/browser/autocomplete/search_provider.h
+++ b/chrome/browser/autocomplete/search_provider.h
@@ -26,7 +26,7 @@
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_id.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
class Profile;
@@ -45,7 +45,7 @@ class Value;
// comes back, the provider creates and returns matches for the best
// suggestions.
class SearchProvider : public AutocompleteProvider,
- public URLFetcher::Delegate {
+ public content::URLFetcherDelegate {
public:
SearchProvider(ACProviderListener* listener, Profile* profile);
@@ -70,13 +70,8 @@ class SearchProvider : public AutocompleteProvider,
bool minimal_changes) OVERRIDE;
virtual void Stop() OVERRIDE;
- // URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // content::URLFetcherDelegate
+ virtual void OnURLFetchComplete(const URLFetcher* source);
// ID used in creating URLFetcher for default provider's suggest results.
static const int kDefaultProviderURLFetcherID;
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index 1308b6a..ca9d3c0 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -239,9 +239,8 @@ void SearchProviderTest::FinishDefaultSuggestQuery() {
ASSERT_TRUE(default_fetcher);
// Tell the SearchProvider the default suggest query is done.
- default_fetcher->delegate()->OnURLFetchComplete(
- default_fetcher, GURL(), net::URLRequestStatus(), 200,
- net::ResponseCookies(), std::string());
+ default_fetcher->set_response_code(200);
+ default_fetcher->delegate()->OnURLFetchComplete(default_fetcher);
}
// Tests -----------------------------------------------------------------------
@@ -263,9 +262,8 @@ TEST_F(SearchProviderTest, QueryDefaultProvider) {
ASSERT_TRUE(fetcher->original_url() == expected_url);
// Tell the SearchProvider the suggest query is done.
- fetcher->delegate()->OnURLFetchComplete(
- fetcher, GURL(), net::URLRequestStatus(), 200, net::ResponseCookies(),
- std::string());
+ fetcher->set_response_code(200);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
fetcher = NULL;
// Run till the history results complete.
@@ -309,9 +307,8 @@ TEST_F(SearchProviderTest, QueryKeywordProvider) {
ASSERT_TRUE(default_fetcher);
// Tell the SearchProvider the default suggest query is done.
- default_fetcher->delegate()->OnURLFetchComplete(
- default_fetcher, GURL(), net::URLRequestStatus(), 200,
- net::ResponseCookies(), std::string());
+ default_fetcher->set_response_code(200);
+ default_fetcher->delegate()->OnURLFetchComplete(default_fetcher);
default_fetcher = NULL;
// Make sure the keyword providers suggest service was queried.
@@ -325,9 +322,8 @@ TEST_F(SearchProviderTest, QueryKeywordProvider) {
ASSERT_TRUE(keyword_fetcher->original_url() == expected_url);
// Tell the SearchProvider the keyword suggest query is done.
- keyword_fetcher->delegate()->OnURLFetchComplete(
- keyword_fetcher, GURL(), net::URLRequestStatus(), 200,
- net::ResponseCookies(), std::string());
+ keyword_fetcher->set_response_code(200);
+ keyword_fetcher->delegate()->OnURLFetchComplete(keyword_fetcher);
keyword_fetcher = NULL;
// Run till the history results complete.
@@ -650,10 +646,11 @@ TEST_F(SearchProviderTest, NoTemplateURLForNavsuggest) {
ASSERT_TRUE(fetcher);
// Tell the SearchProvider the suggest query is done.
- fetcher->delegate()->OnURLFetchComplete(
- fetcher, GURL(), net::URLRequestStatus(), 200, net::ResponseCookies(),
+ fetcher->set_response_code(200);
+ fetcher->SetResponseString(
"[\"a.c\",[\"a.com\"],[\"\"],[],"
"{\"google:suggesttype\":[\"NAVIGATION\"]}]");
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
fetcher = NULL;
// Run till the history results complete.
diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc
index 6dda02b..dedaea4 100644
--- a/chrome/browser/autofill/autofill_browsertest.cc
+++ b/chrome/browser/autofill/autofill_browsertest.cc
@@ -135,11 +135,11 @@ class AutofillTest : public InProcessBrowserTest {
" };"
"})();";
- fetcher->delegate()->OnURLFetchComplete(fetcher,
- fetcher->original_url(),
- status, success ? 200 : 500,
- net::ResponseCookies(),
- script);
+ fetcher->set_url(fetcher->original_url());
+ fetcher->set_status(status);
+ fetcher->set_response_code(success ? 200 : 500);
+ fetcher->SetResponseString(script);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
}
void FocusFirstNameField() {
diff --git a/chrome/browser/autofill/autofill_download.cc b/chrome/browser/autofill/autofill_download.cc
index 5423752..b6922fd 100644
--- a/chrome/browser/autofill/autofill_download.cc
+++ b/chrome/browser/autofill/autofill_download.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
+#include "content/common/net/url_fetcher.h"
#include "googleurl/src/gurl.h"
#include "net/http/http_response_headers.h"
#include "third_party/libjingle/source/talk/xmllite/xmlparser.h"
@@ -317,7 +318,8 @@ void AutofillDownloadManager::OnURLFetchComplete(const URLFetcher* source) {
} else {
VLOG(1) << "AutofillDownloadManager: " << type_of_request
<< " request has succeeded";
- const std::string& response_body = source->GetResponseStringRef();
+ std::string response_body;
+ source->GetResponseAsString(&response_body);
if (it->second.request_type == AutofillDownloadManager::REQUEST_QUERY) {
CacheQueryRequest(it->second.form_signatures, response_body);
if (observer_)
diff --git a/chrome/browser/autofill/autofill_download.h b/chrome/browser/autofill/autofill_download.h
index 8d430ef..2e1310f 100644
--- a/chrome/browser/autofill/autofill_download.h
+++ b/chrome/browser/autofill/autofill_download.h
@@ -13,10 +13,11 @@
#include <utility>
#include <vector>
+#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/time.h"
#include "chrome/browser/autofill/autofill_type.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
class AutofillMetrics;
class FormStructure;
@@ -28,7 +29,7 @@ class URLRequestStatus;
}
// Handles getting and updating Autofill heuristics.
-class AutofillDownloadManager : public URLFetcher::Delegate {
+class AutofillDownloadManager : public content::URLFetcherDelegate {
public:
enum AutofillRequestType {
REQUEST_QUERY,
@@ -124,7 +125,7 @@ class AutofillDownloadManager : public URLFetcher::Delegate {
std::string GetCombinedSignature(
const std::vector<std::string>& forms_in_query) const;
- // URLFetcher::Delegate implementation:
+ // content::URLFetcherDelegate implementation:
virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
// Probability of the form upload. Between 0 (no upload) and 1 (upload all).
diff --git a/chrome/browser/bug_report_util.cc b/chrome/browser/bug_report_util.cc
index 389b082..adf0f05 100644
--- a/chrome/browser/bug_report_util.cc
+++ b/chrome/browser/bug_report_util.cc
@@ -23,6 +23,7 @@
#include "chrome/common/chrome_version_info.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -79,20 +80,15 @@ const int64 kRetryDelayLimit = 14400000; // 4 hours
} // namespace
-// Simple URLFetcher::Delegate to clean up URLFetcher on completion.
-class BugReportUtil::PostCleanup : public URLFetcher::Delegate {
+// Simple content::URLFetcherDelegate to clean up URLFetcher on completion.
+class BugReportUtil::PostCleanup : public content::URLFetcherDelegate {
public:
PostCleanup(Profile* profile, std::string* post_body,
int64 previous_delay) : profile_(profile),
post_body_(post_body),
previous_delay_(previous_delay) { }
- // Overridden from URLFetcher::Delegate.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // Overridden from content::URLFetcherDelegate.
+ virtual void OnURLFetchComplete(const URLFetcher* source);
protected:
virtual ~PostCleanup() {}
@@ -108,15 +104,10 @@ class BugReportUtil::PostCleanup : public URLFetcher::Delegate {
// Don't use the data parameter, instead use the pointer we pass into every
// post cleanup object - that pointer will be deleted and deleted only on a
// successful post to the feedback server.
-void BugReportUtil::PostCleanup::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void BugReportUtil::PostCleanup::OnURLFetchComplete(const URLFetcher* source) {
std::stringstream error_stream;
+ int response_code = source->response_code();
if (response_code == kHttpPostSuccessNoContent) {
// We've sent our report, delete the report data
delete post_body_;
@@ -145,7 +136,7 @@ void BugReportUtil::PostCleanup::OnURLFetchComplete(
}
}
- LOG(WARNING) << "FEEDBACK: Submission to feedback server (" << url
+ LOG(WARNING) << "FEEDBACK: Submission to feedback server (" << source->url()
<< ") status: " << error_stream.str();
// Delete the URLFetcher.
diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc
index a12198f..f3edd9f 100644
--- a/chrome/browser/chromeos/customization_document.cc
+++ b/chrome/browser/chromeos/customization_document.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "content/browser/browser_thread.h"
+#include "content/common/net/url_fetcher.h"
// Manifest attributes names.
@@ -300,13 +301,10 @@ void ServicesCustomizationDocument::StartFileFetch() {
}
void ServicesCustomizationDocument::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
- if (response_code == 200) {
+ const URLFetcher* source) {
+ if (source->response_code() == 200) {
+ std::string data;
+ source->GetResponseAsString(&data);
LoadManifestFromString(data);
} else {
NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary();
@@ -318,8 +316,8 @@ void ServicesCustomizationDocument::OnURLFetchComplete(
return;
}
LOG(ERROR) << "URL fetch for services customization failed:"
- << " response code = " << response_code
- << " URL = " << url.spec();
+ << " response code = " << source->response_code()
+ << " URL = " << source->url().spec();
}
}
diff --git a/chrome/browser/chromeos/customization_document.h b/chrome/browser/chromeos/customization_document.h
index 9be728d..40d5783 100644
--- a/chrome/browser/chromeos/customization_document.h
+++ b/chrome/browser/chromeos/customization_document.h
@@ -13,7 +13,7 @@
#include "base/memory/singleton.h"
#include "base/timer.h"
#include "base/values.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
class FilePath;
@@ -111,7 +111,7 @@ class StartupCustomizationDocument : public CustomizationDocument {
// the manifest should be initiated outside this class by calling
// StartFetching() method. User of the file should check IsReady before use it.
class ServicesCustomizationDocument : public CustomizationDocument,
- private URLFetcher::Delegate {
+ private content::URLFetcherDelegate {
public:
static ServicesCustomizationDocument* GetInstance();
@@ -148,13 +148,8 @@ class ServicesCustomizationDocument : public CustomizationDocument,
// Save applied state in machine settings.
static void SetApplied(bool val);
- // Overriden from URLFetcher::Delegate:
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // Overriden from content::URLFetcherDelegate:
+ virtual void OnURLFetchComplete(const URLFetcher* source);
// Initiate file fetching.
void StartFileFetch();
diff --git a/chrome/browser/chromeos/login/auth_response_handler.h b/chrome/browser/chromeos/login/auth_response_handler.h
index f45c658..68fde40 100644
--- a/chrome/browser/chromeos/login/auth_response_handler.h
+++ b/chrome/browser/chromeos/login/auth_response_handler.h
@@ -8,7 +8,7 @@
#include <string>
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
class GURL;
@@ -31,7 +31,7 @@ class AuthResponseHandler {
// Starts the fetch and returns the fetcher, so the the caller can handle
// the object lifetime.
virtual URLFetcher* Handle(const std::string& to_process,
- URLFetcher::Delegate* catcher) = 0;
+ content::URLFetcherDelegate* catcher) = 0;
};
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/client_login_response_handler.cc b/chrome/browser/chromeos/login/client_login_response_handler.cc
index 61bc572..1b26c05 100644
--- a/chrome/browser/chromeos/login/client_login_response_handler.cc
+++ b/chrome/browser/chromeos/login/client_login_response_handler.cc
@@ -27,7 +27,7 @@ bool ClientLoginResponseHandler::CanHandle(const GURL& url) {
// Overridden from AuthResponseHandler.
URLFetcher* ClientLoginResponseHandler::Handle(
const std::string& to_process,
- URLFetcher::Delegate* catcher) {
+ content::URLFetcherDelegate* catcher) {
VLOG(1) << "Handling ClientLogin response!";
payload_.assign(to_process);
std::replace(payload_.begin(), payload_.end(), '\n', '&');
diff --git a/chrome/browser/chromeos/login/client_login_response_handler.h b/chrome/browser/chromeos/login/client_login_response_handler.h
index 5ea0045..5600bf9 100644
--- a/chrome/browser/chromeos/login/client_login_response_handler.h
+++ b/chrome/browser/chromeos/login/client_login_response_handler.h
@@ -35,7 +35,7 @@ class ClientLoginResponseHandler : public AuthResponseHandler {
// to sent to IssueAuthToken and issues said query. |catcher| will receive
// the response to the fetch.
virtual URLFetcher* Handle(const std::string& to_process,
- URLFetcher::Delegate* catcher);
+ content::URLFetcherDelegate* catcher);
// exposed for tests.
std::string payload() { return payload_; }
diff --git a/chrome/browser/chromeos/login/cookie_fetcher.cc b/chrome/browser/chromeos/login/cookie_fetcher.cc
index 7842776..e8401d8 100644
--- a/chrome/browser/chromeos/login/cookie_fetcher.cc
+++ b/chrome/browser/chromeos/login/cookie_fetcher.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_paths.h"
+#include "content/common/net/url_fetcher.h"
#include "net/url_request/url_request_status.h"
namespace chromeos {
@@ -40,15 +41,13 @@ void CookieFetcher::AttemptFetch(const std::string& credentials) {
fetcher_.reset(client_login_handler_->Handle(credentials, this));
}
-void CookieFetcher::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
- if (status.is_success() && response_code == kHttpSuccess) {
- if (issue_handler_->CanHandle(url)) {
+void CookieFetcher::OnURLFetchComplete(const URLFetcher* source) {
+ if (source->status().is_success() &&
+ source->response_code() == kHttpSuccess) {
+ if (issue_handler_->CanHandle(source->url())) {
VLOG(1) << "Handling auth token";
+ std::string data;
+ source->GetResponseAsString(&data);
fetcher_.reset(issue_handler_->Handle(data, this));
return;
}
diff --git a/chrome/browser/chromeos/login/cookie_fetcher.h b/chrome/browser/chromeos/login/cookie_fetcher.h
index fe7fc60..3c1cdef 100644
--- a/chrome/browser/chromeos/login/cookie_fetcher.h
+++ b/chrome/browser/chromeos/login/cookie_fetcher.h
@@ -12,7 +12,7 @@
#include "chrome/browser/chromeos/login/auth_response_handler.h"
#include "chrome/browser/chromeos/login/client_login_response_handler.h"
#include "chrome/browser/chromeos/login/issue_response_handler.h"
-#include "content/common/net/url_fetcher.h"
+
class Profile;
@@ -23,7 +23,7 @@ namespace chromeos {
//
// A CookieFetcher manages its own lifecycle. It deletes itself once it's
// done attempting to fetch URLs.
-class CookieFetcher : public URLFetcher::Delegate {
+class CookieFetcher : public content::URLFetcherDelegate {
public:
// |profile| is the Profile whose cookie jar you want the cookies in.
explicit CookieFetcher(Profile* profile);
@@ -41,13 +41,8 @@ class CookieFetcher : public URLFetcher::Delegate {
// Either way, we end up by calling launcher_->DoLaunch()
void AttemptFetch(const std::string& credentials);
- // Overloaded from URLFetcher::Delegate.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // Overloaded from content::URLFetcherDelegate.
+ virtual void OnURLFetchComplete(const URLFetcher* source);
private:
virtual ~CookieFetcher();
diff --git a/chrome/browser/chromeos/login/image_downloader.cc b/chrome/browser/chromeos/login/image_downloader.cc
index c94f91d..52992fc 100644
--- a/chrome/browser/chromeos/login/image_downloader.cc
+++ b/chrome/browser/chromeos/login/image_downloader.cc
@@ -12,6 +12,7 @@
#include "base/stringprintf.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "content/browser/browser_thread.h"
+#include "content/common/net/url_fetcher.h"
namespace chromeos {
@@ -39,16 +40,13 @@ ImageDownloader::ImageDownloader(ImageDecoder::Delegate* delegate,
ImageDownloader::~ImageDownloader() {}
-void ImageDownloader::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void ImageDownloader::OnURLFetchComplete(const URLFetcher* source) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (response_code != 200) {
- LOG(ERROR) << "Response code is " << response_code;
- LOG(ERROR) << "Url is " << url.spec();
+ std::string data;
+ source->GetResponseAsString(&data);
+ if (source->response_code() != 200) {
+ LOG(ERROR) << "Response code is " << source->response_code();
+ LOG(ERROR) << "Url is " << source->url().spec();
LOG(ERROR) << "Data is " << data;
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
return;
diff --git a/chrome/browser/chromeos/login/image_downloader.h b/chrome/browser/chromeos/login/image_downloader.h
index 48beeb5..b14fed4 100644
--- a/chrome/browser/chromeos/login/image_downloader.h
+++ b/chrome/browser/chromeos/login/image_downloader.h
@@ -11,14 +11,14 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/login/image_decoder.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
namespace chromeos {
// Downloads the image, decodes it in a sandboxed process.
// This objects deletes itself after OnURLFetchComplete.
-class ImageDownloader : public URLFetcher::Delegate {
+class ImageDownloader : public content::URLFetcherDelegate {
public:
// Starts downloading the picture. Optional auth_token could be passed.
// Object is deleted as reference counted object.
@@ -28,13 +28,8 @@ class ImageDownloader : public URLFetcher::Delegate {
virtual ~ImageDownloader();
private:
- // Overriden from URLFetcher::Delegate:
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // Overriden from content::URLFetcherDelegate:
+ virtual void OnURLFetchComplete(const URLFetcher* source);
ImageDecoder::Delegate* delegate_;
scoped_ptr<URLFetcher> image_fetcher_;
diff --git a/chrome/browser/chromeos/login/issue_response_handler.cc b/chrome/browser/chromeos/login/issue_response_handler.cc
index 6ccb54a..acbcd8a 100644
--- a/chrome/browser/chromeos/login/issue_response_handler.cc
+++ b/chrome/browser/chromeos/login/issue_response_handler.cc
@@ -23,7 +23,7 @@ bool IssueResponseHandler::CanHandle(const GURL& url) {
// Overridden from AuthResponseHandler.
URLFetcher* IssueResponseHandler::Handle(
const std::string& to_process,
- URLFetcher::Delegate* catcher) {
+ content::URLFetcherDelegate* catcher) {
VLOG(1) << "Handling IssueAuthToken response";
token_url_.assign(BuildTokenAuthUrlWithToken(to_process));
URLFetcher* fetcher =
diff --git a/chrome/browser/chromeos/login/issue_response_handler.h b/chrome/browser/chromeos/login/issue_response_handler.h
index a79f9af..1dfb71a 100644
--- a/chrome/browser/chromeos/login/issue_response_handler.h
+++ b/chrome/browser/chromeos/login/issue_response_handler.h
@@ -37,7 +37,7 @@ class IssueResponseHandler : public AuthResponseHandler {
// the response to the fetch. This fetch will follow redirects, which is
// necesary to support GAFYD and corp accounts.
virtual URLFetcher* Handle(const std::string& to_process,
- URLFetcher::Delegate* catcher);
+ content::URLFetcherDelegate* catcher);
// exposed for testing
std::string token_url() { return token_url_; }
diff --git a/chrome/browser/chromeos/login/mock_auth_response_handler.cc b/chrome/browser/chromeos/login/mock_auth_response_handler.cc
index 9947d83..f3805a3 100644
--- a/chrome/browser/chromeos/login/mock_auth_response_handler.cc
+++ b/chrome/browser/chromeos/login/mock_auth_response_handler.cc
@@ -9,6 +9,8 @@
#include "base/bind.h"
#include "base/message_loop.h"
#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
+#include "content/test/test_url_fetcher_factory.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_status.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -36,22 +38,23 @@ MockAuthResponseHandler::MockAuthResponseHandler(
MockAuthResponseHandler::~MockAuthResponseHandler() {}
-void MockAuthResponseHandler::CompleteFetch(URLFetcher::Delegate* delegate,
- const GURL remote,
- const net::URLRequestStatus status,
- const int http_response_code,
- const std::string data) {
- delegate->OnURLFetchComplete(NULL,
- remote,
- status,
- http_response_code,
- net::ResponseCookies(),
- data);
+void MockAuthResponseHandler::CompleteFetch(
+ content::URLFetcherDelegate* delegate,
+ const GURL remote,
+ const net::URLRequestStatus status,
+ const int http_response_code,
+ const std::string data) {
+ TestURLFetcher fetcher(0, GURL(), URLFetcher::GET, delegate);
+ fetcher.set_url(remote);
+ fetcher.set_status(status);
+ fetcher.set_response_code(http_response_code);
+ fetcher.SetResponseString(data);
+ delegate->OnURLFetchComplete(&fetcher);
}
URLFetcher* MockAuthResponseHandler::MockNetwork(
std::string data,
- URLFetcher::Delegate* delegate) {
+ content::URLFetcherDelegate* delegate) {
MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(MockAuthResponseHandler::CompleteFetch, delegate, remote_,
diff --git a/chrome/browser/chromeos/login/mock_auth_response_handler.h b/chrome/browser/chromeos/login/mock_auth_response_handler.h
index 5c37cc7..9f449be 100644
--- a/chrome/browser/chromeos/login/mock_auth_response_handler.h
+++ b/chrome/browser/chromeos/login/mock_auth_response_handler.h
@@ -35,9 +35,10 @@ class MockAuthResponseHandler : public AuthResponseHandler {
MOCK_METHOD1(CanHandle, bool(const GURL& url));
MOCK_METHOD2(Handle, URLFetcher*(const std::string& to_process,
- URLFetcher::Delegate* catcher));
+ content::URLFetcherDelegate* catcher));
- URLFetcher* MockNetwork(std::string data, URLFetcher::Delegate* delegate);
+ URLFetcher* MockNetwork(std::string data,
+ content::URLFetcherDelegate* delegate);
private:
const GURL remote_;
@@ -45,7 +46,7 @@ class MockAuthResponseHandler : public AuthResponseHandler {
const int http_response_code_;
const std::string data_;
- static void CompleteFetch(URLFetcher::Delegate* delegate,
+ static void CompleteFetch(content::URLFetcherDelegate* delegate,
const GURL remote,
const net::URLRequestStatus status,
const int http_response_code,
diff --git a/chrome/browser/chromeos/login/mock_url_fetchers.cc b/chrome/browser/chromeos/login/mock_url_fetchers.cc
index 70e2276..da43213 100644
--- a/chrome/browser/chromeos/login/mock_url_fetchers.cc
+++ b/chrome/browser/chromeos/login/mock_url_fetchers.cc
@@ -11,7 +11,7 @@
#include "base/stringprintf.h"
#include "chrome/common/net/http_return.h"
#include "content/browser/browser_thread.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_status.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -23,7 +23,7 @@ ExpectCanceledFetcher::ExpectCanceledFetcher(
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d)
+ content::URLFetcherDelegate* d)
: URLFetcher(url, request_type, d),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
}
@@ -48,64 +48,84 @@ GotCanceledFetcher::GotCanceledFetcher(bool success,
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d)
+ content::URLFetcherDelegate* d)
: URLFetcher(url, request_type, d),
- url_(url) {
+ url_(url),
+ status_(net::URLRequestStatus::CANCELED, 0) {
}
GotCanceledFetcher::~GotCanceledFetcher() {}
void GotCanceledFetcher::Start() {
- net::URLRequestStatus status;
- status.set_status(net::URLRequestStatus::CANCELED);
- delegate()->OnURLFetchComplete(this,
- url_,
- status,
- RC_FORBIDDEN,
- net::ResponseCookies(),
- std::string());
+ delegate()->OnURLFetchComplete(this);
+}
+
+const GURL& GotCanceledFetcher::url() const {
+ return url_;
+}
+
+const net::URLRequestStatus& GotCanceledFetcher::status() const {
+ return status_;
+}
+
+int GotCanceledFetcher::response_code() const {
+ return RC_FORBIDDEN;
}
SuccessFetcher::SuccessFetcher(bool success,
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d)
+ content::URLFetcherDelegate* d)
: URLFetcher(url, request_type, d),
- url_(url) {
+ url_(url),
+ status_(net::URLRequestStatus::SUCCESS, 0) {
}
SuccessFetcher::~SuccessFetcher() {}
void SuccessFetcher::Start() {
- net::URLRequestStatus success(net::URLRequestStatus::SUCCESS, 0);
- delegate()->OnURLFetchComplete(this,
- url_,
- success,
- RC_REQUEST_OK,
- net::ResponseCookies(),
- std::string());
+ delegate()->OnURLFetchComplete(this);
+}
+
+const GURL& SuccessFetcher::url() const {
+ return url_;
+}
+
+const net::URLRequestStatus& SuccessFetcher::status() const {
+ return status_;
+}
+
+int SuccessFetcher::response_code() const {
+ return RC_REQUEST_OK;
}
FailFetcher::FailFetcher(bool success,
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d)
+ content::URLFetcherDelegate* d)
: URLFetcher(url, request_type, d),
- url_(url) {
+ url_(url),
+ status_(net::URLRequestStatus::FAILED, ECONNRESET) {
}
FailFetcher::~FailFetcher() {}
void FailFetcher::Start() {
- net::URLRequestStatus failed(net::URLRequestStatus::FAILED, ECONNRESET);
- delegate()->OnURLFetchComplete(this,
- url_,
- failed,
- RC_REQUEST_OK,
- net::ResponseCookies(),
- std::string());
+ delegate()->OnURLFetchComplete(this);
+}
+
+const GURL& FailFetcher::url() const {
+ return url_;
+}
+
+const net::URLRequestStatus& FailFetcher::status() const {
+ return status_;
+}
+
+int FailFetcher::response_code() const {
+ return RC_REQUEST_OK;
}
// static
@@ -122,9 +142,18 @@ CaptchaFetcher::CaptchaFetcher(bool success,
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d)
+ content::URLFetcherDelegate* d)
: URLFetcher(url, request_type, d),
- url_(url) {
+ url_(url),
+ status_(net::URLRequestStatus::SUCCESS, 0) {
+ data_ = base::StringPrintf("Error=%s\n"
+ "Url=%s\n"
+ "CaptchaUrl=%s\n"
+ "CaptchaToken=%s\n",
+ "CaptchaRequired",
+ kUnlockUrl,
+ kCaptchaUrlFragment,
+ kCaptchaToken);
}
CaptchaFetcher::~CaptchaFetcher() {}
@@ -145,50 +174,66 @@ std::string CaptchaFetcher::GetUnlockUrl() {
}
void CaptchaFetcher::Start() {
- net::URLRequestStatus success(net::URLRequestStatus::SUCCESS, 0);
- std::string body = base::StringPrintf("Error=%s\n"
- "Url=%s\n"
- "CaptchaUrl=%s\n"
- "CaptchaToken=%s\n",
- "CaptchaRequired",
- kUnlockUrl,
- kCaptchaUrlFragment,
- kCaptchaToken);
- delegate()->OnURLFetchComplete(this,
- url_,
- success,
- RC_FORBIDDEN,
- net::ResponseCookies(),
- body);
+ delegate()->OnURLFetchComplete(this);
+}
+
+const GURL& CaptchaFetcher::url() const {
+ return url_;
+}
+
+const net::URLRequestStatus& CaptchaFetcher::status() const {
+ return status_;
+}
+
+int CaptchaFetcher::response_code() const {
+ return RC_FORBIDDEN;
+}
+
+bool CaptchaFetcher::GetResponseAsString(
+ std::string* out_response_string) const {
+ *out_response_string = data_;
+ return true;
}
HostedFetcher::HostedFetcher(bool success,
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d)
+ content::URLFetcherDelegate* d)
: URLFetcher(url, request_type, d),
- url_(url) {
+ url_(url),
+ status_(net::URLRequestStatus::SUCCESS, 0),
+ response_code_(RC_REQUEST_OK) {
}
HostedFetcher::~HostedFetcher() {}
void HostedFetcher::Start() {
- net::URLRequestStatus success(net::URLRequestStatus::SUCCESS, 0);
- int response_code = RC_REQUEST_OK;
- std::string data;
VLOG(1) << upload_data();
if (upload_data().find("HOSTED") == std::string::npos) {
VLOG(1) << "HostedFetcher failing request";
- response_code = RC_FORBIDDEN;
- data.assign("Error=BadAuthentication");
+ response_code_ = RC_FORBIDDEN;
+ data_.assign("Error=BadAuthentication");
}
- delegate()->OnURLFetchComplete(this,
- url_,
- success,
- response_code,
- net::ResponseCookies(),
- data);
+ delegate()->OnURLFetchComplete(this);
+}
+
+const GURL& HostedFetcher::url() const {
+ return url_;
+}
+
+const net::URLRequestStatus& HostedFetcher::status() const {
+ return status_;
+}
+
+int HostedFetcher::response_code() const {
+ return response_code_;;
+}
+
+bool HostedFetcher::GetResponseAsString(
+ std::string* out_response_string) const {
+ *out_response_string = data_;
+ return true;
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/mock_url_fetchers.h b/chrome/browser/chromeos/login/mock_url_fetchers.h
index 2be8891..4fa18ef 100644
--- a/chrome/browser/chromeos/login/mock_url_fetchers.h
+++ b/chrome/browser/chromeos/login/mock_url_fetchers.h
@@ -15,6 +15,10 @@
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_status.h"
+namespace content {
+class URLFetcherDelegate;
+}
+
namespace chromeos {
// Simulates a URL fetch by posting a delayed task. This fetch expects to be
@@ -25,7 +29,7 @@ class ExpectCanceledFetcher : public URLFetcher {
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d);
+ content::URLFetcherDelegate* d);
virtual ~ExpectCanceledFetcher();
virtual void Start();
@@ -43,13 +47,18 @@ class GotCanceledFetcher : public URLFetcher {
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d);
+ content::URLFetcherDelegate* d);
virtual ~GotCanceledFetcher();
virtual void Start();
+ virtual const GURL& url() const;
+ virtual const net::URLRequestStatus& status() const;
+ virtual int response_code() const;
+
private:
GURL url_;
+ net::URLRequestStatus status_;
DISALLOW_COPY_AND_ASSIGN(GotCanceledFetcher);
};
@@ -60,13 +69,18 @@ class SuccessFetcher : public URLFetcher {
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d);
+ content::URLFetcherDelegate* d);
virtual ~SuccessFetcher();
virtual void Start();
+ virtual const GURL& url() const;
+ virtual const net::URLRequestStatus& status() const;
+ virtual int response_code() const;
+
private:
GURL url_;
+ net::URLRequestStatus status_;
DISALLOW_COPY_AND_ASSIGN(SuccessFetcher);
};
@@ -77,13 +91,18 @@ class FailFetcher : public URLFetcher {
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d);
+ content::URLFetcherDelegate* d);
virtual ~FailFetcher();
virtual void Start();
+ virtual const GURL& url() const;
+ virtual const net::URLRequestStatus& status() const;
+ virtual int response_code() const;
+
private:
GURL url_;
+ net::URLRequestStatus status_;
DISALLOW_COPY_AND_ASSIGN(FailFetcher);
};
@@ -94,7 +113,7 @@ class CaptchaFetcher : public URLFetcher {
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d);
+ content::URLFetcherDelegate* d);
virtual ~CaptchaFetcher();
static std::string GetCaptchaToken();
@@ -103,12 +122,19 @@ class CaptchaFetcher : public URLFetcher {
virtual void Start();
+ virtual const GURL& url() const;
+ virtual const net::URLRequestStatus& status() const;
+ virtual int response_code() const;
+ virtual bool GetResponseAsString(std::string* out_response_string) const;
+
private:
static const char kCaptchaToken[];
static const char kCaptchaUrlBase[];
static const char kCaptchaUrlFragment[];
static const char kUnlockUrl[];
GURL url_;
+ net::URLRequestStatus status_;
+ std::string data_;
DISALLOW_COPY_AND_ASSIGN(CaptchaFetcher);
};
@@ -119,13 +145,21 @@ class HostedFetcher : public URLFetcher {
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d);
+ content::URLFetcherDelegate* d);
virtual ~HostedFetcher();
virtual void Start();
+ virtual const GURL& url() const;
+ virtual const net::URLRequestStatus& status() const;
+ virtual int response_code() const;
+ virtual bool GetResponseAsString(std::string* out_response_string) const;
+
private:
GURL url_;
+ net::URLRequestStatus status_;
+ int response_code_;
+ std::string data_;
DISALLOW_COPY_AND_ASSIGN(HostedFetcher);
};
diff --git a/chrome/browser/chromeos/login/profile_image_downloader.cc b/chrome/browser/chromeos/login/profile_image_downloader.cc
index 1cc7e72..74999a3 100644
--- a/chrome/browser/chromeos/login/profile_image_downloader.cc
+++ b/chrome/browser/chromeos/login/profile_image_downloader.cc
@@ -18,6 +18,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/net/gaia/gaia_constants.h"
#include "content/browser/browser_thread.h"
+#include "content/common/net/url_fetcher.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -155,9 +156,8 @@ ProfileImageDownloader::~ProfileImageDownloader() {}
void ProfileImageDownloader::OnURLFetchComplete(const URLFetcher* source) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- const std::string& data = source->GetResponseStringRef();
-
+ std::string data;
+ source->GetResponseAsString(&data);
if (source->response_code() != 200) {
LOG(ERROR) << "Response code is " << source->response_code();
LOG(ERROR) << "Url is " << source->url().spec();
@@ -186,7 +186,8 @@ void ProfileImageDownloader::OnURLFetchComplete(const URLFetcher* source) {
profile_image_fetcher_->Start();
} else if (source == profile_image_fetcher_.get()) {
VLOG(1) << "Decoding the image...";
- scoped_refptr<ImageDecoder> image_decoder = new ImageDecoder(this, data);
+ scoped_refptr<ImageDecoder> image_decoder = new ImageDecoder(
+ this, data);
image_decoder->Start();
}
}
diff --git a/chrome/browser/chromeos/login/profile_image_downloader.h b/chrome/browser/chromeos/login/profile_image_downloader.h
index d037666..50a7cb4 100644
--- a/chrome/browser/chromeos/login/profile_image_downloader.h
+++ b/chrome/browser/chromeos/login/profile_image_downloader.h
@@ -11,15 +11,15 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/login/image_decoder.h"
-#include "content/common/net/url_fetcher.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
namespace chromeos {
// Downloads user profile image, decodes it in a sandboxed process.
-class ProfileImageDownloader : public URLFetcher::Delegate,
+class ProfileImageDownloader : public content::URLFetcherDelegate,
public ImageDecoder::Delegate,
public content::NotificationObserver {
public:
@@ -44,7 +44,7 @@ class ProfileImageDownloader : public URLFetcher::Delegate,
void Start();
private:
- // Overriden from URLFetcher::Delegate:
+ // Overriden from content::URLFetcherDelegate:
virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
// Overriden from ImageDecoder::Delegate:
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index 43bc3c9..bde9ce7 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -26,6 +26,7 @@
#include "content/browser/utility_process_host.h"
#include "content/common/net/url_fetcher.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
@@ -96,7 +97,7 @@ bool IsVersionNewer(const Version& current, const std::string& proposed) {
// OnURLFetchComplete() callbacks for diffent types of url requests
// they are differentiated by the |Ctx| type.
template <typename Del, typename Ctx>
-class DelegateWithContext : public URLFetcher::Delegate {
+class DelegateWithContext : public content::URLFetcherDelegate {
public:
DelegateWithContext(Del* delegate, Ctx* context)
: delegate_(delegate), context_(context) {}
@@ -114,7 +115,7 @@ class DelegateWithContext : public URLFetcher::Delegate {
};
// This function creates the right DelegateWithContext using template inference.
template <typename Del, typename Ctx>
-URLFetcher::Delegate* MakeContextDelegate(Del* delegate, Ctx* context) {
+content::URLFetcherDelegate* MakeContextDelegate(Del* delegate, Ctx* context) {
return new DelegateWithContext<Del, Ctx>(delegate, context);
}
diff --git a/chrome/browser/extensions/app_notify_channel_setup.cc b/chrome/browser/extensions/app_notify_channel_setup.cc
index 6ccb00e..c52e7b2 100644
--- a/chrome/browser/extensions/app_notify_channel_setup.cc
+++ b/chrome/browser/extensions/app_notify_channel_setup.cc
@@ -10,6 +10,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "content/browser/browser_thread.h"
+#include "content/common/net/url_fetcher.h"
#include "net/base/escape.h"
#include "net/url_request/url_request_status.h"
diff --git a/chrome/browser/extensions/app_notify_channel_setup.h b/chrome/browser/extensions/app_notify_channel_setup.h
index 21ffa3a..b489e91 100644
--- a/chrome/browser/extensions/app_notify_channel_setup.h
+++ b/chrome/browser/extensions/app_notify_channel_setup.h
@@ -8,7 +8,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
class Profile;
@@ -16,7 +16,7 @@ class Profile;
// This class uses the browser login credentials to fetch a channel ID for an
// app to use when sending server push notifications.
class AppNotifyChannelSetup
- : public URLFetcher::Delegate,
+ : public content::URLFetcherDelegate,
public base::RefCountedThreadSafe<AppNotifyChannelSetup> {
public:
class Delegate {
@@ -43,7 +43,7 @@ class AppNotifyChannelSetup
void Start();
protected:
- // URLFetcher::Delegate.
+ // content::URLFetcherDelegate.
virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
private:
diff --git a/chrome/browser/extensions/apps_promo.cc b/chrome/browser/extensions/apps_promo.cc
index 6fd273c..9f181dd39 100644
--- a/chrome/browser/extensions/apps_promo.cc
+++ b/chrome/browser/extensions/apps_promo.cc
@@ -17,6 +17,7 @@
#include "chrome/common/pref_names.h"
#include "content/public/browser/notification_service.h"
#include "content/public/common/url_constants.h"
+#include "content/common/net/url_fetcher.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_status.h"
@@ -352,7 +353,7 @@ void AppsPromoLogoFetcher::OnURLFetchComplete(const URLFetcher* source) {
std::string base64_data;
CHECK(source == url_fetcher_.get());
- CHECK(source->GetResponseAsString(&data));
+ source->GetResponseAsString(&data);
if (source->status().is_success() &&
source->response_code() == kHttpSuccess &&
diff --git a/chrome/browser/extensions/apps_promo.h b/chrome/browser/extensions/apps_promo.h
index 248865a..bbbdb74 100644
--- a/chrome/browser/extensions/apps_promo.h
+++ b/chrome/browser/extensions/apps_promo.h
@@ -11,7 +11,7 @@
#include "base/gtest_prod_util.h"
#include "chrome/common/extensions/extension.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
class PrefService;
class Profile;
@@ -148,7 +148,7 @@ class AppsPromo {
// Fetches logos over HTTPS, making sure we don't send cookies and that we
// cache the image until its source URL changes.
-class AppsPromoLogoFetcher : public URLFetcher::Delegate {
+class AppsPromoLogoFetcher : public content::URLFetcherDelegate {
public:
AppsPromoLogoFetcher(Profile* profile,
AppsPromo::PromoData promo_data);
diff --git a/chrome/browser/extensions/extension_management_browsertest.cc b/chrome/browser/extensions/extension_management_browsertest.cc
index feddcdc..460bcb4 100644
--- a/chrome/browser/extensions/extension_management_browsertest.cc
+++ b/chrome/browser/extensions/extension_management_browsertest.cc
@@ -21,6 +21,7 @@
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/browser/renderer_host/render_view_host.h"
+#include "content/common/net/url_fetcher.h"
#include "content/public/browser/notification_service.h"
class ExtensionManagementTest : public ExtensionBrowserTest {
diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc
index 2294c1d..761ac06 100644
--- a/chrome/browser/extensions/extension_updater.cc
+++ b/chrome/browser/extensions/extension_updater.cc
@@ -37,6 +37,7 @@
#include "chrome/common/extensions/extension_file_util.h"
#include "chrome/common/pref_names.h"
#include "content/browser/utility_process_host.h"
+#include "content/common/net/url_fetcher.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "crypto/sha2.h"
@@ -597,7 +598,7 @@ void ExtensionUpdater::OnURLFetchComplete(const URLFetcher* source) {
if (source == manifest_fetcher_.get()) {
std::string data;
- CHECK(source->GetResponseAsString(&data));
+ source->GetResponseAsString(&data);
OnManifestFetchComplete(source->url(),
source->status(),
source->response_code(),
@@ -843,7 +844,7 @@ void ExtensionUpdater::OnCRXFetchComplete(
(response_code == 200 || url.SchemeIsFile())) {
if (current_extension_fetch_.id == kBlacklistAppID) {
std::string data;
- CHECK(source->GetResponseAsString(&data));
+ source->GetResponseAsString(&data);
ProcessBlacklist(data);
in_progress_ids_.erase(current_extension_fetch_.id);
} else {
diff --git a/chrome/browser/extensions/extension_updater.h b/chrome/browser/extensions/extension_updater.h
index f07d08d..d4f7b50 100644
--- a/chrome/browser/extensions/extension_updater.h
+++ b/chrome/browser/extensions/extension_updater.h
@@ -23,7 +23,7 @@
#include "base/timer.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/common/extensions/update_manifest.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
class Extension;
@@ -33,6 +33,10 @@ class PrefService;
class Profile;
class SafeManifestParser;
+namespace net {
+class URLRequestStatus;
+}
+
// To save on server resources we can request updates for multiple extensions
// in one manifest check. This class helps us keep track of the id's for a
// given fetch, building up the actual URL, and what if anything to include
@@ -165,7 +169,7 @@ class ManifestFetchesBuilder {
// updater->Start();
// ....
// updater->Stop();
-class ExtensionUpdater : public URLFetcher::Delegate,
+class ExtensionUpdater : public content::URLFetcherDelegate,
public content::NotificationObserver {
public:
// Holds a pointer to the passed |service|, using it for querying installed
@@ -250,7 +254,7 @@ class ExtensionUpdater : public URLFetcher::Delegate,
// Computes when to schedule the first update check.
base::TimeDelta DetermineFirstCheckDelay();
- // URLFetcher::Delegate interface.
+ // content::URLFetcherDelegate interface.
virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
// These do the actual work when a URL fetch completes.
diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc
index 4a2ddfe..6c938ec 100644
--- a/chrome/browser/extensions/webstore_inline_installer.cc
+++ b/chrome/browser/extensions/webstore_inline_installer.cc
@@ -20,6 +20,7 @@
#include "chrome/common/extensions/url_pattern.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/utility_process_host.h"
+#include "content/common/net/url_fetcher.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_status.h"
diff --git a/chrome/browser/extensions/webstore_inline_installer.h b/chrome/browser/extensions/webstore_inline_installer.h
index 2b2cf05..c66693b 100644
--- a/chrome/browser/extensions/webstore_inline_installer.h
+++ b/chrome/browser/extensions/webstore_inline_installer.h
@@ -15,7 +15,7 @@
#include "chrome/browser/extensions/webstore_installer.h"
#include "chrome/browser/extensions/webstore_install_helper.h"
#include "content/browser/tab_contents/tab_contents_observer.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -32,7 +32,7 @@ class WebstoreInlineInstaller
: public base::RefCountedThreadSafe<WebstoreInlineInstaller>,
public ExtensionInstallUI::Delegate,
public TabContentsObserver,
- public URLFetcher::Delegate,
+ public content::URLFetcherDelegate,
public WebstoreInstaller::Delegate,
public WebstoreInstallHelper::Delegate {
public:
@@ -69,7 +69,7 @@ class WebstoreInlineInstaller
// All flows (whether successful or not) end up in CompleteInstall, which
// informs our delegate of success/failure.
- // UrlFetcher::Delegate interface implementation.
+ // content::URLFetcherDelegate interface implementation.
virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
// Client callbacks for SafeWebstoreResponseParser when parsing is complete.
diff --git a/chrome/browser/extensions/webstore_install_helper.cc b/chrome/browser/extensions/webstore_install_helper.cc
index af530c5..5a54041 100644
--- a/chrome/browser/extensions/webstore_install_helper.cc
+++ b/chrome/browser/extensions/webstore_install_helper.cc
@@ -10,6 +10,7 @@
#include "base/values.h"
#include "chrome/common/chrome_utility_messages.h"
#include "content/browser/browser_thread.h"
+#include "content/common/net/url_fetcher.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_status.h"
diff --git a/chrome/browser/extensions/webstore_install_helper.h b/chrome/browser/extensions/webstore_install_helper.h
index 70d122b..9160548 100644
--- a/chrome/browser/extensions/webstore_install_helper.h
+++ b/chrome/browser/extensions/webstore_install_helper.h
@@ -7,7 +7,7 @@
#pragma once
#include "content/browser/utility_process_host.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -19,12 +19,16 @@ class DictionaryValue;
class ListValue;
}
+namespace net {
+class URLRequestContextGetter;
+}
+
// This is a class to help dealing with webstore-provided data. It manages
// sending work to the utility process for parsing manifests and
// fetching/decoding icon data. Clients must implement the
// WebstoreInstallHelper::Delegate interface to receive the parsed data.
class WebstoreInstallHelper : public UtilityProcessHost::Client,
- public URLFetcher::Delegate {
+ public content::URLFetcherDelegate {
public:
class Delegate {
public:
@@ -64,7 +68,7 @@ class WebstoreInstallHelper : public UtilityProcessHost::Client,
void ReportResultsIfComplete();
void ReportResultFromUIThread();
- // Implementing the URLFetcher::Delegate interface.
+ // Implementing the content::URLFetcherDelegate interface.
virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
// Implementing pieces of the UtilityProcessHost::Client interface.
diff --git a/chrome/browser/google/google_url_tracker.cc b/chrome/browser/google/google_url_tracker.cc
index 20e18b8..39ed011 100644
--- a/chrome/browser/google/google_url_tracker.cc
+++ b/chrome/browser/google/google_url_tracker.cc
@@ -22,6 +22,7 @@
#include "chrome/common/pref_names.h"
#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/common/net/url_fetcher.h"
#include "content/public/browser/notification_service.h"
#include "grit/generated_resources.h"
#include "net/base/load_flags.h"
@@ -221,17 +222,12 @@ void GoogleURLTracker::StartFetchIfDesirable() {
fetcher_->Start();
}
-void GoogleURLTracker::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void GoogleURLTracker::OnURLFetchComplete(const URLFetcher* source) {
// Delete the fetcher on this function's exit.
scoped_ptr<URLFetcher> clean_up_fetcher(fetcher_.release());
// Don't update the URL if the request didn't succeed.
- if (!status.is_success() || (response_code != 200)) {
+ if (!source->status().is_success() || (source->response_code() != 200)) {
already_fetched_ = false;
return;
}
@@ -239,7 +235,8 @@ void GoogleURLTracker::OnURLFetchComplete(const URLFetcher* source,
// See if the response data was one we want to use, and if so, convert to the
// appropriate Google base URL.
std::string url_str;
- TrimWhitespace(data, TRIM_ALL, &url_str);
+ source->GetResponseAsString(&url_str);
+ TrimWhitespace(url_str, TRIM_ALL, &url_str);
if (!StartsWithASCII(url_str, ".google.", false))
return;
diff --git a/chrome/browser/google/google_url_tracker.h b/chrome/browser/google/google_url_tracker.h
index 9f5c3f7..bdf2267 100644
--- a/chrome/browser/google/google_url_tracker.h
+++ b/chrome/browser/google/google_url_tracker.h
@@ -12,7 +12,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "googleurl/src/gurl.h"
@@ -36,7 +36,7 @@ class TemplateURL;
// To protect users' privacy and reduce server load, no updates will be
// performed (ever) unless at least one consumer registers interest by calling
// RequestServerCheck().
-class GoogleURLTracker : public URLFetcher::Delegate,
+class GoogleURLTracker : public content::URLFetcherDelegate,
public content::NotificationObserver,
public net::NetworkChangeNotifier::IPAddressObserver {
public:
@@ -106,13 +106,8 @@ class GoogleURLTracker : public URLFetcher::Delegate,
// it and can currently do so.
void StartFetchIfDesirable();
- // URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher *source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // content::URLFetcherDelegate
+ virtual void OnURLFetchComplete(const URLFetcher *source);
// content::NotificationObserver
virtual void Observe(int type,
diff --git a/chrome/browser/google/google_url_tracker_unittest.cc b/chrome/browser/google/google_url_tracker_unittest.cc
index d224c05..9655868 100644
--- a/chrome/browser/google/google_url_tracker_unittest.cc
+++ b/chrome/browser/google/google_url_tracker_unittest.cc
@@ -179,9 +179,10 @@ void GoogleURLTrackerTest::MockSearchDomainCheckResponse(
TestURLFetcher* fetcher = fetcher_factory_.GetFetcherByID(expected_id);
if (!fetcher)
return;
- fetcher->delegate()->OnURLFetchComplete(fetcher,
- GURL(GoogleURLTracker::kSearchDomainCheckURL), net::URLRequestStatus(),
- 200, net::ResponseCookies(), domain);
+ fetcher->set_url(GURL(GoogleURLTracker::kSearchDomainCheckURL));
+ fetcher->set_response_code(200);
+ fetcher->SetResponseString(domain);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
// At this point, |fetcher| is deleted.
MessageLoop::current()->RunAllPending();
}
diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc
index 3debf4c..c36d8a5 100644
--- a/chrome/browser/importer/toolbar_importer.cc
+++ b/chrome/browser/importer/toolbar_importer.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/libxml_utils.h"
#include "content/browser/browser_thread.h"
+#include "content/common/net/url_fetcher.h"
#include "grit/generated_resources.h"
// Toolbar5Importer
@@ -96,25 +97,21 @@ void Toolbar5Importer::Cancel() {
}
}
-void Toolbar5Importer::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void Toolbar5Importer::OnURLFetchComplete(const URLFetcher* source) {
if (cancelled()) {
EndImport();
return;
}
- if (200 != response_code) { // HTTP/Ok
+ if (200 != source->response_code()) { // HTTP/Ok
// Cancelling here will update the UI and bypass the rest of bookmark
// import.
EndImportBookmarks();
return;
}
+ std::string data;
+ source->GetResponseAsString(&data);
switch (state_) {
case GET_AUTHORIZATION_TOKEN:
GetBookmarkDataFromServer(data);
diff --git a/chrome/browser/importer/toolbar_importer.h b/chrome/browser/importer/toolbar_importer.h
index fd1fcf0..6e09c60 100644
--- a/chrome/browser/importer/toolbar_importer.h
+++ b/chrome/browser/importer/toolbar_importer.h
@@ -18,7 +18,7 @@
#include "base/string16.h"
#include "chrome/browser/importer/importer.h"
#include "chrome/browser/importer/profile_writer.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
class ImporterBridge;
class XmlReader;
@@ -29,7 +29,7 @@ class XmlReader;
// Toolbar5Importer should not have StartImport called more than once. Futher
// if StartImport is called, then the class must not be destroyed until it has
// either completed or Toolbar5Importer->Cancel() has been called.
-class Toolbar5Importer : public URLFetcher::Delegate, public Importer {
+class Toolbar5Importer : public content::URLFetcherDelegate, public Importer {
public:
Toolbar5Importer();
@@ -46,13 +46,8 @@ class Toolbar5Importer : public URLFetcher::Delegate, public Importer {
// to cancel network retrieval.
virtual void Cancel();
- // URLFetcher::Delegate method called back from the URLFetcher object.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // content::URLFetcherDelegate method called back from the URLFetcher object.
+ virtual void OnURLFetchComplete(const URLFetcher* source);
private:
FRIEND_TEST_ALL_PREFIXES(Toolbar5ImporterTest, BookmarkParse);
diff --git a/chrome/browser/intranet_redirect_detector.cc b/chrome/browser/intranet_redirect_detector.cc
index 253795c..5a57cb5 100644
--- a/chrome/browser/intranet_redirect_detector.cc
+++ b/chrome/browser/intranet_redirect_detector.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
+#include "content/common/net/url_fetcher.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/base/registry_controlled_domain.h"
@@ -89,13 +90,7 @@ void IntranetRedirectDetector::FinishSleep() {
}
}
-void IntranetRedirectDetector::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void IntranetRedirectDetector::OnURLFetchComplete(const URLFetcher* source) {
// Delete the fetcher on this function's exit.
Fetchers::iterator fetcher = fetchers_.find(const_cast<URLFetcher*>(source));
DCHECK(fetcher != fetchers_.end());
@@ -104,7 +99,7 @@ void IntranetRedirectDetector::OnURLFetchComplete(
// If any two fetches result in the same domain/host, we set the redirect
// origin to that; otherwise we set it to nothing.
- if (!status.is_success() || (response_code != 200)) {
+ if (!source->status().is_success() || (source->response_code() != 200)) {
if ((resulting_origins_.empty()) ||
((resulting_origins_.size() == 1) &&
resulting_origins_.front().is_valid())) {
@@ -113,8 +108,8 @@ void IntranetRedirectDetector::OnURLFetchComplete(
}
redirect_origin_ = GURL();
} else {
- DCHECK(url.is_valid());
- GURL origin(url.GetOrigin());
+ DCHECK(source->url().is_valid());
+ GURL origin(source->url().GetOrigin());
if (resulting_origins_.empty()) {
resulting_origins_.push_back(origin);
return;
diff --git a/chrome/browser/intranet_redirect_detector.h b/chrome/browser/intranet_redirect_detector.h
index 108d521..19000e2 100644
--- a/chrome/browser/intranet_redirect_detector.h
+++ b/chrome/browser/intranet_redirect_detector.h
@@ -10,7 +10,7 @@
#include <string>
#include <vector>
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "googleurl/src/gurl.h"
@@ -36,7 +36,7 @@ class PrefService;
// return a value at all times (even during startup or in unittest mode). If no
// redirection is in place, the returned GURL will be empty.
class IntranetRedirectDetector
- : public URLFetcher::Delegate,
+ : public content::URLFetcherDelegate,
public net::NetworkChangeNotifier::IPAddressObserver {
public:
// Only the main browser process loop should call this, when setting up
@@ -65,13 +65,8 @@ class IntranetRedirectDetector
// switch sleep has finished. Runs any pending fetch.
void FinishSleep();
- // URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // content::URLFetcherDelegate
+ virtual void OnURLFetchComplete(const URLFetcher* source);
// NetworkChangeNotifier::IPAddressObserver
virtual void OnIPAddressChanged();
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 66a8eb6..d19f20d 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -179,6 +179,7 @@
#include "content/browser/plugin_service.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/common/child_process_info.h"
+#include "content/common/net/url_fetcher.h"
#include "content/public/browser/notification_service.h"
#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/webplugininfo.h"
@@ -1068,22 +1069,17 @@ static const char* StatusToString(const net::URLRequestStatus& status) {
}
}
-void MetricsService::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void MetricsService::OnURLFetchComplete(const URLFetcher* source) {
DCHECK(waiting_for_asynchronus_reporting_step_);
waiting_for_asynchronus_reporting_step_ = false;
DCHECK(current_fetch_.get());
current_fetch_.reset(NULL); // We're not allowed to re-use it.
// Confirm send so that we can move on.
- VLOG(1) << "METRICS RESPONSE CODE: " << response_code
- << " status=" << StatusToString(status);
+ VLOG(1) << "METRICS RESPONSE CODE: " << source->response_code()
+ << " status=" << StatusToString(source->status());
- bool upload_succeeded = response_code == 200;
+ bool upload_succeeded = source->response_code() == 200;
// Provide boolean for error recovery (allow us to ignore response_code).
bool discard_log = false;
@@ -1095,7 +1091,7 @@ void MetricsService::OnURLFetchComplete(const URLFetcher* source,
"UMA.Large Rejected Log was Discarded",
static_cast<int>(log_manager_.staged_log_text().length()));
discard_log = true;
- } else if (response_code == 400) {
+ } else if (source->response_code() == 400) {
// Bad syntax. Retransmission won't work.
UMA_HISTOGRAM_COUNTS("UMA.Unacceptable_Log_Discarded", state_);
discard_log = true;
@@ -1103,9 +1099,11 @@ void MetricsService::OnURLFetchComplete(const URLFetcher* source,
if (!upload_succeeded && !discard_log) {
VLOG(1) << "METRICS: transmission attempt returned a failure code: "
- << response_code << ". Verify network connectivity";
+ << source->response_code() << ". Verify network connectivity";
LogBadResponseCode();
} else { // Successful receipt (or we are discarding log).
+ std::string data;
+ source->GetResponseAsString(&data);
VLOG(1) << "METRICS RESPONSE DATA: " << data;
switch (state_) {
case INITIAL_LOG_READY:
@@ -1138,7 +1136,7 @@ void MetricsService::OnURLFetchComplete(const URLFetcher* source,
// Error 400 indicates a problem with the log, not with the server, so
// don't consider that a sign that the server is in trouble.
- bool server_is_healthy = upload_succeeded || response_code == 400;
+ bool server_is_healthy = upload_succeeded || source->response_code() == 400;
scheduler_->UploadFinished(server_is_healthy,
log_manager_.has_unsent_logs());
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index fc91621..75bff65 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -19,7 +19,7 @@
#include "base/process_util.h"
#include "chrome/browser/io_thread.h"
#include "chrome/common/metrics_helpers.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -52,7 +52,7 @@ struct WebPluginInfo;
class MetricsService : public content::NotificationObserver,
- public URLFetcher::Delegate,
+ public content::URLFetcherDelegate,
public MetricsServiceBase {
public:
MetricsService();
@@ -229,14 +229,9 @@ class MetricsService : public content::NotificationObserver,
// copy of the staged log.
void PrepareFetchWithStagedLog();
- // Implementation of URLFetcher::Delegate. Called after transmission
+ // Implementation of content::URLFetcherDelegate. Called after transmission
// completes (either successfully or with failure).
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ virtual void OnURLFetchComplete(const URLFetcher* source);
// Logs debugging details, for the case where the server returns a response
// code other than 200.
diff --git a/chrome/browser/net/gaia/gaia_oauth_fetcher.cc b/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
index 828ca7f..9bcd987 100644
--- a/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
+++ b/chrome/browser/net/gaia/gaia_oauth_fetcher.cc
@@ -24,6 +24,7 @@
#include "chrome/common/net/http_return.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
+#include "content/common/net/url_fetcher.h"
#include "grit/chromium_strings.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_context_getter.h"
@@ -62,7 +63,7 @@ URLFetcher* GaiaOAuthFetcher::CreateGaiaFetcher(
const std::string& body,
const std::string& headers,
bool send_cookies,
- URLFetcher::Delegate* delegate) {
+ content::URLFetcherDelegate* delegate) {
bool empty_body = body.empty();
URLFetcher* result =
URLFetcher::Create(0,
@@ -654,18 +655,18 @@ void GaiaOAuthFetcher::OnUserInfoFetched(
}
}
-void GaiaOAuthFetcher::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void GaiaOAuthFetcher::OnURLFetchComplete(const URLFetcher* source) {
// Keep |fetcher_| around to avoid invalidating its |status| (accessed below).
scoped_ptr<URLFetcher> current_fetcher(fetcher_.release());
fetch_pending_ = false;
GaiaUrls* gaia_urls = GaiaUrls::GetInstance();
+ GURL url = source->url();
+ std::string data;
+ source->GetResponseAsString(&data);
+ net::URLRequestStatus status = source->status();
+ int response_code = source->response_code();
if (StartsWithASCII(url.spec(), gaia_urls->get_oauth_token_url(), true)) {
- OnGetOAuthTokenUrlFetched(cookies, status, response_code);
+ OnGetOAuthTokenUrlFetched(source->cookies(), status, response_code);
} else if (url.spec() == gaia_urls->oauth1_login_url()) {
OnOAuthLoginFetched(data, status, response_code);
} else if (url.spec() == gaia_urls->oauth_get_access_token_url()) {
diff --git a/chrome/browser/net/gaia/gaia_oauth_fetcher.h b/chrome/browser/net/gaia/gaia_oauth_fetcher.h
index 77830b2..329f560 100644
--- a/chrome/browser/net/gaia/gaia_oauth_fetcher.h
+++ b/chrome/browser/net/gaia/gaia_oauth_fetcher.h
@@ -7,11 +7,12 @@
#pragma once
#include <string>
+#include <vector>
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/net/chrome_cookie_notification_details.h"
#include "chrome/browser/net/gaia/gaia_oauth_consumer.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "googleurl/src/gurl.h"
@@ -21,6 +22,12 @@ struct ChromeCookieDetails;
class Browser;
class Profile;
+namespace net {
+class URLRequestContextGetter;
+class URLRequestStatus;
+typedef std::vector<std::string> ResponseCookies;
+}
+
// Authenticate a user using Gaia's OAuth1 and OAuth2 support.
//
// Users of this class typically desire an OAuth2 Access token scoped for a
@@ -38,7 +45,7 @@ class Profile;
//
// This class can handle one request at a time, and all calls through an
// instance should be serialized.
-class GaiaOAuthFetcher : public URLFetcher::Delegate,
+class GaiaOAuthFetcher : public content::URLFetcherDelegate,
public content::NotificationObserver {
public:
// Defines steps of OAuth process performed by this class.
@@ -128,13 +135,8 @@ class GaiaOAuthFetcher : public URLFetcher::Delegate,
virtual void OnBrowserClosing(Browser* profile,
bool detail);
- // Implementation of URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) OVERRIDE;
+ // Implementation of content::URLFetcherDelegate
+ virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
// StartGetOAuthToken (or other Start* routine) been called, but results
// are not back yet.
@@ -234,7 +236,7 @@ class GaiaOAuthFetcher : public URLFetcher::Delegate,
const std::string& body,
const std::string& headers,
bool send_cookies,
- URLFetcher::Delegate* delegate);
+ content::URLFetcherDelegate* delegate);
bool ShouldAutoFetch(AutoFetchLimit fetch_step);
diff --git a/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc b/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc
index ec849cd..6a7a9ca 100644
--- a/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc
+++ b/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc
@@ -160,8 +160,14 @@ TEST_F(GaiaOAuthFetcherTest, OAuthGetAccessToken) {
net::ResponseCookies cookies;
net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
GURL url(GaiaUrls::GetInstance()->oauth_get_access_token_url());
- oauth_fetcher.OnURLFetchComplete(NULL, url, status, RC_REQUEST_OK,
- cookies, data);
+
+ TestURLFetcher test_fetcher(0, GURL(), URLFetcher::GET, &oauth_fetcher);
+ test_fetcher.set_url(url);
+ test_fetcher.set_status(status);
+ test_fetcher.set_response_code(RC_REQUEST_OK);
+ test_fetcher.set_cookies(cookies);
+ test_fetcher.SetResponseString(data);
+ oauth_fetcher.OnURLFetchComplete(&test_fetcher);
}
TEST_F(GaiaOAuthFetcherTest, OAuthWrapBridge) {
@@ -189,8 +195,14 @@ TEST_F(GaiaOAuthFetcherTest, OAuthWrapBridge) {
net::ResponseCookies cookies;
net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
GURL url(GaiaUrls::GetInstance()->oauth_wrap_bridge_url());
- oauth_fetcher.OnURLFetchComplete(NULL, url, status, RC_REQUEST_OK,
- cookies, data);
+
+ TestURLFetcher test_fetcher(0, GURL(), URLFetcher::GET, &oauth_fetcher);
+ test_fetcher.set_url(url);
+ test_fetcher.set_status(status);
+ test_fetcher.set_response_code(RC_REQUEST_OK);
+ test_fetcher.set_cookies(cookies);
+ test_fetcher.SetResponseString(data);
+ oauth_fetcher.OnURLFetchComplete(&test_fetcher);
}
TEST_F(GaiaOAuthFetcherTest, UserInfo) {
@@ -213,8 +225,14 @@ TEST_F(GaiaOAuthFetcherTest, UserInfo) {
net::ResponseCookies cookies;
net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
GURL url(GaiaUrls::GetInstance()->oauth_user_info_url());
- oauth_fetcher.OnURLFetchComplete(NULL, url, status,
- RC_REQUEST_OK, cookies, data);
+
+ TestURLFetcher test_fetcher(0, GURL(), URLFetcher::GET, &oauth_fetcher);
+ test_fetcher.set_url(url);
+ test_fetcher.set_status(status);
+ test_fetcher.set_response_code(RC_REQUEST_OK);
+ test_fetcher.set_cookies(cookies);
+ test_fetcher.SetResponseString(data);
+ oauth_fetcher.OnURLFetchComplete(&test_fetcher);
}
TEST_F(GaiaOAuthFetcherTest, OAuthRevokeToken) {
@@ -232,6 +250,11 @@ TEST_F(GaiaOAuthFetcherTest, OAuthRevokeToken) {
net::ResponseCookies cookies;
net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
GURL url(GaiaUrls::GetInstance()->oauth_revoke_token_url());
- oauth_fetcher.OnURLFetchComplete(NULL, url, status,
- RC_REQUEST_OK, cookies, std::string());
+
+ TestURLFetcher test_fetcher(0, GURL(), URLFetcher::GET, &oauth_fetcher);
+ test_fetcher.set_url(url);
+ test_fetcher.set_status(status);
+ test_fetcher.set_response_code(RC_REQUEST_OK);
+ test_fetcher.set_cookies(cookies);
+ oauth_fetcher.OnURLFetchComplete(&test_fetcher);
}
diff --git a/chrome/browser/net/sdch_dictionary_fetcher.cc b/chrome/browser/net/sdch_dictionary_fetcher.cc
index 766b875..d6062da 100644
--- a/chrome/browser/net/sdch_dictionary_fetcher.cc
+++ b/chrome/browser/net/sdch_dictionary_fetcher.cc
@@ -6,6 +6,7 @@
#include "base/compiler_specific.h"
#include "chrome/browser/profiles/profile.h"
+#include "content/common/net/url_fetcher.h"
#include "net/url_request/url_request_status.h"
SdchDictionaryFetcher::SdchDictionaryFetcher()
@@ -73,9 +74,9 @@ void SdchDictionaryFetcher::StartFetching() {
void SdchDictionaryFetcher::OnURLFetchComplete(const URLFetcher* source) {
if ((200 == source->response_code()) &&
(source->status().status() == net::URLRequestStatus::SUCCESS)) {
- net::SdchManager::Global()->AddSdchDictionary(
- source->GetResponseStringRef(),
- source->url());
+ std::string data;
+ source->GetResponseAsString(&data);
+ net::SdchManager::Global()->AddSdchDictionary(data, source->url());
}
current_fetch_.reset(NULL);
ScheduleDelayedRun();
diff --git a/chrome/browser/net/sdch_dictionary_fetcher.h b/chrome/browser/net/sdch_dictionary_fetcher.h
index 1f00f91..7611e90 100644
--- a/chrome/browser/net/sdch_dictionary_fetcher.h
+++ b/chrome/browser/net/sdch_dictionary_fetcher.h
@@ -16,10 +16,10 @@
#include "base/memory/scoped_ptr.h"
#include "base/task.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "net/base/sdch_manager.h"
-class SdchDictionaryFetcher : public URLFetcher::Delegate,
+class SdchDictionaryFetcher : public content::URLFetcherDelegate,
public net::SdchFetcher {
public:
SdchDictionaryFetcher();
@@ -48,7 +48,7 @@ class SdchDictionaryFetcher : public URLFetcher::Delegate,
// in the |fetch_queue_|.
void StartFetching();
- // Implementation of URLFetcher::Delegate. Called after transmission
+ // Implementation of content::URLFetcherDelegate. Called after transmission
// completes (either successfully or with failure).
virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
diff --git a/chrome/browser/plugin_download_helper.cc b/chrome/browser/plugin_download_helper.cc
index 8a47ea4..35b4047 100644
--- a/chrome/browser/plugin_download_helper.cc
+++ b/chrome/browser/plugin_download_helper.cc
@@ -9,6 +9,7 @@
#include "base/file_util.h"
#include "content/browser/browser_thread.h"
+#include "content/common/net/url_fetcher.h"
#include "net/base/io_buffer.h"
PluginDownloadUrlHelper::PluginDownloadUrlHelper(
diff --git a/chrome/browser/plugin_download_helper.h b/chrome/browser/plugin_download_helper.h
index dcddaa7..5d57f65 100644
--- a/chrome/browser/plugin_download_helper.h
+++ b/chrome/browser/plugin_download_helper.h
@@ -12,15 +12,19 @@
#if defined(OS_WIN)
#include "base/file_path.h"
#include "base/message_loop_proxy.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "net/base/file_stream.h"
#include "net/url_request/url_request.h"
#include "ui/gfx/native_widget_types.h"
+namespace net {
+class URLRequestContextGetter;
+}
+
// The PluginDownloadUrlHelper is used to handle one download URL request
// from the plugin. Each download request is handled by a new instance
// of this class.
-class PluginDownloadUrlHelper : public URLFetcher::Delegate {
+class PluginDownloadUrlHelper : public content::URLFetcherDelegate {
public:
// The delegate receives notification about the status of downloads
// initiated.
@@ -40,13 +44,7 @@ class PluginDownloadUrlHelper : public URLFetcher::Delegate {
void InitiateDownload(net::URLRequestContextGetter* request_context,
base::MessageLoopProxy* file_thread_proxy);
- // URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {}
+ // content::URLFetcherDelegate
virtual void OnURLFetchComplete(const URLFetcher* source);
void OnDownloadCompleted(net::URLRequest* request);
diff --git a/chrome/browser/policy/device_management_backend_impl.cc b/chrome/browser/policy/device_management_backend_impl.cc
index 39889dc..84b9861 100644
--- a/chrome/browser/policy/device_management_backend_impl.cc
+++ b/chrome/browser/policy/device_management_backend_impl.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/policy/device_management_service.h"
#include "chrome/browser/policy/enterprise_metrics.h"
#include "chrome/common/chrome_version_info.h"
+#include "content/common/net/url_fetcher.h"
#include "net/base/escape.h"
#include "net/url_request/url_request_status.h"
diff --git a/chrome/browser/policy/device_management_service.cc b/chrome/browser/policy/device_management_service.cc
index 7d07b9d..02435a5 100644
--- a/chrome/browser/policy/device_management_service.cc
+++ b/chrome/browser/policy/device_management_service.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/policy/device_management_backend_impl.h"
#include "content/browser/browser_thread.h"
#include "content/public/common/content_client.h"
+#include "content/common/net/url_fetcher.h"
#include "net/base/cookie_monster.h"
#include "net/base/host_resolver.h"
#include "net/base/load_flags.h"
@@ -221,13 +222,7 @@ void DeviceManagementService::StartJob(DeviceManagementJob* job,
fetcher->Start();
}
-void DeviceManagementService::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void DeviceManagementService::OnURLFetchComplete(const URLFetcher* source) {
JobFetcherMap::iterator entry(pending_jobs_.find(source));
if (entry != pending_jobs_.end()) {
DeviceManagementJob* job = entry->second;
@@ -238,10 +233,10 @@ void DeviceManagementService::OnURLFetchComplete(
// the proxy.
bool retry = false;
if ((source->load_flags() & net::LOAD_BYPASS_PROXY) == 0) {
- if (!status.is_success() && IsProxyError(status)) {
+ if (!source->status().is_success() && IsProxyError(source->status())) {
LOG(WARNING) << "Proxy failed while contacting dmserver.";
retry = true;
- } else if (status.is_success() &&
+ } else if (source->status().is_success() &&
source->was_fetched_via_proxy() &&
!IsProtobufMimeType(source)) {
// The proxy server can be misconfigured but pointing to an existing
@@ -257,7 +252,10 @@ void DeviceManagementService::OnURLFetchComplete(
LOG(WARNING) << "Retrying dmserver request without using a proxy.";
StartJob(job, true);
} else {
- job->HandleResponse(status, response_code, cookies, data);
+ std::string data;
+ source->GetResponseAsString(&data);
+ job->HandleResponse(source->status(), source->response_code(),
+ source->cookies(), data);
}
} else {
NOTREACHED() << "Callback from foreign URL fetcher";
diff --git a/chrome/browser/policy/device_management_service.h b/chrome/browser/policy/device_management_service.h
index 089bcf0..1e88be0 100644
--- a/chrome/browser/policy/device_management_service.h
+++ b/chrome/browser/policy/device_management_service.h
@@ -9,15 +9,19 @@
#include <deque>
#include <map>
#include <string>
+#include <vector>
#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
namespace net {
class URLRequestContextGetter;
+class URLRequestStatus;
+typedef std::vector<std::string> ResponseCookies;
}
namespace policy {
@@ -28,7 +32,7 @@ class DeviceManagementBackend;
// communication with the device management server. It creates the backends
// objects that the device management policy provider and friends use to issue
// requests.
-class DeviceManagementService : public URLFetcher::Delegate {
+class DeviceManagementService : public content::URLFetcherDelegate {
public:
// Describes a device management job handled by the service.
class DeviceManagementJob {
@@ -79,13 +83,8 @@ class DeviceManagementService : public URLFetcher::Delegate {
typedef std::map<const URLFetcher*, DeviceManagementJob*> JobFetcherMap;
typedef std::deque<DeviceManagementJob*> JobQueue;
- // URLFetcher::Delegate override.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) OVERRIDE;
+ // content::URLFetcherDelegate override.
+ virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
// Does the actual initialization using the request context specified for
// |PrepareInitialization|. This will also fire any pending network requests.
diff --git a/chrome/browser/policy/device_management_service_browsertest.cc b/chrome/browser/policy/device_management_service_browsertest.cc
index d22abec..2bec6b3 100644
--- a/chrome/browser/policy/device_management_service_browsertest.cc
+++ b/chrome/browser/policy/device_management_service_browsertest.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_browser_test.h"
+#include "content/common/net/url_fetcher.h"
#include "net/test/test_server.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_test_job.h"
diff --git a/chrome/browser/policy/device_management_service_unittest.cc b/chrome/browser/policy/device_management_service_unittest.cc
index dd09974..5468d55 100644
--- a/chrome/browser/policy/device_management_service_unittest.cc
+++ b/chrome/browser/policy/device_management_service_unittest.cc
@@ -121,12 +121,11 @@ TEST_P(DeviceManagementServiceFailedRequestTest, RegisterRequest) {
TestURLFetcher* fetcher = factory_.GetFetcherByID(0);
ASSERT_TRUE(fetcher);
- fetcher->delegate()->OnURLFetchComplete(fetcher,
- GURL(kServiceUrl),
- GetParam().request_status_,
- GetParam().http_status_,
- net::ResponseCookies(),
- GetParam().response_);
+ fetcher->set_url(GURL(kServiceUrl));
+ fetcher->set_status(GetParam().request_status_);
+ fetcher->set_response_code(GetParam().http_status_);
+ fetcher->SetResponseString(GetParam().response_);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
}
TEST_P(DeviceManagementServiceFailedRequestTest, UnregisterRequest) {
@@ -137,12 +136,11 @@ TEST_P(DeviceManagementServiceFailedRequestTest, UnregisterRequest) {
TestURLFetcher* fetcher = factory_.GetFetcherByID(0);
ASSERT_TRUE(fetcher);
- fetcher->delegate()->OnURLFetchComplete(fetcher,
- GURL(kServiceUrl),
- GetParam().request_status_,
- GetParam().http_status_,
- net::ResponseCookies(),
- GetParam().response_);
+ fetcher->set_url(GURL(kServiceUrl));
+ fetcher->set_status(GetParam().request_status_);
+ fetcher->set_response_code(GetParam().http_status_);
+ fetcher->SetResponseString(GetParam().response_);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
}
TEST_P(DeviceManagementServiceFailedRequestTest, PolicyRequest) {
@@ -159,12 +157,11 @@ TEST_P(DeviceManagementServiceFailedRequestTest, PolicyRequest) {
TestURLFetcher* fetcher = factory_.GetFetcherByID(0);
ASSERT_TRUE(fetcher);
- fetcher->delegate()->OnURLFetchComplete(fetcher,
- GURL(kServiceUrl),
- GetParam().request_status_,
- GetParam().http_status_,
- net::ResponseCookies(),
- GetParam().response_);
+ fetcher->set_url(GURL(kServiceUrl));
+ fetcher->set_status(GetParam().request_status_);
+ fetcher->set_response_code(GetParam().http_status_);
+ fetcher->SetResponseString(GetParam().response_);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
}
INSTANTIATE_TEST_CASE_P(
@@ -349,12 +346,11 @@ TEST_F(DeviceManagementServiceTest, RegisterRequest) {
response_wrapper.mutable_register_response()->CopyFrom(expected_response);
ASSERT_TRUE(response_wrapper.SerializeToString(&response_data));
net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
- fetcher->delegate()->OnURLFetchComplete(fetcher,
- GURL(kServiceUrl),
- status,
- 200,
- net::ResponseCookies(),
- response_data);
+ fetcher->set_url(GURL(kServiceUrl));
+ fetcher->set_status(status);
+ fetcher->set_response_code(200);
+ fetcher->SetResponseString(response_data);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
}
TEST_F(DeviceManagementServiceTest, UnregisterRequest) {
@@ -391,12 +387,11 @@ TEST_F(DeviceManagementServiceTest, UnregisterRequest) {
response_wrapper.mutable_unregister_response()->CopyFrom(expected_response);
ASSERT_TRUE(response_wrapper.SerializeToString(&response_data));
net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
- fetcher->delegate()->OnURLFetchComplete(fetcher,
- GURL(kServiceUrl),
- status,
- 200,
- net::ResponseCookies(),
- response_data);
+ fetcher->set_url(GURL(kServiceUrl));
+ fetcher->set_status(status);
+ fetcher->set_response_code(200);
+ fetcher->SetResponseString(response_data);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
}
TEST_F(DeviceManagementServiceTest, CancelRegisterRequest) {
@@ -470,12 +465,11 @@ TEST_F(DeviceManagementServiceTest, JobQueueing) {
response_wrapper.mutable_register_response()->CopyFrom(expected_response);
ASSERT_TRUE(response_wrapper.SerializeToString(&response_data));
net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
- fetcher->delegate()->OnURLFetchComplete(fetcher,
- GURL(kServiceUrl),
- status,
- 200,
- net::ResponseCookies(),
- response_data);
+ fetcher->set_url(GURL(kServiceUrl));
+ fetcher->set_status(status);
+ fetcher->set_response_code(200);
+ fetcher->SetResponseString(response_data);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
}
TEST_F(DeviceManagementServiceTest, CancelRequestAfterShutdown) {
@@ -513,12 +507,10 @@ TEST_F(DeviceManagementServiceTest, CancelDuringCallback) {
// Generate a callback.
net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
- fetcher->delegate()->OnURLFetchComplete(fetcher,
- GURL(kServiceUrl),
- status,
- 500,
- net::ResponseCookies(),
- "");
+ fetcher->set_url(GURL(kServiceUrl));
+ fetcher->set_status(status);
+ fetcher->set_response_code(500);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
// Backend should have been reset.
EXPECT_FALSE(backend_.get());
@@ -542,12 +534,10 @@ TEST_F(DeviceManagementServiceTest, RetryOnProxyError) {
// Generate a callback with a proxy failure.
net::URLRequestStatus status(net::URLRequestStatus::FAILED,
net::ERR_PROXY_CONNECTION_FAILED);
- fetcher->delegate()->OnURLFetchComplete(fetcher,
- GURL(kServiceUrl),
- status,
- 0,
- net::ResponseCookies(),
- "");
+ fetcher->set_url(GURL(kServiceUrl));
+ fetcher->set_status(status);
+ fetcher->set_response_code(200);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
// Verify that a new URLFetcher was started that bypasses the proxy.
fetcher = factory_.GetFetcherByID(0);
@@ -580,12 +570,10 @@ TEST_F(DeviceManagementServiceTest, RetryOnBadResponseFromProxy) {
// Generate a callback with a valid http response, that was generated by
// a bad/wrong proxy.
net::URLRequestStatus status;
- fetcher->delegate()->OnURLFetchComplete(fetcher,
- GURL(kServiceUrl),
- status,
- 200,
- net::ResponseCookies(),
- "");
+ fetcher->set_url(GURL(kServiceUrl));
+ fetcher->set_status(status);
+ fetcher->set_response_code(200);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
// Verify that a new URLFetcher was started that bypasses the proxy.
fetcher = factory_.GetFetcherByID(0);
diff --git a/chrome/browser/policy/testing_policy_url_fetcher_factory.cc b/chrome/browser/policy/testing_policy_url_fetcher_factory.cc
index 1a2bdff..d5bd948 100644
--- a/chrome/browser/policy/testing_policy_url_fetcher_factory.cc
+++ b/chrome/browser/policy/testing_policy_url_fetcher_factory.cc
@@ -40,13 +40,31 @@ class TestingPolicyURLFetcher : public URLFetcher {
const base::WeakPtr<TestingPolicyURLFetcherFactory>& parent,
const GURL& url,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* delegate);
+ content::URLFetcherDelegate* delegate);
virtual void Start() OVERRIDE;
void Respond();
+ virtual const GURL& url() const {
+ return url_;
+ }
+
+ virtual const net::URLRequestStatus& status() const {
+ return status_;
+ }
+
+ virtual int response_code() const {
+ return response_.response_code;
+ }
+
+ virtual bool GetResponseAsString(std::string* out_response_string) const {
+ *out_response_string = response_.response_data;
+ return true;
+ }
+
private:
GURL url_;
+ net::URLRequestStatus status_;
TestURLResponse response_;
base::WeakPtr<TestingPolicyURLFetcherFactory> parent_;
@@ -57,9 +75,10 @@ TestingPolicyURLFetcher::TestingPolicyURLFetcher(
const base::WeakPtr<TestingPolicyURLFetcherFactory>& parent,
const GURL& url,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* delegate)
+ content::URLFetcherDelegate* delegate)
: URLFetcher(url, request_type, delegate),
url_(url),
+ status_(net::URLRequestStatus::SUCCESS, 0),
parent_(parent) {
}
@@ -82,13 +101,7 @@ void TestingPolicyURLFetcher::Start() {
}
void TestingPolicyURLFetcher::Respond() {
- delegate()->OnURLFetchComplete(
- this,
- url_,
- net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- response_.response_code,
- net::ResponseCookies(),
- response_.response_data);
+ delegate()->OnURLFetchComplete(this);
}
TestingPolicyURLFetcherFactory::TestingPolicyURLFetcherFactory(
@@ -118,7 +131,7 @@ URLFetcher* TestingPolicyURLFetcherFactory::CreateURLFetcher(
int id,
const GURL& url,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* delegate) {
+ content::URLFetcherDelegate* delegate) {
return new TestingPolicyURLFetcher(
weak_ptr_factory_.GetWeakPtr(), url, request_type, delegate);
}
diff --git a/chrome/browser/policy/testing_policy_url_fetcher_factory.h b/chrome/browser/policy/testing_policy_url_fetcher_factory.h
index 68e1290..32f2aa2 100644
--- a/chrome/browser/policy/testing_policy_url_fetcher_factory.h
+++ b/chrome/browser/policy/testing_policy_url_fetcher_factory.h
@@ -10,7 +10,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "content/test/test_url_fetcher_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -39,7 +39,7 @@ class TestingPolicyURLFetcherFactory : public URLFetcher::Factory,
int id,
const GURL& url,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* delegate) OVERRIDE;
+ content::URLFetcherDelegate* delegate) OVERRIDE;
LoggingWorkScheduler* scheduler();
diff --git a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h
index c39b931..fac972e 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h
+++ b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.h
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
+#include "base/task.h"
#include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
diff --git a/chrome/browser/safe_browsing/client_side_detection_service.cc b/chrome/browser/safe_browsing/client_side_detection_service.cc
index 322a004..af10d25 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_service.cc
@@ -25,6 +25,7 @@
#include "chrome/common/safe_browsing/safebrowsing_messages.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_process_host.h"
+#include "content/common/net/url_fetcher.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "crypto/sha2.h"
@@ -183,18 +184,18 @@ bool ClientSideDetectionService::IsBadIpAddress(
return false;
}
-void ClientSideDetectionService::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void ClientSideDetectionService::OnURLFetchComplete(const URLFetcher* source) {
+ std::string data;
+ source->GetResponseAsString(&data);
if (source == model_fetcher_.get()) {
- HandleModelResponse(source, url, status, response_code, cookies, data);
+ HandleModelResponse(
+ source, source->url(), source->status(), source->response_code(),
+ source->cookies(), data);
} else if (client_phishing_reports_.find(source) !=
client_phishing_reports_.end()) {
- HandlePhishingVerdict(source, url, status, response_code, cookies, data);
+ HandlePhishingVerdict(
+ source, source->url(), source->status(), source->response_code(),
+ source->cookies(), data);
} else {
NOTREACHED();
}
diff --git a/chrome/browser/safe_browsing/client_side_detection_service.h b/chrome/browser/safe_browsing/client_side_detection_service.h
index fa40d08..a06244f 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service.h
+++ b/chrome/browser/safe_browsing/client_side_detection_service.h
@@ -29,7 +29,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/task.h"
#include "base/time.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "googleurl/src/gurl.h"
@@ -45,6 +45,7 @@ class TimeDelta;
namespace net {
class URLRequestContextGetter;
class URLRequestStatus;
+typedef std::vector<std::string> ResponseCookies;
} // namespace net
namespace safe_browsing {
@@ -52,7 +53,7 @@ class ClientPhishingRequest;
class ClientPhishingResponse;
class ClientSideModel;
-class ClientSideDetectionService : public URLFetcher::Delegate,
+class ClientSideDetectionService : public content::URLFetcherDelegate,
public content::NotificationObserver {
public:
typedef Callback2<GURL /* phishing URL */, bool /* is phishing */>::Type
@@ -79,13 +80,8 @@ class ClientSideDetectionService : public URLFetcher::Delegate,
return enabled_;
}
- // From the URLFetcher::Delegate interface.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) OVERRIDE;
+ // From the content::URLFetcherDelegate interface.
+ virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
// content::NotificationObserver overrides:
virtual void Observe(int type,
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index c6475bc..c565d21 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -12,6 +12,7 @@
#include "chrome/common/net/http_return.h"
#include "chrome/common/safe_browsing/csd.pb.h"
#include "content/browser/browser_thread.h"
+#include "content/common/net/url_fetcher.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_status.h"
@@ -66,13 +67,7 @@ void DownloadProtectionService::SetEnabledOnIOThread(bool enabled) {
}
}
-void DownloadProtectionService::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void DownloadProtectionService::OnURLFetchComplete(const URLFetcher* source) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
scoped_ptr<const URLFetcher> s(source); // will delete the URLFetcher object.
if (download_requests_.find(source) != download_requests_.end()) {
@@ -85,14 +80,17 @@ void DownloadProtectionService::OnURLFetchComplete(
return;
}
DownloadCheckResultReason reason = REASON_MAX;
- if (status.is_success() &&
- RC_REQUEST_OK == response_code &&
- data.size() > 0) {
- // For now no matter what we'll always say the download is safe.
- // TODO(noelutz): Parse the response body to see exactly what's going on.
- reason = REASON_INVALID_RESPONSE_PROTO;
- } else {
- reason = REASON_SERVER_PING_FAILED;
+ reason = REASON_SERVER_PING_FAILED;
+ if (source->status().is_success() &&
+ RC_REQUEST_OK == source->response_code()) {
+ std::string data;
+ source->GetResponseAsString(&data);
+ if (data.size() > 0) {
+ // For now no matter what we'll always say the download is safe.
+ // TODO(noelutz): Parse the response body to see exactly what's going
+ // on.
+ reason = REASON_INVALID_RESPONSE_PROTO;
+ }
}
BrowserThread::PostTask(
BrowserThread::UI,
diff --git a/chrome/browser/safe_browsing/download_protection_service.h b/chrome/browser/safe_browsing/download_protection_service.h
index c81d5da..c6d4044 100644
--- a/chrome/browser/safe_browsing/download_protection_service.h
+++ b/chrome/browser/safe_browsing/download_protection_service.h
@@ -19,7 +19,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
namespace net {
@@ -34,7 +34,7 @@ namespace safe_browsing {
// client download is malicious or not.
class DownloadProtectionService
: public base::RefCountedThreadSafe<DownloadProtectionService>,
- public URLFetcher::Delegate {
+ public content::URLFetcherDelegate {
public:
// TODO(noelutz): we're missing some fields here: filename to get
// the signature, server IPs, tab URL redirect chain, ...
@@ -65,13 +65,8 @@ class DownloadProtectionService
SafeBrowsingService* sb_service,
net::URLRequestContextGetter* request_context_getter);
- // From the URLFetcher::Delegate interface.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) OVERRIDE;
+ // From the content::URLFetcherDelegate interface.
+ virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
// Checks whether the given client download is likely to be
// malicious or not. If this method returns true it means the
diff --git a/chrome/browser/safe_browsing/malware_details_cache.cc b/chrome/browser/safe_browsing/malware_details_cache.cc
index 6ceffe1..e833d90 100644
--- a/chrome/browser/safe_browsing/malware_details_cache.cc
+++ b/chrome/browser/safe_browsing/malware_details_cache.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/safe_browsing/report.pb.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "content/browser/browser_thread.h"
+#include "content/common/net/url_fetcher.h"
#include "net/base/host_port_pair.h"
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
@@ -102,26 +103,21 @@ ClientMalwareReportRequest::Resource* MalwareDetailsCacheCollector::GetResource(
}
void MalwareDetailsCacheCollector::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+ const URLFetcher* source) {
DVLOG(1) << "OnUrlFetchComplete";
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(current_fetch_.get());
- if (status.status() != net::URLRequestStatus::SUCCESS &&
- status.error() == net::ERR_CACHE_MISS) {
+ if (source->status().status() != net::URLRequestStatus::SUCCESS &&
+ source->status().error() == net::ERR_CACHE_MISS) {
// Cache miss, skip this resource.
- DVLOG(1) << "Cache miss for url: " << url;
+ DVLOG(1) << "Cache miss for url: " << source->url();
AdvanceEntry();
return;
}
- if (status.status() != net::URLRequestStatus::SUCCESS) {
+ if (source->status().status() != net::URLRequestStatus::SUCCESS) {
// Some other error occurred, e.g. the request could have been cancelled.
- DVLOG(1) << "Unsuccessful fetch: " << url;
+ DVLOG(1) << "Unsuccessful fetch: " << source->url();
AdvanceEntry();
return;
}
@@ -129,14 +125,16 @@ void MalwareDetailsCacheCollector::OnURLFetchComplete(
// Set the response headers and body to the right resource, which
// might not be the same as the one we asked for.
// For redirects, resources_it_->first != url.spec().
- ClientMalwareReportRequest::Resource* resource = GetResource(url);
+ ClientMalwareReportRequest::Resource* resource = GetResource(source->url());
if (!resource) {
- DVLOG(1) << "Cannot find resource for url:" << url;
+ DVLOG(1) << "Cannot find resource for url:" << source->url();
AdvanceEntry();
return;
}
ReadResponse(resource, source);
+ std::string data;
+ source->GetResponseAsString(&data);
ReadData(resource, data);
AdvanceEntry();
}
diff --git a/chrome/browser/safe_browsing/malware_details_cache.h b/chrome/browser/safe_browsing/malware_details_cache.h
index 33f6391..1dbd86c 100644
--- a/chrome/browser/safe_browsing/malware_details_cache.h
+++ b/chrome/browser/safe_browsing/malware_details_cache.h
@@ -17,7 +17,7 @@
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/safe_browsing/report.pb.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "net/base/completion_callback.h"
namespace net {
@@ -36,7 +36,7 @@ typedef base::hash_map<
class MalwareDetailsCacheCollector
: public base::RefCountedThreadSafe<MalwareDetailsCacheCollector>,
- public URLFetcher::Delegate {
+ public content::URLFetcherDelegate {
public:
MalwareDetailsCacheCollector();
@@ -57,12 +57,7 @@ class MalwareDetailsCacheCollector
protected:
// Implementation of URLFetcher::Delegate. Called after the request
// completes (either successfully or with failure).
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) OVERRIDE;
+ virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
private:
// Points to the url for which we are fetching the HTTP cache entry or
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index 412325a..adf42d4 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -21,6 +21,7 @@
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/env_vars.h"
#include "content/browser/browser_thread.h"
+#include "content/common/net/url_fetcher.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_context_getter.h"
@@ -195,7 +196,7 @@ void SafeBrowsingProtocolManager::GetNextUpdate() {
IssueUpdateRequest();
}
-// URLFetcher::Delegate implementation -----------------------------------------
+// content::URLFetcherDelegate implementation ----------------------------------
// All SafeBrowsing request responses are handled here.
// TODO(paulg): Clarify with the SafeBrowsing team whether a failed parse of a
@@ -205,13 +206,7 @@ void SafeBrowsingProtocolManager::GetNextUpdate() {
// drop it. This isn't so bad because the next UPDATE_REQUEST we
// do will report all the chunks we have. If that chunk is still
// required, the SafeBrowsing servers will tell us to get it again.
-void SafeBrowsingProtocolManager::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void SafeBrowsingProtocolManager::OnURLFetchComplete(const URLFetcher* source) {
scoped_ptr<const URLFetcher> fetcher;
bool parsed_ok = true;
bool must_back_off = false; // Reduce SafeBrowsing service query frequency.
@@ -234,10 +229,10 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete(
SafeBrowsingService::SafeBrowsingCheck* check = it->second;
std::vector<SBFullHashResult> full_hashes;
bool can_cache = false;
- if (response_code == 200 || response_code == 204) {
+ if (source->response_code() == 200 || source->response_code() == 204) {
// For tracking our GetHash false positive (204) rate, compared to real
// (200) responses.
- if (response_code == 200)
+ if (source->response_code() == 200)
RecordGetHashResult(check->is_download, GET_HASH_STATUS_200);
else
RecordGetHashResult(check->is_download, GET_HASH_STATUS_204);
@@ -246,11 +241,14 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete(
gethash_back_off_mult_ = 1;
bool re_key = false;
SafeBrowsingProtocolParser parser;
- parsed_ok = parser.ParseGetHash(data.data(),
- static_cast<int>(data.length()),
- client_key_,
- &re_key,
- &full_hashes);
+ std::string data;
+ source->GetResponseAsString(&data);
+ parsed_ok = parser.ParseGetHash(
+ data.data(),
+ static_cast<int>(data.length()),
+ client_key_,
+ &re_key,
+ &full_hashes);
if (!parsed_ok) {
// If we fail to parse it, we must still inform the SafeBrowsingService
// so that it doesn't hold up the user's request indefinitely. Not sure
@@ -262,12 +260,12 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete(
}
} else {
HandleGetHashError(Time::Now());
- if (status.status() == net::URLRequestStatus::FAILED) {
+ if (source->status().status() == net::URLRequestStatus::FAILED) {
VLOG(1) << "SafeBrowsing GetHash request for: " << source->url()
- << " failed with error: " << status.error();
+ << " failed with error: " << source->status().error();
} else {
VLOG(1) << "SafeBrowsing GetHash request for: " << source->url()
- << " failed with error: " << response_code;
+ << " failed with error: " << source->response_code();
}
}
@@ -292,11 +290,12 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete(
update_timer_.Stop();
}
- if (response_code == 200) {
+ if (source->response_code() == 200) {
// We have data from the SafeBrowsing service.
- parsed_ok = HandleServiceResponse(source->url(),
- data.data(),
- static_cast<int>(data.length()));
+ std::string data;
+ source->GetResponseAsString(&data);
+ parsed_ok = HandleServiceResponse(
+ source->url(), data.data(), static_cast<int>(data.length()));
if (!parsed_ok) {
VLOG(1) << "SafeBrowsing request for: " << source->url()
<< " failed parse.";
@@ -336,12 +335,12 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete(
if (request_type_ == CHUNK_REQUEST)
chunk_request_urls_.clear();
UpdateFinished(false);
- if (status.status() == net::URLRequestStatus::FAILED) {
+ if (source->status().status() == net::URLRequestStatus::FAILED) {
VLOG(1) << "SafeBrowsing request for: " << source->url()
- << " failed with error: " << status.error();
+ << " failed with error: " << source->status().error();
} else {
VLOG(1) << "SafeBrowsing request for: " << source->url()
- << " failed with error: " << response_code;
+ << " failed with error: " << source->response_code();
}
}
}
diff --git a/chrome/browser/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h
index d0ff19b..08becdb 100644
--- a/chrome/browser/safe_browsing/protocol_manager.h
+++ b/chrome/browser/safe_browsing/protocol_manager.h
@@ -25,7 +25,7 @@
#include "chrome/browser/safe_browsing/protocol_parser.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/safe_browsing/safe_browsing_util.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
namespace net {
class URLRequestStatus;
@@ -63,7 +63,7 @@ class SBProtocolManagerFactory {
DISALLOW_COPY_AND_ASSIGN(SBProtocolManagerFactory);
};
-class SafeBrowsingProtocolManager : public URLFetcher::Delegate {
+class SafeBrowsingProtocolManager : public content::URLFetcherDelegate {
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestBackOffTimes);
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestChunkStrings);
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestGetHashUrl);
@@ -102,13 +102,8 @@ class SafeBrowsingProtocolManager : public URLFetcher::Delegate {
// of the SafeBrowsing service.
virtual void Initialize();
- // URLFetcher::Delegate interface.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) OVERRIDE;
+ // content::URLFetcherDelegate interface.
+ virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
// API used by the SafeBrowsingService for issuing queries. When the results
// are available, SafeBrowsingService::HandleGetHashResults is called.
diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc
index 9ecd542..76a87df 100644
--- a/chrome/browser/safe_browsing/safe_browsing_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_test.cc
@@ -39,6 +39,8 @@
#include "chrome/test/base/ui_test_utils.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
+#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "net/base/host_resolver.h"
#include "net/base/load_flags.h"
#include "net/base/net_log.h"
@@ -351,7 +353,7 @@ class SafeBrowsingServiceTest : public InProcessBrowserTest {
class SafeBrowsingServiceTestHelper
: public base::RefCountedThreadSafe<SafeBrowsingServiceTestHelper>,
public SafeBrowsingService::Client,
- public URLFetcher::Delegate {
+ public content::URLFetcherDelegate {
public:
explicit SafeBrowsingServiceTestHelper(
SafeBrowsingServiceTest* safe_browsing_test)
@@ -507,14 +509,9 @@ class SafeBrowsingServiceTestHelper
}
// Callback for URLFetcher.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
- response_data_ = data;
- response_status_ = status.status();
+ virtual void OnURLFetchComplete(const URLFetcher* source) {
+ source->GetResponseAsString(&response_data_);
+ response_status_ = source->status().status();
StopUILoop();
}
diff --git a/chrome/browser/search_engines/template_url_fetcher.cc b/chrome/browser/search_engines/template_url_fetcher.cc
index bb805bde..7740fb1 100644
--- a/chrome/browser/search_engines/template_url_fetcher.cc
+++ b/chrome/browser/search_engines/template_url_fetcher.cc
@@ -19,11 +19,12 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_source.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "net/url_request/url_request_status.h"
// RequestDelegate ------------------------------------------------------------
class TemplateURLFetcher::RequestDelegate
- : public URLFetcher::Delegate,
+ : public content::URLFetcherDelegate,
public content::NotificationObserver {
public:
// Takes ownership of |callbacks|.
@@ -39,15 +40,10 @@ class TemplateURLFetcher::RequestDelegate
const content::NotificationSource& source,
const content::NotificationDetails& details);
- // URLFetcher::Delegate:
+ // content::URLFetcherDelegate:
// If data contains a valid OSDD, a TemplateURL is created and added to
// the TemplateURLService.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ virtual void OnURLFetchComplete(const URLFetcher* source);
// URL of the OSDD.
GURL url() const { return osdd_url_; }
@@ -120,12 +116,7 @@ void TemplateURLFetcher::RequestDelegate::Observe(
}
void TemplateURLFetcher::RequestDelegate::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+ const URLFetcher* source) {
template_url_.reset(new TemplateURL());
// Validation checks.
@@ -134,8 +125,10 @@ void TemplateURLFetcher::RequestDelegate::OnURLFetchComplete(
// For other schemes, e.g. when the OSDD file is bundled with an extension,
// the response_code is not applicable and should be -1. Also, ensure that
// the returned information results in a valid search URL.
- if (!status.is_success() ||
- ((response_code != -1) && (response_code != 200)) ||
+ std::string data;
+ if (!source->status().is_success() ||
+ ((source->response_code() != -1) && (source->response_code() != 200)) ||
+ !source->GetResponseAsString(&data) ||
!TemplateURLParser::Parse(
reinterpret_cast<const unsigned char*>(data.c_str()),
data.length(),
diff --git a/chrome/browser/spellchecker/spellcheck_host_impl.cc b/chrome/browser/spellchecker/spellcheck_host_impl.cc
index 946e5ab..c8446c8 100644
--- a/chrome/browser/spellchecker/spellcheck_host_impl.cc
+++ b/chrome/browser/spellchecker/spellcheck_host_impl.cc
@@ -23,6 +23,7 @@
#include "chrome/common/spellcheck_common.h"
#include "chrome/common/spellcheck_messages.h"
#include "content/browser/renderer_host/render_process_host.h"
+#include "content/common/net/url_fetcher.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "googleurl/src/gurl.h"
@@ -320,17 +321,12 @@ void SpellCheckHostImpl::WriteWordToCustomDictionary(const std::string& word) {
file_util::CloseFile(f);
}
-void SpellCheckHostImpl::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void SpellCheckHostImpl::OnURLFetchComplete(const URLFetcher* source) {
DCHECK(source);
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- fetcher_.reset();
+ scoped_ptr<URLFetcher> fetcher_destructor(fetcher_.release());
- if ((response_code / 100) != 2) {
+ if ((source->response_code() / 100) != 2) {
// Initialize will not try to download the file a second time.
LOG(ERROR) << "Failure to download dictionary.";
InitializeOnFileThread();
@@ -340,6 +336,8 @@ void SpellCheckHostImpl::OnURLFetchComplete(const URLFetcher* source,
// Basic sanity check on the dictionary.
// There's the small chance that we might see a 200 status code for a body
// that represents some form of failure.
+ std::string data;
+ source->GetResponseAsString(&data);
if (data.size() < 4 || data[0] != 'B' || data[1] != 'D' || data[2] != 'i' ||
data[3] != 'c') {
LOG(ERROR) << "Failure to download dictionary.";
diff --git a/chrome/browser/spellchecker/spellcheck_host_impl.h b/chrome/browser/spellchecker/spellcheck_host_impl.h
index 30c217c..e0b5243 100644
--- a/chrome/browser/spellchecker/spellcheck_host_impl.h
+++ b/chrome/browser/spellchecker/spellcheck_host_impl.h
@@ -13,7 +13,7 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/spellchecker/spellcheck_host.h"
#include "chrome/browser/spellchecker/spellcheck_profile_provider.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -38,7 +38,7 @@
// Available languages for the checker, which we need to specify via Create(),
// can be listed using SpellCheckHost::GetAvailableLanguages() static method.
class SpellCheckHostImpl : public SpellCheckHost,
- public URLFetcher::Delegate,
+ public content::URLFetcherDelegate,
public content::NotificationObserver {
public:
SpellCheckHostImpl(SpellCheckProfileProvider* profile,
@@ -102,14 +102,9 @@ class SpellCheckHostImpl : public SpellCheckHost,
// Returns true if the dictionary is ready to use.
virtual bool IsReady() const;
- // URLFetcher::Delegate implementation. Called when we finish downloading the
- // spellcheck dictionary; saves the dictionary to |data_|.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // content::URLFetcherDelegate implementation. Called when we finish
+ // downloading the spellcheck dictionary; saves the dictionary to |data_|.
+ virtual void OnURLFetchComplete(const URLFetcher* source);
// NotificationProfile implementation.
virtual void Observe(int type,
diff --git a/chrome/browser/sync/glue/http_bridge.cc b/chrome/browser/sync/glue/http_bridge.cc
index e254e16..f3a0120 100644
--- a/chrome/browser/sync/glue/http_bridge.cc
+++ b/chrome/browser/sync/glue/http_bridge.cc
@@ -8,6 +8,7 @@
#include "base/message_loop_proxy.h"
#include "base/string_number_conversions.h"
#include "content/browser/browser_thread.h"
+#include "content/common/net/url_fetcher.h"
#include "content/public/common/content_client.h"
#include "net/base/cookie_monster.h"
#include "net/base/host_resolver.h"
@@ -265,12 +266,7 @@ void HttpBridge::Abort() {
http_post_completed_.Signal();
}
-void HttpBridge::OnURLFetchComplete(const URLFetcher *source,
- const GURL &url,
- const net::URLRequestStatus &status,
- int response_code,
- const net::ResponseCookies &cookies,
- const std::string &data) {
+void HttpBridge::OnURLFetchComplete(const URLFetcher *source) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
base::AutoLock lock(fetch_state_lock_);
if (fetch_state_.aborted)
@@ -278,11 +274,11 @@ void HttpBridge::OnURLFetchComplete(const URLFetcher *source,
fetch_state_.request_completed = true;
fetch_state_.request_succeeded =
- (net::URLRequestStatus::SUCCESS == status.status());
- fetch_state_.http_response_code = response_code;
- fetch_state_.error_code = status.error();
+ (net::URLRequestStatus::SUCCESS == source->status().status());
+ fetch_state_.http_response_code = source->response_code();
+ fetch_state_.error_code = source->status().error();
- fetch_state_.response_content = data;
+ source->GetResponseAsString(&fetch_state_.response_content);
fetch_state_.response_headers = source->response_headers();
// End of the line for url_poster_. It lives only on the IO loop.
diff --git a/chrome/browser/sync/glue/http_bridge.h b/chrome/browser/sync/glue/http_bridge.h
index 7f8fdb2..411967f 100644
--- a/chrome/browser/sync/glue/http_bridge.h
+++ b/chrome/browser/sync/glue/http_bridge.h
@@ -15,7 +15,7 @@
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/sync/internal_api/http_post_provider_factory.h"
#include "chrome/browser/sync/internal_api/http_post_provider_interface.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_context.h"
@@ -24,6 +24,10 @@
class MessageLoop;
class HttpBridgeTest;
+namespace net {
+class HttpResponseHeaders;
+}
+
namespace browser_sync {
// A bridge between the syncer and Chromium HTTP layers.
@@ -34,7 +38,7 @@ namespace browser_sync {
// needs to stick around across context switches, etc.
class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
public sync_api::HttpPostProviderInterface,
- public URLFetcher::Delegate {
+ public content::URLFetcherDelegate {
public:
// A request context used for HTTP requests bridged from the sync backend.
// A bridged RequestContext has a dedicated in-memory cookie store and does
@@ -115,13 +119,8 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
virtual const std::string GetResponseHeaderValue(
const std::string& name) const;
- // URLFetcher::Delegate implementation.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // content::URLFetcherDelegate implementation.
+ virtual void OnURLFetchComplete(const URLFetcher* source);
#if defined(UNIT_TEST)
net::URLRequestContextGetter* GetRequestContextGetter() const {
diff --git a/chrome/browser/sync/glue/http_bridge_unittest.cc b/chrome/browser/sync/glue/http_bridge_unittest.cc
index d4b3ef8..a3d4799 100644
--- a/chrome/browser/sync/glue/http_bridge_unittest.cc
+++ b/chrome/browser/sync/glue/http_bridge_unittest.cc
@@ -129,9 +129,11 @@ class ShuntedHttpBridge : public HttpBridge {
std::string response_content = "success!";
DummyURLFetcher fetcher;
- OnURLFetchComplete(&fetcher, GURL("www.google.com"),
- net::URLRequestStatus(),
- 200, cookies, response_content);
+ fetcher.set_url(GURL("www.google.com"));
+ fetcher.set_response_code(200);
+ fetcher.set_cookies(cookies);
+ fetcher.SetResponseString(response_content);
+ OnURLFetchComplete(&fetcher);
}
HttpBridgeTest* test_;
bool never_finishes_;
diff --git a/chrome/browser/sync/signin_manager_unittest.cc b/chrome/browser/sync/signin_manager_unittest.cc
index f8a0cbd..239c4aa 100644
--- a/chrome/browser/sync/signin_manager_unittest.cc
+++ b/chrome/browser/sync/signin_manager_unittest.cc
@@ -43,20 +43,23 @@ class SigninManagerTest : public TokenServiceTestHarness {
TestURLFetcher* fetcher = factory_.GetFetcherByID(0);
DCHECK(fetcher);
DCHECK(fetcher->delegate());
- fetcher->delegate()->OnURLFetchComplete(
- fetcher, GURL(GaiaUrls::GetInstance()->client_login_url()),
- net::URLRequestStatus(), 200, net::ResponseCookies(),
- "SID=sid\nLSID=lsid\nAuth=auth");
+
+ fetcher->set_url(GURL(GaiaUrls::GetInstance()->client_login_url()));
+ fetcher->set_status(net::URLRequestStatus());
+ fetcher->set_response_code(200);
+ fetcher->SetResponseString("SID=sid\nLSID=lsid\nAuth=auth");
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
// Then simulate the correct GetUserInfo response for the canonical email.
// A new URL fetcher is used for each call.
fetcher = factory_.GetFetcherByID(0);
DCHECK(fetcher);
DCHECK(fetcher->delegate());
- fetcher->delegate()->OnURLFetchComplete(
- fetcher, GURL(GaiaUrls::GetInstance()->get_user_info_url()),
- net::URLRequestStatus(), 200, net::ResponseCookies(),
- "email=user@gmail.com");
+ fetcher->set_url(GURL(GaiaUrls::GetInstance()->get_user_info_url()));
+ fetcher->set_status(net::URLRequestStatus());
+ fetcher->set_response_code(200);
+ fetcher->SetResponseString("email=user@gmail.com");
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
}
void SimulateSigninStartOAuth() {
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc
index 4157578..6e6deab 100644
--- a/chrome/browser/sync/test/integration/sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -36,6 +36,7 @@
#include "content/browser/browser_thread.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "content/test/test_url_fetcher_factory.h"
#include "googleurl/src/gurl.h"
#include "net/base/escape.h"
@@ -66,18 +67,15 @@ const char kSearchDomainCheckUrl[] =
}
// Helper class that checks whether a sync test server is running or not.
-class SyncServerStatusChecker : public URLFetcher::Delegate {
+class SyncServerStatusChecker : public content::URLFetcherDelegate {
public:
SyncServerStatusChecker() : running_(false) {}
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
- running_ = (status.status() == net::URLRequestStatus::SUCCESS &&
- response_code == 200 && data.find("ok") == 0);
+ virtual void OnURLFetchComplete(const URLFetcher* source) {
+ std::string data;
+ source->GetResponseAsString(&data);
+ running_ = (source->status().status() == net::URLRequestStatus::SUCCESS &&
+ source->response_code() == 200 && data.find("ok") == 0);
MessageLoop::current()->Quit();
}
diff --git a/chrome/browser/tab_contents/render_view_context_menu.h b/chrome/browser/tab_contents/render_view_context_menu.h
index 607bae0..49c23ec 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.h
+++ b/chrome/browser/tab_contents/render_view_context_menu.h
@@ -46,7 +46,7 @@ struct WebMediaPlayerAction;
// The following snippet describes the simple usage that updates a context-menu
// item with this interface.
//
-// class MyTask : public URLFetcher::Delegate {
+// class MyTask : public content::URLFetcherDelegate {
// public:
// MyTask(RenderViewContextMenuProxy* proxy, int id)
// : proxy_(proxy),
diff --git a/chrome/browser/tab_contents/spelling_menu_observer.cc b/chrome/browser/tab_contents/spelling_menu_observer.cc
index 0a77f77..a1d7e43 100644
--- a/chrome/browser/tab_contents/spelling_menu_observer.cc
+++ b/chrome/browser/tab_contents/spelling_menu_observer.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/tab_contents/render_view_context_menu.h"
#include "chrome/common/pref_names.h"
#include "content/browser/renderer_host/render_view_host.h"
+#include "content/common/net/url_fetcher.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -149,13 +150,7 @@ bool SpellingMenuObserver::Invoke(const string16& text,
return true;
}
-void SpellingMenuObserver::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void SpellingMenuObserver::OnURLFetchComplete(const URLFetcher* source) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
fetcher_.reset();
@@ -163,7 +158,9 @@ void SpellingMenuObserver::OnURLFetchComplete(
// Parse the response JSON and replace misspelled words in the |result_| text
// with their suggestions.
- succeeded_ = ParseResponse(response, data);
+ std::string data;
+ source->GetResponseAsString(&data);
+ succeeded_ = ParseResponse(source->response_code(), data);
if (!succeeded_)
result_ = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_CORRECT);
diff --git a/chrome/browser/tab_contents/spelling_menu_observer.h b/chrome/browser/tab_contents/spelling_menu_observer.h
index 4ea7a54..c9e3439 100644
--- a/chrome/browser/tab_contents/spelling_menu_observer.h
+++ b/chrome/browser/tab_contents/spelling_menu_observer.h
@@ -12,17 +12,21 @@
#include "base/string16.h"
#include "base/timer.h"
#include "chrome/browser/tab_contents/render_view_context_menu_observer.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
class GURL;
class RenderViewContextMenuProxy;
+namespace net {
+class URLRequestContextGetter;
+}
+
// An observer that listens to events from the RenderViewContextMenu class and
// shows suggestions from the Spelling ("do you mean") service to a context menu
// while we show it. This class implements two interfaces:
// * RenderViewContextMenuObserver
// This interface is used for adding a menu item and update it while showing.
-// * URLFetcher::Delegate
+// * content::URLFetcherDelegate
// This interface is used for sending a JSON_RPC request to the Spelling
// service and retrieving its response.
// These interfaces allow this class to make a JSON-RPC call to the Spelling
@@ -37,7 +41,7 @@ class RenderViewContextMenuProxy;
// }
//
class SpellingMenuObserver : public RenderViewContextMenuObserver,
- public URLFetcher::Delegate {
+ public content::URLFetcherDelegate {
public:
explicit SpellingMenuObserver(RenderViewContextMenuProxy* proxy);
virtual ~SpellingMenuObserver();
@@ -48,13 +52,8 @@ class SpellingMenuObserver : public RenderViewContextMenuObserver,
virtual bool IsCommandIdEnabled(int command_id) OVERRIDE;
virtual void ExecuteCommand(int command_id) OVERRIDE;
- // URLFetcher::Delegate implementation.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) OVERRIDE;
+ // content::URLFetcherDelegate implementation.
+ virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
private:
// Invokes a JSON-RPC call in the background. This function sends a JSON-RPC
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index a57972f..e2677d1 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -39,6 +39,7 @@
#include "content/browser/tab_contents/navigation_details.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/common/net/url_fetcher.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
@@ -358,12 +359,7 @@ void TranslateManager::Observe(int type,
}
}
-void TranslateManager::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void TranslateManager::OnURLFetchComplete(const URLFetcher* source) {
if (translate_script_request_pending_.get() != source &&
language_list_request_pending_.get() != source) {
// Looks like crash on Mac is possibly caused with callback entering here
@@ -372,8 +368,8 @@ void TranslateManager::OnURLFetchComplete(const URLFetcher* source,
return;
}
- bool error = (status.status() != net::URLRequestStatus::SUCCESS ||
- response_code != 200);
+ bool error = (source->status().status() != net::URLRequestStatus::SUCCESS ||
+ source->response_code() != 200);
if (translate_script_request_pending_.get() == source) {
scoped_ptr<const URLFetcher> delete_ptr(
translate_script_request_pending_.release());
@@ -382,6 +378,8 @@ void TranslateManager::OnURLFetchComplete(const URLFetcher* source,
GetRawDataResource(IDR_TRANSLATE_JS);
DCHECK(translate_script_.empty());
str.CopyToString(&translate_script_);
+ std::string data;
+ source->GetResponseAsString(&data);
translate_script_ += "\n" + data;
// We'll expire the cached script after some time, to make sure long
// running browsers still get fixes that might get pushed with newer
@@ -429,10 +427,13 @@ void TranslateManager::OnURLFetchComplete(const URLFetcher* source,
} else { // if (translate_script_request_pending_.get() == source)
scoped_ptr<const URLFetcher> delete_ptr(
language_list_request_pending_.release());
- if (!error)
+ if (!error) {
+ std::string data;
+ source->GetResponseAsString(&data);
SetSupportedLanguages(data);
- else
+ } else {
VLOG(1) << "Failed to Fetch languages from: " << kLanguageListFetchURL;
+ }
}
}
diff --git a/chrome/browser/translate/translate_manager.h b/chrome/browser/translate/translate_manager.h
index bf06f48..2cc790f 100644
--- a/chrome/browser/translate/translate_manager.h
+++ b/chrome/browser/translate/translate_manager.h
@@ -16,7 +16,7 @@
#include "base/memory/weak_ptr.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
#include "chrome/common/translate_errors.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -33,7 +33,7 @@ class TranslateInfoBarDelegate;
// It is a singleton.
class TranslateManager : public content::NotificationObserver,
- public URLFetcher::Delegate {
+ public content::URLFetcherDelegate {
public:
// Returns the singleton instance.
static TranslateManager* GetInstance();
@@ -74,13 +74,8 @@ class TranslateManager : public content::NotificationObserver,
const content::NotificationSource& source,
const content::NotificationDetails& details);
- // URLFetcher::Delegate implementation:
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // content::URLFetcherDelegate implementation:
+ virtual void OnURLFetchComplete(const URLFetcher* source);
// Used by unit-tests to override the default delay after which the translate
// script is fetched again from the translation server.
diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc
index a0cba92..d09a13d 100644
--- a/chrome/browser/translate/translate_manager_browsertest.cc
+++ b/chrome/browser/translate/translate_manager_browsertest.cc
@@ -190,10 +190,10 @@ class TranslateManagerTest : public TabContentsWrapperTestHarness,
net::URLRequestStatus status;
status.set_status(success ? net::URLRequestStatus::SUCCESS :
net::URLRequestStatus::FAILED);
- fetcher->delegate()->OnURLFetchComplete(fetcher, fetcher->original_url(),
- status, success ? 200 : 500,
- net::ResponseCookies(),
- std::string());
+ fetcher->set_url(fetcher->original_url());
+ fetcher->set_status(status);
+ fetcher->set_response_code(success ? 200 : 500);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
}
void SimulateSupportedLanguagesURLFetch(
@@ -218,10 +218,11 @@ class TranslateManagerTest : public TabContentsWrapperTestHarness,
}
data += "}})";
}
- fetcher->delegate()->OnURLFetchComplete(fetcher, fetcher->original_url(),
- status, success ? 200 : 500,
- net::ResponseCookies(),
- data);
+ fetcher->set_url(fetcher->original_url());
+ fetcher->set_status(status);
+ fetcher->set_response_code(success ? 200 : 500);
+ fetcher->SetResponseString(data);
+ fetcher->delegate()->OnURLFetchComplete(fetcher);
}
void SetPrefObserverExpectation(const char* path) {
diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc
index d9ac0d6..f9f1d34 100644
--- a/chrome/browser/web_resource/web_resource_service.cc
+++ b/chrome/browser/web_resource/web_resource_service.cc
@@ -23,12 +23,13 @@
#include "content/browser/browser_thread.h"
#include "content/common/net/url_fetcher.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_status.h"
class WebResourceService::WebResourceFetcher
- : public URLFetcher::Delegate {
+ : public content::URLFetcherDelegate {
public:
explicit WebResourceFetcher(WebResourceService* web_resource_service) :
ALLOW_THIS_IN_INITIALIZER_LIST(fetcher_factory_(this)),
@@ -78,21 +79,18 @@ class WebResourceService::WebResourceFetcher
url_fetcher_->Start();
}
- // From URLFetcher::Delegate.
- void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+ // From content::URLFetcherDelegate.
+ void OnURLFetchComplete(const URLFetcher* source) {
// Delete the URLFetcher when this function exits.
scoped_ptr<URLFetcher> clean_up_fetcher(url_fetcher_.release());
// Don't parse data if attempt to download was unsuccessful.
// Stop loading new web resource data, and silently exit.
- if (!status.is_success() || (response_code != 200))
+ if (!source->status().is_success() || (source->response_code() != 200))
return;
+ std::string data;
+ source->GetResponseAsString(&data);
web_resource_service_->UpdateResourceCache(data);
web_resource_service_->Release();
}
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 34cf4de..8bcc58d 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -72,6 +72,7 @@
'common/chrome_content_client.h',
'common/chrome_notification_types.h',
'common/chrome_plugin_messages.h',
+ 'common/chrome_result_codes.h',
'common/chrome_utility_messages.h',
'common/chrome_version_info.cc',
'common/chrome_version_info_linux.cc',
diff --git a/chrome/common/net/gaia/gaia_auth_fetcher.cc b/chrome/common/net/gaia/gaia_auth_fetcher.cc
index c8edd96..a66032b 100644
--- a/chrome/common/net/gaia/gaia_auth_fetcher.cc
+++ b/chrome/common/net/gaia/gaia_auth_fetcher.cc
@@ -16,6 +16,7 @@
#include "chrome/common/net/gaia/gaia_urls.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
#include "chrome/common/net/http_return.h"
+#include "content/common/net/url_fetcher.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_context_getter.h"
@@ -129,7 +130,7 @@ URLFetcher* GaiaAuthFetcher::CreateGaiaFetcher(
const std::string& body,
const GURL& gaia_gurl,
bool send_cookies,
- URLFetcher::Delegate* delegate) {
+ content::URLFetcherDelegate* delegate) {
URLFetcher* to_return =
URLFetcher::Create(0,
@@ -579,13 +580,13 @@ void GaiaAuthFetcher::OnMergeSessionFetched(const std::string& data,
}
}
-void GaiaAuthFetcher::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void GaiaAuthFetcher::OnURLFetchComplete(const URLFetcher* source) {
fetch_pending_ = false;
+ const GURL& url = source->url();
+ const net::URLRequestStatus& status = source->status();
+ int response_code = source->response_code();
+ std::string data;
+ source->GetResponseAsString(&data);
if (url == client_login_gurl_) {
OnClientLoginFetched(data, status, response_code);
} else if (url == issue_auth_token_gurl_) {
diff --git a/chrome/common/net/gaia/gaia_auth_fetcher.h b/chrome/common/net/gaia/gaia_auth_fetcher.h
index e9cbdd3..4e95cc6 100644
--- a/chrome/common/net/gaia/gaia_auth_fetcher.h
+++ b/chrome/common/net/gaia/gaia_auth_fetcher.h
@@ -11,7 +11,7 @@
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/common/net/gaia/gaia_auth_consumer.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
// Authenticate a user against the Google Accounts ClientLogin API
@@ -26,7 +26,12 @@
class GaiaAuthFetcherTest;
-class GaiaAuthFetcher : public URLFetcher::Delegate {
+namespace net {
+class URLRequestContextGetter;
+class URLRequestStatus;
+}
+
+class GaiaAuthFetcher : public content::URLFetcherDelegate {
public:
enum HostedAccountsSetting {
HostedAccountsAllowed,
@@ -76,13 +81,8 @@ class GaiaAuthFetcher : public URLFetcher::Delegate {
// existing accounts.
void StartMergeSession(const std::string& auth_token);
- // Implementation of URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // Implementation of content::URLFetcherDelegate
+ virtual void OnURLFetchComplete(const URLFetcher* source);
// StartClientLogin been called && results not back yet?
bool HasPendingFetch();
@@ -201,7 +201,7 @@ class GaiaAuthFetcher : public URLFetcher::Delegate {
const std::string& body,
const GURL& gaia_gurl,
bool send_cookies,
- URLFetcher::Delegate* delegate);
+ content::URLFetcherDelegate* delegate);
// From a URLFetcher result, generate an appropriate error.
// From the API documentation, both IssueAuthToken and ClientLogin have
diff --git a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
index 8f49ebb..5d8426c 100644
--- a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
+++ b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc
@@ -18,6 +18,7 @@
#include "chrome/common/net/http_return.h"
#include "chrome/test/base/testing_profile.h"
#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "content/test/test_url_fetcher_factory.h"
#include "googleurl/src/gurl.h"
#include "net/base/load_flags.h"
@@ -32,32 +33,63 @@ MockFetcher::MockFetcher(bool success,
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d)
+ content::URLFetcherDelegate* d)
: URLFetcher(url, request_type, d),
- success_(success),
url_(url),
- results_(results) {}
-
-MockFetcher::~MockFetcher() {}
-
-void MockFetcher::Start() {
+ results_(results) {
net::URLRequestStatus::Status code;
- int http_code;
- if (success_) {
- http_code = RC_REQUEST_OK;
+
+ if (success) {
+ response_code_ = RC_REQUEST_OK;
code = net::URLRequestStatus::SUCCESS;
} else {
- http_code = RC_FORBIDDEN;
+ response_code_ = RC_FORBIDDEN;
code = net::URLRequestStatus::FAILED;
}
- net::URLRequestStatus status(code, 0);
- delegate()->OnURLFetchComplete(NULL,
- url_,
- status,
- http_code,
- net::ResponseCookies(),
- results_);
+ status_ = net::URLRequestStatus(code, 0);
+}
+
+MockFetcher::MockFetcher(const GURL& url,
+ const net::URLRequestStatus& status,
+ int response_code,
+ const net::ResponseCookies& cookies,
+ const std::string& results,
+ URLFetcher::RequestType request_type,
+ content::URLFetcherDelegate* d)
+ : URLFetcher(url, request_type, d),
+ url_(url),
+ status_(status),
+ response_code_(response_code),
+ cookies_(cookies),
+ results_(results) {
+}
+
+MockFetcher::~MockFetcher() {}
+
+void MockFetcher::Start() {
+ delegate()->OnURLFetchComplete(this);
+}
+
+const GURL& MockFetcher::url() const {
+ return url_;
+}
+
+const net::URLRequestStatus& MockFetcher::status() const {
+ return status_;
+}
+
+int MockFetcher::response_code() const {
+ return response_code_;
+}
+
+const net::ResponseCookies& MockFetcher::cookies() const {
+ return cookies_;
+}
+
+bool MockFetcher::GetResponseAsString(std::string* out_response_string) const {
+ *out_response_string = results_;
+ return true;
}
@@ -173,12 +205,10 @@ TEST_F(GaiaAuthFetcherTest, LoginNetFailure) {
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
- auth.OnURLFetchComplete(NULL,
- client_login_source_,
- status,
- 0,
- cookies_,
- std::string());
+ MockFetcher mock_fetcher(
+ client_login_source_, status, 0, net::ResponseCookies(), std::string(),
+ URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
}
TEST_F(GaiaAuthFetcherTest, TokenNetFailure) {
@@ -195,12 +225,10 @@ TEST_F(GaiaAuthFetcherTest, TokenNetFailure) {
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
- auth.OnURLFetchComplete(NULL,
- issue_auth_token_source_,
- status,
- 0,
- cookies_,
- std::string());
+ MockFetcher mock_fetcher(
+ issue_auth_token_source_, status, 0, cookies_, std::string(),
+ URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
}
@@ -217,12 +245,11 @@ TEST_F(GaiaAuthFetcherTest, LoginDenied) {
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
- auth.OnURLFetchComplete(NULL,
- client_login_source_,
- status,
- RC_FORBIDDEN,
- cookies_,
- data);
+
+ MockFetcher mock_fetcher(
+ client_login_source_, status, RC_FORBIDDEN, cookies_, data,
+ URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
}
TEST_F(GaiaAuthFetcherTest, ParseRequest) {
@@ -267,12 +294,10 @@ TEST_F(GaiaAuthFetcherTest, OnlineLogin) {
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
- auth.OnURLFetchComplete(NULL,
- client_login_source_,
- status,
- RC_REQUEST_OK,
- cookies_,
- data);
+ MockFetcher mock_fetcher(
+ client_login_source_, status, RC_REQUEST_OK, cookies_, data,
+ URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
}
TEST_F(GaiaAuthFetcherTest, WorkingIssueAuthToken) {
@@ -283,12 +308,10 @@ TEST_F(GaiaAuthFetcherTest, WorkingIssueAuthToken) {
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
- auth.OnURLFetchComplete(NULL,
- issue_auth_token_source_,
- status,
- RC_REQUEST_OK,
- cookies_,
- "token");
+ MockFetcher mock_fetcher(
+ issue_auth_token_source_, status, RC_REQUEST_OK, cookies_, "token",
+ URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
}
TEST_F(GaiaAuthFetcherTest, CheckTwoFactorResponse) {
@@ -317,12 +340,10 @@ TEST_F(GaiaAuthFetcherTest, TwoFactorLogin) {
GaiaAuthFetcher auth(&consumer, std::string(),
profile_.GetRequestContext());
net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
- auth.OnURLFetchComplete(NULL,
- client_login_source_,
- status,
- RC_FORBIDDEN,
- cookies_,
- response);
+ MockFetcher mock_fetcher(
+ client_login_source_, status, RC_FORBIDDEN, cookies_, response,
+ URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
}
TEST_F(GaiaAuthFetcherTest, CaptchaParse) {
@@ -473,13 +494,12 @@ TEST_F(GaiaAuthFetcherTest, ClientFetchPending) {
GaiaAuthFetcher::HostedAccountsAllowed);
EXPECT_TRUE(auth.HasPendingFetch());
- auth.OnURLFetchComplete(
- NULL,
+ MockFetcher mock_fetcher(
client_login_source_,
net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- RC_REQUEST_OK,
- cookies_,
- "SID=sid\nLSID=lsid\nAuth=auth\n");
+ RC_REQUEST_OK, cookies_, "SID=sid\nLSID=lsid\nAuth=auth\n",
+ URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
EXPECT_FALSE(auth.HasPendingFetch());
}
@@ -496,13 +516,12 @@ TEST_F(GaiaAuthFetcherTest, FullTokenSuccess) {
auth.StartIssueAuthToken("sid", "lsid", "service");
EXPECT_TRUE(auth.HasPendingFetch());
- auth.OnURLFetchComplete(
- NULL,
+ MockFetcher mock_fetcher(
issue_auth_token_source_,
net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- RC_REQUEST_OK,
- cookies_,
- "token");
+ RC_REQUEST_OK, cookies_, "token",
+ URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
EXPECT_FALSE(auth.HasPendingFetch());
}
@@ -519,13 +538,11 @@ TEST_F(GaiaAuthFetcherTest, FullTokenFailure) {
auth.StartIssueAuthToken("sid", "lsid", "service");
EXPECT_TRUE(auth.HasPendingFetch());
- auth.OnURLFetchComplete(
- NULL,
+ MockFetcher mock_fetcher(
issue_auth_token_source_,
net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- RC_FORBIDDEN,
- cookies_,
- "");
+ RC_FORBIDDEN, cookies_, "", URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
EXPECT_FALSE(auth.HasPendingFetch());
}
@@ -542,13 +559,11 @@ TEST_F(GaiaAuthFetcherTest, TokenAuthSuccess) {
auth.StartTokenAuth("myubertoken");
EXPECT_TRUE(auth.HasPendingFetch());
- auth.OnURLFetchComplete(
- NULL,
+ MockFetcher mock_fetcher(
token_auth_source_,
net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- RC_REQUEST_OK,
- cookies_,
- "<html></html>");
+ RC_REQUEST_OK, cookies_, "<html></html>", URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
EXPECT_FALSE(auth.HasPendingFetch());
}
@@ -565,13 +580,11 @@ TEST_F(GaiaAuthFetcherTest, TokenAuthUnauthorizedFailure) {
auth.StartTokenAuth("badubertoken");
EXPECT_TRUE(auth.HasPendingFetch());
- auth.OnURLFetchComplete(
- NULL,
+ MockFetcher mock_fetcher(
token_auth_source_,
net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- RC_UNAUTHORIZED,
- cookies_,
- "");
+ RC_UNAUTHORIZED, cookies_, "", URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
EXPECT_FALSE(auth.HasPendingFetch());
}
@@ -588,13 +601,11 @@ TEST_F(GaiaAuthFetcherTest, TokenAuthNetFailure) {
auth.StartTokenAuth("badubertoken");
EXPECT_TRUE(auth.HasPendingFetch());
- auth.OnURLFetchComplete(
- NULL,
+ MockFetcher mock_fetcher(
token_auth_source_,
net::URLRequestStatus(net::URLRequestStatus::FAILED, 0),
- RC_REQUEST_OK,
- cookies_,
- "");
+ RC_REQUEST_OK, cookies_, "", URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
EXPECT_FALSE(auth.HasPendingFetch());
}
@@ -611,13 +622,11 @@ TEST_F(GaiaAuthFetcherTest, MergeSessionSuccess) {
auth.StartMergeSession("myubertoken");
EXPECT_TRUE(auth.HasPendingFetch());
- auth.OnURLFetchComplete(
- NULL,
+ MockFetcher mock_fetcher(
merge_session_source_,
net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- RC_REQUEST_OK,
- cookies_,
- "<html></html>");
+ RC_REQUEST_OK, cookies_, "<html></html>", URLFetcher::GET, &auth);
+ auth.OnURLFetchComplete(&mock_fetcher);
EXPECT_FALSE(auth.HasPendingFetch());
}
@@ -642,13 +651,12 @@ TEST_F(GaiaAuthFetcherTest, MergeSessionSuccessRedirect) {
GURL final_url("http://www.google.com/CheckCookie");
test_fetcher->set_url(final_url);
+ test_fetcher->set_status(
+ net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0));
+ test_fetcher->set_response_code(RC_REQUEST_OK);
+ test_fetcher->set_cookies(cookies_);
+ test_fetcher->SetResponseString("<html></html>");
- auth.OnURLFetchComplete(
- test_fetcher,
- test_fetcher->url(),
- net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0),
- RC_REQUEST_OK,
- cookies_,
- "<html></html>");
+ auth.OnURLFetchComplete(test_fetcher);
EXPECT_FALSE(auth.HasPendingFetch());
}
diff --git a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.h b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.h
index 0534c52..95550fc 100644
--- a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.h
+++ b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.h
@@ -17,6 +17,10 @@
#include "content/test/test_url_fetcher_factory.h"
#include "net/url_request/url_request_status.h"
+namespace content {
+class URLFetcherDelegate;
+}
+
// Responds as though ClientLogin returned from the server.
class MockFetcher : public URLFetcher {
public:
@@ -24,15 +28,31 @@ class MockFetcher : public URLFetcher {
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d);
+ content::URLFetcherDelegate* d);
+
+ MockFetcher(const GURL& url,
+ const net::URLRequestStatus& status,
+ int response_code,
+ const net::ResponseCookies& cookies,
+ const std::string& results,
+ URLFetcher::RequestType request_type,
+ content::URLFetcherDelegate* d);
virtual ~MockFetcher();
virtual void Start();
+ virtual const GURL& url() const;
+ virtual const net::URLRequestStatus& status() const;
+ virtual int response_code() const;
+ virtual const net::ResponseCookies& cookies() const;
+ virtual bool GetResponseAsString(std::string* out_response_string) const;
+
private:
- bool success_;
GURL url_;
+ net::URLRequestStatus status_;
+ int response_code_;
+ net::ResponseCookies cookies_;
std::string results_;
DISALLOW_COPY_AND_ASSIGN(MockFetcher);
};
@@ -49,7 +69,7 @@ class MockFactory : public URLFetcher::Factory,
URLFetcher* CreateURLFetcher(int id,
const GURL& url,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d) {
+ content::URLFetcherDelegate* d) {
return new T(success_, url, results_, request_type, d);
}
void set_success(bool success) {
diff --git a/chrome/common/net/gaia/gaia_oauth_client.cc b/chrome/common/net/gaia/gaia_oauth_client.cc
index 501e46e..fadf589 100644
--- a/chrome/common/net/gaia/gaia_oauth_client.cc
+++ b/chrome/common/net/gaia/gaia_oauth_client.cc
@@ -9,6 +9,7 @@
#include "base/values.h"
#include "chrome/common/net/http_return.h"
#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "googleurl/src/gurl.h"
#include "net/base/escape.h"
#include "net/url_request/url_request_context_getter.h"
@@ -23,7 +24,7 @@ namespace gaia {
class GaiaOAuthClient::Core
: public base::RefCountedThreadSafe<GaiaOAuthClient::Core>,
- public URLFetcher::Delegate {
+ public content::URLFetcherDelegate {
public:
Core(const std::string& gaia_url,
net::URLRequestContextGetter* request_context_getter)
@@ -43,25 +44,14 @@ class GaiaOAuthClient::Core
int max_retries,
GaiaOAuthClient::Delegate* delegate);
- // URLFetcher::Delegate implementation.
- virtual void OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // content::URLFetcherDelegate implementation.
+ virtual void OnURLFetchComplete(const URLFetcher* source);
private:
void MakeGaiaRequest(std::string post_body,
int max_retries,
GaiaOAuthClient::Delegate* delegate);
- void HandleResponse(const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const std::string& data,
- bool* should_retry_request);
+ void HandleResponse(const URLFetcher* source, bool* should_retry_request);
GURL gaia_url_;
int num_retries_;
@@ -113,15 +103,9 @@ void GaiaOAuthClient::Core::MakeGaiaRequest(
}
// URLFetcher::Delegate implementation.
-void GaiaOAuthClient::Core::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data) {
+void GaiaOAuthClient::Core::OnURLFetchComplete(const URLFetcher* source) {
bool should_retry = false;
- HandleResponse(source, url, status, response_code, data, &should_retry);
+ HandleResponse(source, &should_retry);
if (should_retry) {
// Explicitly call ReceivedContentWasMalformed() to ensure the current
// request gets counted as a failure for calculation of the back-off
@@ -140,24 +124,21 @@ void GaiaOAuthClient::Core::OnURLFetchComplete(
void GaiaOAuthClient::Core::HandleResponse(
const URLFetcher* source,
- const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const std::string& data,
bool* should_retry_request) {
*should_retry_request = false;
// RC_BAD_REQUEST means the arguments are invalid. No point retrying. We are
// done here.
- if (response_code == RC_BAD_REQUEST) {
+ if (source->response_code() == RC_BAD_REQUEST) {
delegate_->OnOAuthError();
return;
}
std::string access_token;
std::string refresh_token;
int expires_in_seconds = 0;
- if (response_code == RC_REQUEST_OK) {
- scoped_ptr<Value> message_value(
- base::JSONReader::Read(data, false));
+ if (source->response_code() == RC_REQUEST_OK) {
+ std::string data;
+ source->GetResponseAsString(&data);
+ scoped_ptr<Value> message_value(base::JSONReader::Read(data, false));
if (message_value.get() &&
message_value->IsType(Value::TYPE_DICTIONARY)) {
scoped_ptr<DictionaryValue> response_dict(
@@ -173,7 +154,7 @@ void GaiaOAuthClient::Core::HandleResponse(
if ((-1 != source->max_retries()) &&
(num_retries_ > source->max_retries())) {
// Retry limit reached. Give up.
- delegate_->OnNetworkError(response_code);
+ delegate_->OnNetworkError(source->response_code());
} else {
*should_retry_request = true;
}
diff --git a/chrome/common/net/gaia/gaia_oauth_client_unittest.cc b/chrome/common/net/gaia/gaia_oauth_client_unittest.cc
index 97a859b..f5d5cfb 100644
--- a/chrome/common/net/gaia/gaia_oauth_client_unittest.cc
+++ b/chrome/common/net/gaia/gaia_oauth_client_unittest.cc
@@ -13,6 +13,7 @@
#include "chrome/common/net/http_return.h"
#include "chrome/test/base/testing_profile.h"
#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "content/test/test_url_fetcher_factory.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
@@ -31,7 +32,7 @@ class MockOAuthFetcher : public URLFetcher {
const GURL& url,
const std::string& results,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d)
+ content::URLFetcherDelegate* d)
: URLFetcher(url, request_type, d),
response_code_(response_code),
max_failure_count_(max_failure_count),
@@ -51,16 +52,30 @@ class MockOAuthFetcher : public URLFetcher {
code = net::URLRequestStatus::FAILED;
current_failure_count_++;
}
- net::URLRequestStatus status(code, 0);
- delegate()->OnURLFetchComplete(this,
- url_,
- status,
- response_code_,
- net::ResponseCookies(),
- results_);
+ status_ = net::URLRequestStatus(code, 0);
+
+ delegate()->OnURLFetchComplete(this);
+ }
+
+ virtual const GURL& url() const {
+ return url_;
+ }
+
+ virtual const net::URLRequestStatus& status() const {
+ return status_;
+ }
+
+ virtual int response_code() const {
+ return response_code_;
+ }
+
+ virtual bool GetResponseAsString(std::string* out_response_string) const {
+ *out_response_string = results_;
+ return true;
}
private:
+ net::URLRequestStatus status_;
int response_code_;
int max_failure_count_;
int current_failure_count_;
@@ -81,7 +96,7 @@ class MockOAuthFetcherFactory : public URLFetcher::Factory,
int id,
const GURL& url,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d) {
+ content::URLFetcherDelegate* d) {
return new MockOAuthFetcher(
response_code_,
max_failure_count_,
diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher.cc b/chrome/service/cloud_print/cloud_print_url_fetcher.cc
index 297d56c..2604392 100644
--- a/chrome/service/cloud_print/cloud_print_url_fetcher.cc
+++ b/chrome/service/cloud_print/cloud_print_url_fetcher.cc
@@ -50,38 +50,34 @@ void CloudPrintURLFetcher::StartPostRequest(
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 @@ void CloudPrintURLFetcher::OnURLFetchComplete(
CloudPrintHelpers::ParseResponseJSON(data, &succeeded, &response_dict);
if (response_dict)
action = delegate_->HandleJSONData(source,
- url,
+ source->url(),
response_dict,
succeeded);
else
diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher.h b/chrome/service/cloud_print/cloud_print_url_fetcher.h
index ab49923..a872386 100644
--- a/chrome/service/cloud_print/cloud_print_url_fetcher.h
+++ b/chrome/service/cloud_print/cloud_print_url_fetcher.h
@@ -8,8 +8,10 @@
#include <string>
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
class GURL;
@@ -18,6 +20,7 @@ class DictionaryValue;
}
namespace net {
+class URLRequestContextGetter;
class URLRequestStatus;
} // namespace net
@@ -28,7 +31,7 @@ class URLRequestStatus;
// must also be retried.
class CloudPrintURLFetcher
: public base::RefCountedThreadSafe<CloudPrintURLFetcher>,
- public URLFetcher::Delegate {
+ public content::URLFetcherDelegate {
public:
enum ResponseAction {
CONTINUE_PROCESSING,
@@ -92,12 +95,9 @@ class CloudPrintURLFetcher
const std::string& post_data,
const std::string& additional_headers);
- // URLFetcher::Delegate implementation.
- virtual void OnURLFetchComplete(const URLFetcher* source, const GURL& url,
- const net::URLRequestStatus& status,
- int response_code,
- const net::ResponseCookies& cookies,
- const std::string& data);
+ // content::URLFetcherDelegate implementation.
+ virtual void OnURLFetchComplete(const URLFetcher* source);
+
protected:
friend class base::RefCountedThreadSafe<CloudPrintURLFetcher>;
virtual ~CloudPrintURLFetcher();
diff --git a/chrome/service/gaia/service_gaia_authenticator.cc b/chrome/service/gaia/service_gaia_authenticator.cc
index 8cfab51..08d1ddd 100644
--- a/chrome/service/gaia/service_gaia_authenticator.cc
+++ b/chrome/service/gaia/service_gaia_authenticator.cc
@@ -7,6 +7,7 @@
#include "base/message_loop_proxy.h"
#include "chrome/service/net/service_url_request_context.h"
#include "chrome/service/service_process.h"
+#include "content/common/net/url_fetcher.h"
#include "googleurl/src/gurl.h"
ServiceGaiaAuthenticator::ServiceGaiaAuthenticator(
@@ -70,11 +71,11 @@ void ServiceGaiaAuthenticator::DoPost(const GURL& post_url,
request->Start();
}
-// URLFetcher::Delegate implementation
+// content::URLFetcherDelegate implementation
void ServiceGaiaAuthenticator::OnURLFetchComplete(const URLFetcher* source) {
DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
http_response_code_ = source->response_code();
- response_data_ = source->GetResponseStringRef();
+ source->GetResponseAsString(&response_data_);
delete source;
// Add an extra reference because we want http_post_completed_ to remain
// valid until after Signal() returns.
diff --git a/chrome/service/gaia/service_gaia_authenticator.h b/chrome/service/gaia/service_gaia_authenticator.h
index 6be5a65..8c30cd2 100644
--- a/chrome/service/gaia/service_gaia_authenticator.h
+++ b/chrome/service/gaia/service_gaia_authenticator.h
@@ -8,10 +8,11 @@
#include <string>
+#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/common/net/gaia/gaia_authenticator.h"
-#include "content/common/net/url_fetcher.h"
+#include "content/public/common/url_fetcher_delegate.h"
namespace base {
class MessageLoopProxy;
@@ -21,7 +22,7 @@ class MessageLoopProxy;
// we cannot rely on the existence of a Profile)
class ServiceGaiaAuthenticator
: public base::RefCountedThreadSafe<ServiceGaiaAuthenticator>,
- public URLFetcher::Delegate,
+ public content::URLFetcherDelegate,
public gaia::GaiaAuthenticator {
public:
ServiceGaiaAuthenticator(const std::string& user_agent,
@@ -30,7 +31,7 @@ class ServiceGaiaAuthenticator
base::MessageLoopProxy* io_message_loop_proxy);
virtual ~ServiceGaiaAuthenticator();
- // URLFetcher::Delegate implementation.
+ // content::URLFetcherDelegate implementation.
virtual void OnURLFetchComplete(const URLFetcher *source) OVERRIDE;
protected: