summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 21:39:55 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 21:39:55 +0000
commit68d2a05fb6380f35eb10e7e1b9f789a742b89871 (patch)
tree74939817681c52027083ef86ebba375f047f5228 /chrome/browser
parent527498450ae8b478b6719d4603be03dfcdc8d812 (diff)
downloadchromium_src-68d2a05fb6380f35eb10e7e1b9f789a742b89871.zip
chromium_src-68d2a05fb6380f35eb10e7e1b9f789a742b89871.tar.gz
chromium_src-68d2a05fb6380f35eb10e7e1b9f789a742b89871.tar.bz2
Moved URLFetcher and related classes to chrome/common/net.
BUG=None TEST=Build and Unittests Review URL: http://codereview.chromium.org/1995008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/alternate_nav_url_fetcher.h2
-rw-r--r--chrome/browser/autocomplete/search_provider.h2
-rw-r--r--chrome/browser/autocomplete/search_provider_unittest.cc2
-rw-r--r--chrome/browser/autofill/autofill_download.h2
-rw-r--r--chrome/browser/autofill/autofill_download_unittest.cc2
-rw-r--r--chrome/browser/automation/automation_provider.cc2
-rw-r--r--chrome/browser/browsing_data_appcache_helper.h2
-rw-r--r--chrome/browser/browsing_data_remover.cc2
-rw-r--r--chrome/browser/bug_report_util.cc2
-rw-r--r--chrome/browser/chrome_plugin_host.cc4
-rw-r--r--chrome/browser/chrome_plugin_unittest.cc2
-rw-r--r--chrome/browser/chromeos/external_cookie_handler.cc2
-rw-r--r--chrome/browser/chromeos/login/auth_response_handler.h2
-rw-r--r--chrome/browser/chromeos/login/client_login_response_handler.cc2
-rw-r--r--chrome/browser/chromeos/login/cookie_fetcher.cc2
-rw-r--r--chrome/browser/chromeos/login/cookie_fetcher.h2
-rw-r--r--chrome/browser/chromeos/login/cookie_fetcher_unittest.cc2
-rw-r--r--chrome/browser/chromeos/login/google_authenticator.cc2
-rw-r--r--chrome/browser/chromeos/login/google_authenticator.h2
-rw-r--r--chrome/browser/chromeos/login/google_authenticator_unittest.cc2
-rw-r--r--chrome/browser/chromeos/login/issue_response_handler.cc2
-rw-r--r--chrome/browser/chromeos/login/login_utils.cc2
-rw-r--r--chrome/browser/chromeos/login/mock_auth_response_handler.cc2
-rw-r--r--chrome/browser/chromeos/login/user_image_downloader.cc2
-rw-r--r--chrome/browser/chromeos/login/user_image_downloader.h2
-rw-r--r--chrome/browser/cocoa/cookies_window_controller_unittest.mm2
-rw-r--r--chrome/browser/cookies_tree_model_unittest.cc2
-rw-r--r--chrome/browser/dom_ui/filebrowse_ui.cc4
-rw-r--r--chrome/browser/dom_ui/mediaplayer_ui.cc2
-rw-r--r--chrome/browser/dom_ui/net_internals_ui.cc2
-rw-r--r--chrome/browser/download/save_file_manager.cc2
-rw-r--r--chrome/browser/download/save_package.cc2
-rw-r--r--chrome/browser/extensions/extension_data_deleter.h2
-rw-r--r--chrome/browser/extensions/extension_updater.h2
-rw-r--r--chrome/browser/extensions/extension_updater_unittest.cc2
-rw-r--r--chrome/browser/geolocation/location_arbitrator.cc2
-rw-r--r--chrome/browser/geolocation/network_location_provider_unittest.cc2
-rw-r--r--chrome/browser/geolocation/network_location_request.cc2
-rw-r--r--chrome/browser/geolocation/network_location_request.h2
-rw-r--r--chrome/browser/google_url_tracker.h2
-rw-r--r--chrome/browser/gtk/options/cookies_view_unittest.cc2
-rw-r--r--chrome/browser/importer/toolbar_importer.cc2
-rw-r--r--chrome/browser/importer/toolbar_importer.h2
-rw-r--r--chrome/browser/intranet_redirect_detector.h2
-rw-r--r--chrome/browser/io_thread.cc2
-rw-r--r--chrome/browser/memory_purger.cc2
-rw-r--r--chrome/browser/metrics/metrics_service.h2
-rw-r--r--chrome/browser/net/chrome_url_request_context.h2
-rw-r--r--chrome/browser/net/cookie_policy_browsertest.cc2
-rw-r--r--chrome/browser/net/resolve_proxy_msg_helper.cc2
-rw-r--r--chrome/browser/net/sdch_dictionary_fetcher.h2
-rw-r--r--chrome/browser/net/test_url_fetcher_factory.cc27
-rw-r--r--chrome/browser/net/test_url_fetcher_factory.h82
-rw-r--r--chrome/browser/net/url_fetcher.cc361
-rw-r--r--chrome/browser/net/url_fetcher.h195
-rw-r--r--chrome/browser/net/url_fetcher_protect.cc176
-rw-r--r--chrome/browser/net/url_fetcher_protect.h146
-rw-r--r--chrome/browser/net/url_fetcher_unittest.cc613
-rw-r--r--chrome/browser/net/url_request_context_getter.cc27
-rw-r--r--chrome/browser/net/url_request_context_getter.h55
-rw-r--r--chrome/browser/net/websocket_experiment/websocket_experiment_task.cc2
-rw-r--r--chrome/browser/net/websocket_experiment/websocket_experiment_task.h2
-rw-r--r--chrome/browser/plugin_process_host.cc2
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_helpers.cc2
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_proxy_backend.h2
-rw-r--r--chrome/browser/printing/cloud_print/job_status_updater.h2
-rw-r--r--chrome/browser/printing/cloud_print/printer_job_handler.h2
-rw-r--r--chrome/browser/profile_manager.cc2
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc2
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc2
-rw-r--r--chrome/browser/renderer_host/socket_stream_host.cc2
-rw-r--r--chrome/browser/safe_browsing/protocol_manager.cc2
-rw-r--r--chrome/browser/safe_browsing/protocol_manager.h2
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.cc2
-rw-r--r--chrome/browser/search_engines/template_url_fetcher.cc2
-rw-r--r--chrome/browser/spellcheck_host.cc2
-rw-r--r--chrome/browser/spellcheck_host.h2
-rw-r--r--chrome/browser/sync/glue/http_bridge.h4
-rw-r--r--chrome/browser/sync/glue/http_bridge_unittest.cc2
-rw-r--r--chrome/browser/sync/glue/sync_backend_host.h2
-rw-r--r--chrome/browser/tab_contents/tab_contents.h2
-rw-r--r--chrome/browser/translate/translate_manager.h2
-rw-r--r--chrome/browser/translate/translate_manager_unittest.cc2
-rw-r--r--chrome/browser/views/bug_report_view.cc2
-rw-r--r--chrome/browser/views/bug_report_view.h2
-rw-r--r--chrome/browser/web_resource/web_resource_service.cc2
86 files changed, 80 insertions, 1762 deletions
diff --git a/chrome/browser/alternate_nav_url_fetcher.h b/chrome/browser/alternate_nav_url_fetcher.h
index 943f23e..2295617 100644
--- a/chrome/browser/alternate_nav_url_fetcher.h
+++ b/chrome/browser/alternate_nav_url_fetcher.h
@@ -7,8 +7,8 @@
#include <string>
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
diff --git a/chrome/browser/autocomplete/search_provider.h b/chrome/browser/autocomplete/search_provider.h
index f36c070..9c60334 100644
--- a/chrome/browser/autocomplete/search_provider.h
+++ b/chrome/browser/autocomplete/search_provider.h
@@ -22,8 +22,8 @@
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/history/history_types.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/search_engines/template_url.h"
+#include "chrome/common/net/url_fetcher.h"
class Profile;
class Value;
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index 4d9ba3b..26c5843 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -8,9 +8,9 @@
#include "chrome/browser/autocomplete/search_provider.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/history/history.h"
-#include "chrome/browser/net/test_url_fetcher_factory.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
+#include "chrome/common/net/test_url_fetcher_factory.h"
#include "chrome/test/testing_profile.h"
#include "net/url_request/url_request_status.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/autofill/autofill_download.h b/chrome/browser/autofill/autofill_download.h
index 397aae7..3ea438f 100644
--- a/chrome/browser/autofill/autofill_download.h
+++ b/chrome/browser/autofill/autofill_download.h
@@ -16,7 +16,7 @@
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/autofill/field_types.h"
#include "chrome/browser/autofill/form_structure.h"
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
class Profile;
diff --git a/chrome/browser/autofill/autofill_download_unittest.cc b/chrome/browser/autofill/autofill_download_unittest.cc
index 549e48b..085059f 100644
--- a/chrome/browser/autofill/autofill_download_unittest.cc
+++ b/chrome/browser/autofill/autofill_download_unittest.cc
@@ -6,7 +6,7 @@
#include "base/string_util.h"
#include "chrome/browser/autofill/autofill_download.h"
-#include "chrome/browser/net/test_url_fetcher_factory.h"
+#include "chrome/common/net/test_url_fetcher_factory.h"
#include "chrome/test/testing_profile.h"
#include "net/url_request/url_request_status.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index d528169..93ad3d5 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -59,7 +59,6 @@
#include "chrome/browser/io_thread.h"
#include "chrome/browser/location_bar.h"
#include "chrome/browser/login_prompt.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/net/url_request_mock_util.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/pref_service.h"
@@ -75,6 +74,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/json_value_serializer.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/browser/browsing_data_appcache_helper.h b/chrome/browser/browsing_data_appcache_helper.h
index 695a271..f5abf35 100644
--- a/chrome/browser/browsing_data_appcache_helper.h
+++ b/chrome/browser/browsing_data_appcache_helper.h
@@ -11,7 +11,7 @@
#include "base/scoped_ptr.h"
#include "base/task.h"
#include "chrome/browser/appcache/chrome_appcache_service.h"
-#include "chrome/browser/net/url_request_context_getter.h"
+#include "chrome/common/net/url_request_context_getter.h"
class Profile;
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc
index 7323444..6263d6d 100644
--- a/chrome/browser/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data_remover.cc
@@ -12,12 +12,12 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/net/chrome_url_request_context.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/password_manager/password_store.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/webdata/web_data_service.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/url_constants.h"
#include "net/base/cookie_monster.h"
diff --git a/chrome/browser/bug_report_util.cc b/chrome/browser/bug_report_util.cc
index 8426e35..b23943e 100644
--- a/chrome/browser/bug_report_util.cc
+++ b/chrome/browser/bug_report_util.cc
@@ -9,10 +9,10 @@
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/browser_process_impl.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_util.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/common/net/url_fetcher.h"
#include "googleurl/src/gurl.h"
#include "grit/locale_settings.h"
#include "unicode/locid.h"
diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc
index 56d8828..f873fd5 100644
--- a/chrome/browser/chrome_plugin_host.cc
+++ b/chrome/browser/chrome_plugin_host.cc
@@ -22,7 +22,6 @@
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/dom_ui/html_dialog_ui.h"
#include "chrome/browser/gears_integration.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/plugin_process_host.h"
#include "chrome/browser/plugin_service.h"
#include "chrome/browser/profile.h"
@@ -34,8 +33,9 @@
#include "chrome/common/chrome_plugin_util.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/gears_api.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/net/url_request_intercept_job.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/plugin_messages.h"
#include "chrome/common/render_messages.h"
#include "net/base/cookie_monster.h"
diff --git a/chrome/browser/chrome_plugin_unittest.cc b/chrome/browser/chrome_plugin_unittest.cc
index 35474b0..3116a2f 100644
--- a/chrome/browser/chrome_plugin_unittest.cc
+++ b/chrome/browser/chrome_plugin_unittest.cc
@@ -9,9 +9,9 @@
#include "base/string_util.h"
#include "chrome/browser/chrome_plugin_host.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/profile.h"
#include "chrome/common/chrome_plugin_lib.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/test/chrome_plugin/test_chrome_plugin.h"
#include "net/base/io_buffer.h"
#include "net/http/http_response_headers.h"
diff --git a/chrome/browser/chromeos/external_cookie_handler.cc b/chrome/browser/chromeos/external_cookie_handler.cc
index 525ed80..e9f0ee1 100644
--- a/chrome/browser/chromeos/external_cookie_handler.cc
+++ b/chrome/browser/chromeos/external_cookie_handler.cc
@@ -7,9 +7,9 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "chrome/browser/chromeos/pipe_reader.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/profile.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "googleurl/src/gurl.h"
#include "net/base/cookie_store.h"
#include "net/url_request/url_request_context.h"
diff --git a/chrome/browser/chromeos/login/auth_response_handler.h b/chrome/browser/chromeos/login/auth_response_handler.h
index 04e9d1d..826baeb 100644
--- a/chrome/browser/chromeos/login/auth_response_handler.h
+++ b/chrome/browser/chromeos/login/auth_response_handler.h
@@ -7,7 +7,7 @@
#include <string>
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
class GURL;
diff --git a/chrome/browser/chromeos/login/client_login_response_handler.cc b/chrome/browser/chromeos/login/client_login_response_handler.cc
index f10777d..3e495cd 100644
--- a/chrome/browser/chromeos/login/client_login_response_handler.cc
+++ b/chrome/browser/chromeos/login/client_login_response_handler.cc
@@ -9,7 +9,7 @@
#include "chrome/browser/chromeos/login/google_authenticator.h"
#include "chrome/browser/net/chrome_url_request_context.h"
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "net/base/load_flags.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/login/cookie_fetcher.cc b/chrome/browser/chromeos/login/cookie_fetcher.cc
index d27dfed..512dedf 100644
--- a/chrome/browser/chromeos/login/cookie_fetcher.cc
+++ b/chrome/browser/chromeos/login/cookie_fetcher.cc
@@ -12,10 +12,10 @@
#include "chrome/browser/chromeos/login/issue_response_handler.h"
#include "chrome/browser/chromeos/login/login_utils.h"
#include "chrome/browser/net/chrome_url_request_context.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/net/url_fetcher.h"
#include "net/url_request/url_request_status.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/login/cookie_fetcher.h b/chrome/browser/chromeos/login/cookie_fetcher.h
index 434da44..ef82d55 100644
--- a/chrome/browser/chromeos/login/cookie_fetcher.h
+++ b/chrome/browser/chromeos/login/cookie_fetcher.h
@@ -10,8 +10,8 @@
#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 "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/profile.h"
+#include "chrome/common/net/url_fetcher.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc b/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc
index f07b395..d068007 100644
--- a/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc
+++ b/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc
@@ -9,8 +9,8 @@
#include "chrome/browser/chromeos/login/client_login_response_handler.h"
#include "chrome/browser/chromeos/login/issue_response_handler.h"
#include "chrome/browser/chromeos/login/mock_auth_response_handler.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/test/testing_profile.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_status.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/chromeos/login/google_authenticator.cc b/chrome/browser/chromeos/login/google_authenticator.cc
index f0e4127..3ea86bd 100644
--- a/chrome/browser/chromeos/login/google_authenticator.cc
+++ b/chrome/browser/chromeos/login/google_authenticator.cc
@@ -23,10 +23,10 @@
#include "chrome/browser/chromeos/login/authentication_notification_details.h"
#include "chrome/browser/chromeos/login/login_status_consumer.h"
#include "chrome/browser/net/chrome_url_request_context.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/notification_service.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_status.h"
diff --git a/chrome/browser/chromeos/login/google_authenticator.h b/chrome/browser/chromeos/login/google_authenticator.h
index 2b4fa1f..58f3e5f 100644
--- a/chrome/browser/chromeos/login/google_authenticator.h
+++ b/chrome/browser/chromeos/login/google_authenticator.h
@@ -14,7 +14,7 @@
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/cryptohome_library.h"
#include "chrome/browser/chromeos/login/authenticator.h"
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "testing/gtest/include/gtest/gtest_prod.h" // For FRIEND_TEST
// Authenticates a Chromium OS user against the Google Accounts ClientLogin API.
diff --git a/chrome/browser/chromeos/login/google_authenticator_unittest.cc b/chrome/browser/chromeos/login/google_authenticator_unittest.cc
index 4d1b73d..70c9aeb 100644
--- a/chrome/browser/chromeos/login/google_authenticator_unittest.cc
+++ b/chrome/browser/chromeos/login/google_authenticator_unittest.cc
@@ -20,8 +20,8 @@
#include "chrome/browser/chromeos/login/issue_response_handler.h"
#include "chrome/browser/chromeos/login/mock_auth_response_handler.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/test/testing_profile.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_status.h"
diff --git a/chrome/browser/chromeos/login/issue_response_handler.cc b/chrome/browser/chromeos/login/issue_response_handler.cc
index 638ac0f..bfc1ae2 100644
--- a/chrome/browser/chromeos/login/issue_response_handler.cc
+++ b/chrome/browser/chromeos/login/issue_response_handler.cc
@@ -7,7 +7,7 @@
#include <string>
#include "chrome/browser/net/chrome_url_request_context.h"
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "net/base/load_flags.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index f089d5e..759b2eb 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -19,11 +19,11 @@
#include "chrome/browser/chromeos/login/google_authenticator.h"
#include "chrome/browser/chromeos/login/pam_google_authenticator.h"
#include "chrome/browser/chromeos/login/user_manager.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/notification_service.h"
diff --git a/chrome/browser/chromeos/login/mock_auth_response_handler.cc b/chrome/browser/chromeos/login/mock_auth_response_handler.cc
index 1d04331..755064d 100644
--- a/chrome/browser/chromeos/login/mock_auth_response_handler.cc
+++ b/chrome/browser/chromeos/login/mock_auth_response_handler.cc
@@ -7,7 +7,7 @@
#include <string>
#include "base/message_loop.h"
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_status.h"
#include "testing/gmock/include/gmock/gmock.h"
diff --git a/chrome/browser/chromeos/login/user_image_downloader.cc b/chrome/browser/chromeos/login/user_image_downloader.cc
index fc174f6..1859e8c 100644
--- a/chrome/browser/chromeos/login/user_image_downloader.cc
+++ b/chrome/browser/chromeos/login/user_image_downloader.cc
@@ -12,9 +12,9 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/chromeos/login/user_manager.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/net/url_fetcher.h"
#include "gfx/codec/png_codec.h"
#include "googleurl/src/gurl.h"
diff --git a/chrome/browser/chromeos/login/user_image_downloader.h b/chrome/browser/chromeos/login/user_image_downloader.h
index 54989b0..38ea044 100644
--- a/chrome/browser/chromeos/login/user_image_downloader.h
+++ b/chrome/browser/chromeos/login/user_image_downloader.h
@@ -10,8 +10,8 @@
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/utility_process_host.h"
+#include "chrome/common/net/url_fetcher.h"
class ResourceDispatcherHost;
diff --git a/chrome/browser/cocoa/cookies_window_controller_unittest.mm b/chrome/browser/cocoa/cookies_window_controller_unittest.mm
index dcc0129..8e2b14a 100644
--- a/chrome/browser/cocoa/cookies_window_controller_unittest.mm
+++ b/chrome/browser/cocoa/cookies_window_controller_unittest.mm
@@ -15,8 +15,8 @@
#include "chrome/browser/mock_browsing_data_database_helper.h"
#include "chrome/browser/mock_browsing_data_local_storage_helper.h"
#include "chrome/browser/mock_browsing_data_appcache_helper.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/cookies_tree_model.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/test/testing_profile.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_context.h"
diff --git a/chrome/browser/cookies_tree_model_unittest.cc b/chrome/browser/cookies_tree_model_unittest.cc
index 6e026b8..9417c21 100644
--- a/chrome/browser/cookies_tree_model_unittest.cc
+++ b/chrome/browser/cookies_tree_model_unittest.cc
@@ -10,7 +10,7 @@
#include "chrome/browser/mock_browsing_data_appcache_helper.h"
#include "chrome/browser/mock_browsing_data_database_helper.h"
#include "chrome/browser/mock_browsing_data_local_storage_helper.h"
-#include "chrome/browser/net/url_request_context_getter.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/test/testing_profile.h"
#include "net/url_request/url_request_context.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc
index 39e4474..597fc37 100644
--- a/chrome/browser/dom_ui/filebrowse_ui.cc
+++ b/chrome/browser/dom_ui/filebrowse_ui.cc
@@ -27,14 +27,14 @@
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/metrics/user_metrics.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/dom_ui/mediaplayer_ui.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/time_format.h"
#include "chrome/common/url_constants.h"
-#include "chrome/browser/dom_ui/mediaplayer_ui.h"
#include "net/base/escape.h"
#include "grit/browser_resources.h"
diff --git a/chrome/browser/dom_ui/mediaplayer_ui.cc b/chrome/browser/dom_ui/mediaplayer_ui.cc
index c5f9891..90098d6 100644
--- a/chrome/browser/dom_ui/mediaplayer_ui.cc
+++ b/chrome/browser/dom_ui/mediaplayer_ui.cc
@@ -25,12 +25,12 @@
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/metrics/user_metrics.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/time_format.h"
#include "chrome/common/url_constants.h"
#include "net/base/escape.h"
diff --git a/chrome/browser/dom_ui/net_internals_ui.cc b/chrome/browser/dom_ui/net_internals_ui.cc
index 5f4139a..0df73d9 100644
--- a/chrome/browser/dom_ui/net_internals_ui.cc
+++ b/chrome/browser/dom_ui/net_internals_ui.cc
@@ -24,9 +24,9 @@
#include "chrome/browser/net/chrome_net_log.h"
#include "chrome/browser/net/connection_tester.h"
#include "chrome/browser/net/passive_log_collector.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/profile.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/url_constants.h"
#include "net/base/escape.h"
#include "net/base/host_resolver_impl.h"
diff --git a/chrome/browser/download/save_file_manager.cc b/chrome/browser/download/save_file_manager.cc
index 9bbd9b0..f106d6a 100644
--- a/chrome/browser/download/save_file_manager.cc
+++ b/chrome/browser/download/save_file_manager.cc
@@ -15,12 +15,12 @@
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/download/save_file.h"
#include "chrome/browser/download/save_package.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_util.h"
#include "net/base/io_buffer.h"
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index 58689cc..0510653 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -23,7 +23,6 @@
#include "chrome/browser/download/save_file.h"
#include "chrome/browser/download/save_file_manager.h"
#include "chrome/browser/download/save_item.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
@@ -34,6 +33,7 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
diff --git a/chrome/browser/extensions/extension_data_deleter.h b/chrome/browser/extensions/extension_data_deleter.h
index a886833..d7f13327 100644
--- a/chrome/browser/extensions/extension_data_deleter.h
+++ b/chrome/browser/extensions/extension_data_deleter.h
@@ -10,7 +10,7 @@
#include "base/ref_counted.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/in_process_webkit/webkit_context.h"
-#include "chrome/browser/net/url_request_context_getter.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "googleurl/src/gurl.h"
#include "webkit/database/database_tracker.h"
diff --git a/chrome/browser/extensions/extension_updater.h b/chrome/browser/extensions/extension_updater.h
index c1f036f..968aa2b 100644
--- a/chrome/browser/extensions/extension_updater.h
+++ b/chrome/browser/extensions/extension_updater.h
@@ -18,8 +18,8 @@
#include "base/time.h"
#include "base/timer.h"
#include "chrome/browser/extensions/extensions_service.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/common/extensions/update_manifest.h"
+#include "chrome/common/net/url_fetcher.h"
#include "googleurl/src/gurl.h"
class Extension;
diff --git a/chrome/browser/extensions/extension_updater_unittest.cc b/chrome/browser/extensions/extension_updater_unittest.cc
index b783517..523502d 100644
--- a/chrome/browser/extensions/extension_updater_unittest.cc
+++ b/chrome/browser/extensions/extension_updater_unittest.cc
@@ -16,11 +16,11 @@
#include "chrome/browser/extensions/extension_updater.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/extensions/test_extension_prefs.h"
-#include "chrome/browser/net/test_url_fetcher_factory.h"
#include "chrome/browser/pref_service.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/net/test_url_fetcher_factory.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/geolocation/location_arbitrator.cc b/chrome/browser/geolocation/location_arbitrator.cc
index 4f46799..e0d513a 100644
--- a/chrome/browser/geolocation/location_arbitrator.cc
+++ b/chrome/browser/geolocation/location_arbitrator.cc
@@ -11,11 +11,11 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/geolocation/access_token_store.h"
#include "chrome/browser/geolocation/location_provider.h"
#include "chrome/browser/profile.h"
#include "chrome/common/geoposition.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "googleurl/src/gurl.h"
namespace {
diff --git a/chrome/browser/geolocation/network_location_provider_unittest.cc b/chrome/browser/geolocation/network_location_provider_unittest.cc
index c27565e..42ec2f6f 100644
--- a/chrome/browser/geolocation/network_location_provider_unittest.cc
+++ b/chrome/browser/geolocation/network_location_provider_unittest.cc
@@ -9,7 +9,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/geolocation/fake_access_token_store.h"
-#include "chrome/browser/net/test_url_fetcher_factory.h"
+#include "chrome/common/net/test_url_fetcher_factory.h"
#include "net/url_request/url_request_status.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/geolocation/network_location_request.cc b/chrome/browser/geolocation/network_location_request.cc
index 5e38eff..54018af 100644
--- a/chrome/browser/geolocation/network_location_request.cc
+++ b/chrome/browser/geolocation/network_location_request.cc
@@ -8,8 +8,8 @@
#include "base/json/json_writer.h"
#include "base/string_util.h"
#include "base/values.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/common/geoposition.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_status.h"
diff --git a/chrome/browser/geolocation/network_location_request.h b/chrome/browser/geolocation/network_location_request.h
index e08d570..6e38a28 100644
--- a/chrome/browser/geolocation/network_location_request.h
+++ b/chrome/browser/geolocation/network_location_request.h
@@ -9,7 +9,7 @@
#include "base/basictypes.h"
#include "base/ref_counted.h"
#include "chrome/browser/geolocation/device_data_provider.h"
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "googleurl/src/gurl.h"
class URLRequestContextGetter;
diff --git a/chrome/browser/google_url_tracker.h b/chrome/browser/google_url_tracker.h
index 636e44e..896fc10 100644
--- a/chrome/browser/google_url_tracker.h
+++ b/chrome/browser/google_url_tracker.h
@@ -7,7 +7,7 @@
#include <string>
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/notification_registrar.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
diff --git a/chrome/browser/gtk/options/cookies_view_unittest.cc b/chrome/browser/gtk/options/cookies_view_unittest.cc
index 0aeef90..01e9937 100644
--- a/chrome/browser/gtk/options/cookies_view_unittest.cc
+++ b/chrome/browser/gtk/options/cookies_view_unittest.cc
@@ -14,7 +14,7 @@
#include "chrome/browser/mock_browsing_data_database_helper.h"
#include "chrome/browser/mock_browsing_data_local_storage_helper.h"
#include "chrome/browser/gtk/gtk_chrome_cookie_view.h"
-#include "chrome/browser/net/url_request_context_getter.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/test/testing_profile.h"
#include "net/url_request/url_request_context.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc
index a2a5430..767d608 100644
--- a/chrome/browser/importer/toolbar_importer.cc
+++ b/chrome/browser/importer/toolbar_importer.cc
@@ -12,9 +12,9 @@
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/first_run.h"
#include "chrome/browser/importer/importer_bridge.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/profile.h"
#include "chrome/common/libxml_utils.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "grit/generated_resources.h"
#include "net/base/cookie_monster.h"
#include "net/base/data_url.h"
diff --git a/chrome/browser/importer/toolbar_importer.h b/chrome/browser/importer/toolbar_importer.h
index ab0160a..23f4291 100644
--- a/chrome/browser/importer/toolbar_importer.h
+++ b/chrome/browser/importer/toolbar_importer.h
@@ -13,7 +13,7 @@
#include "chrome/browser/importer/importer.h"
#include "chrome/browser/importer/importer_data_types.h"
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
class ImporterBridge;
diff --git a/chrome/browser/intranet_redirect_detector.h b/chrome/browser/intranet_redirect_detector.h
index b8c5dca..3ab75a0 100644
--- a/chrome/browser/intranet_redirect_detector.h
+++ b/chrome/browser/intranet_redirect_detector.h
@@ -9,7 +9,7 @@
#include <string>
#include <vector>
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/notification_registrar.h"
#include "googleurl/src/gurl.h"
#include "net/base/host_resolver_proc.h"
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 28824b5..7436750 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -12,8 +12,8 @@
#include "chrome/browser/net/chrome_net_log.h"
#include "chrome/browser/net/dns_global.h"
#include "chrome/browser/net/passive_log_collector.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/net/url_fetcher.h"
#include "net/base/mapped_host_resolver.h"
#include "net/base/host_cache.h"
#include "net/base/host_resolver.h"
diff --git a/chrome/browser/memory_purger.cc b/chrome/browser/memory_purger.cc
index 60e4bbe..9117811 100644
--- a/chrome/browser/memory_purger.cc
+++ b/chrome/browser/memory_purger.cc
@@ -11,13 +11,13 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/in_process_webkit/webkit_context.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/renderer_host/backing_store_manager.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/webdata/web_data_service.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
#include "net/proxy/proxy_resolver.h"
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index e4475c1..09f1ef8 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -19,8 +19,8 @@
#include "base/scoped_ptr.h"
#include "base/values.h"
#include "chrome/browser/metrics/metrics_log.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/common/child_process_info.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/notification_registrar.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
#include "webkit/glue/plugins/webplugininfo.h"
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index a42464f..c9e0f99 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -19,8 +19,8 @@
#include "chrome/browser/pref_service.h"
#include "chrome/browser/privacy_blacklist/blacklist.h"
#include "chrome/browser/net/chrome_cookie_policy.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/common/extensions/extension.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_registrar.h"
#include "net/url_request/url_request_context.h"
diff --git a/chrome/browser/net/cookie_policy_browsertest.cc b/chrome/browser/net/cookie_policy_browsertest.cc
index 923f4c5..7a33ce9 100644
--- a/chrome/browser/net/cookie_policy_browsertest.cc
+++ b/chrome/browser/net/cookie_policy_browsertest.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/host_content_settings_map.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/profile.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
#include "net/base/mock_host_resolver.h"
diff --git a/chrome/browser/net/resolve_proxy_msg_helper.cc b/chrome/browser/net/resolve_proxy_msg_helper.cc
index d73f0fb..3ceab9a 100644
--- a/chrome/browser/net/resolve_proxy_msg_helper.cc
+++ b/chrome/browser/net/resolve_proxy_msg_helper.cc
@@ -6,7 +6,7 @@
#include "base/compiler_specific.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/net/url_request_context_getter.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "net/base/net_errors.h"
#include "net/url_request/url_request_context.h"
diff --git a/chrome/browser/net/sdch_dictionary_fetcher.h b/chrome/browser/net/sdch_dictionary_fetcher.h
index 12c022a..3a975ce 100644
--- a/chrome/browser/net/sdch_dictionary_fetcher.h
+++ b/chrome/browser/net/sdch_dictionary_fetcher.h
@@ -16,7 +16,7 @@
#include "base/compiler_specific.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "net/base/sdch_manager.h"
class SdchDictionaryFetcher : public URLFetcher::Delegate,
diff --git a/chrome/browser/net/test_url_fetcher_factory.cc b/chrome/browser/net/test_url_fetcher_factory.cc
deleted file mode 100644
index 7573646..0000000
--- a/chrome/browser/net/test_url_fetcher_factory.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/net/test_url_fetcher_factory.h"
-
-TestURLFetcher::TestURLFetcher(const GURL& url,
- URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d)
- : URLFetcher(url, request_type, d),
- original_url_(url) {
-}
-
-URLFetcher* TestURLFetcherFactory::CreateURLFetcher(
- int id,
- const GURL& url,
- URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d) {
- TestURLFetcher* fetcher = new TestURLFetcher(url, request_type, d);
- fetchers_[id] = fetcher;
- return fetcher;
-}
-
-TestURLFetcher* TestURLFetcherFactory::GetFetcherByID(int id) const {
- Fetchers::const_iterator i = fetchers_.find(id);
- return i == fetchers_.end() ? NULL : i->second;
-}
diff --git a/chrome/browser/net/test_url_fetcher_factory.h b/chrome/browser/net/test_url_fetcher_factory.h
deleted file mode 100644
index a6ea7c4..0000000
--- a/chrome/browser/net/test_url_fetcher_factory.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_NET_TEST_URL_FETCHER_FACTORY_H_
-#define CHROME_BROWSER_NET_TEST_URL_FETCHER_FACTORY_H_
-
-#include <map>
-#include <string>
-
-#include "chrome/browser/net/url_fetcher.h"
-#include "googleurl/src/gurl.h"
-
-// TestURLFetcher and TestURLFetcherFactory are used for testing consumers of
-// URLFetcher. TestURLFetcherFactory is a URLFetcher::Factory that creates
-// TestURLFetchers. TestURLFetcher::Start is overriden to do nothing. It is
-// expected that you'll grab the delegate from the TestURLFetcher and invoke
-// the callback method when appropriate. In this way it's easy to mock a
-// URLFetcher.
-// Typical usage:
-// // TestURLFetcher requires a MessageLoop:
-// MessageLoopForUI message_loop;
-// // Create and register factory.
-// TestURLFetcherFactory factory;
-// URLFetcher::set_factory(&factory);
-// // Do something that triggers creation of a URLFetcher.
-// TestURLFetcher* fetcher = factory.GetFetcherByID(expected_id);
-// ASSERT(fetcher);
-// // Notify delegate with whatever data you want.
-// fetcher->delegate()->OnURLFetchComplete(...);
-// // Make sure consumer of URLFetcher does the right thing.
-// ...
-// // Reset factory.
-// URLFetcher::set_factory(NULL);
-
-
-class TestURLFetcher : public URLFetcher {
- public:
- TestURLFetcher(const GURL& url, RequestType request_type, Delegate* d);
-
- // Returns the delegate installed on the URLFetcher.
- Delegate* delegate() const { return URLFetcher::delegate(); }
-
- // Overriden to do nothing. It is assumed the caller will notify the delegate.
- virtual void Start() {}
-
- // URL we were created with. Because of how we're using URLFetcher url()
- // always returns an empty URL. Chances are you'll want to use original_url()
- // in your tests.
- const GURL& original_url() const { return original_url_; }
-
- // Returns the data uploaded on this URLFetcher.
- const std::string& upload_data() const { return URLFetcher::upload_data(); }
-
- private:
- const GURL original_url_;
-
- DISALLOW_COPY_AND_ASSIGN(TestURLFetcher);
-};
-
-// Simple URLFetcher::Factory method that creates TestURLFetchers. All fetchers
-// are registered in a map by the id passed to the create method.
-class TestURLFetcherFactory : public URLFetcher::Factory {
- public:
- TestURLFetcherFactory() {}
-
- virtual URLFetcher* CreateURLFetcher(int id,
- const GURL& url,
- URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d);
-
- TestURLFetcher* GetFetcherByID(int id) const;
-
- private:
- // Maps from id passed to create to the returned URLFetcher.
- typedef std::map<int, TestURLFetcher*> Fetchers;
- Fetchers fetchers_;
-
- DISALLOW_COPY_AND_ASSIGN(TestURLFetcherFactory);
-};
-
-#endif // CHROME_BROWSER_NET_TEST_URL_FETCHER_FACTORY_H_
diff --git a/chrome/browser/net/url_fetcher.cc b/chrome/browser/net/url_fetcher.cc
deleted file mode 100644
index 9b4923d..0000000
--- a/chrome/browser/net/url_fetcher.cc
+++ /dev/null
@@ -1,361 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/net/url_fetcher.h"
-
-#include "base/compiler_specific.h"
-#include "base/message_loop_proxy.h"
-#include "base/string_util.h"
-#include "base/thread.h"
-#include "chrome/browser/net/url_fetcher_protect.h"
-#include "chrome/browser/net/url_request_context_getter.h"
-#include "googleurl/src/gurl.h"
-#include "net/base/load_flags.h"
-#include "net/base/io_buffer.h"
-#include "net/http/http_response_headers.h"
-#include "net/url_request/url_request.h"
-#include "net/url_request/url_request_context.h"
-
-static const int kBufferSize = 4096;
-
-bool URLFetcher::g_interception_enabled = false;
-
-class URLFetcher::Core
- : public base::RefCountedThreadSafe<URLFetcher::Core>,
- public URLRequest::Delegate {
- public:
- // For POST requests, set |content_type| to the MIME type of the content
- // and set |content| to the data to upload. |flags| are flags to apply to
- // the load operation--these should be one or more of the LOAD_* flags
- // defined in url_request.h.
- Core(URLFetcher* fetcher,
- const GURL& original_url,
- RequestType request_type,
- URLFetcher::Delegate* d);
-
- // Starts the load. It's important that this not happen in the constructor
- // because it causes the IO thread to begin AddRef()ing and Release()ing
- // us. If our caller hasn't had time to fully construct us and take a
- // reference, the IO thread could interrupt things, run a task, Release()
- // us, and destroy us, leaving the caller with an already-destroyed object
- // when construction finishes.
- void Start();
-
- // Stops any in-progress load and ensures no callback will happen. It is
- // safe to call this multiple times.
- void Stop();
-
- // URLRequest::Delegate implementations
- virtual void OnResponseStarted(URLRequest* request);
- virtual void OnReadCompleted(URLRequest* request, int bytes_read);
-
- URLFetcher::Delegate* delegate() const { return delegate_; }
-
- private:
- friend class base::RefCountedThreadSafe<URLFetcher::Core>;
-
- ~Core() {}
-
- // Wrapper functions that allow us to ensure actions happen on the right
- // thread.
- void StartURLRequest();
- void CancelURLRequest();
- void OnCompletedURLRequest(const URLRequestStatus& status);
-
- URLFetcher* fetcher_; // Corresponding fetcher object
- GURL original_url_; // The URL we were asked to fetch
- GURL url_; // The URL we eventually wound up at
- RequestType request_type_; // What type of request is this?
- URLFetcher::Delegate* delegate_; // Object to notify on completion
- MessageLoop* delegate_loop_; // Message loop of the creating thread
- scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
- // The message loop proxy for the thread
- // on which the request IO happens.
- URLRequest* request_; // The actual request this wraps
- int load_flags_; // Flags for the load operation
- int response_code_; // HTTP status code for the request
- std::string data_; // Results of the request
- scoped_refptr<net::IOBuffer> buffer_;
- // Read buffer
- scoped_refptr<URLRequestContextGetter> request_context_getter_;
- // Cookie/cache info for the request
- ResponseCookies cookies_; // Response cookies
- std::string extra_request_headers_;// Extra headers for the request, if any
- scoped_refptr<net::HttpResponseHeaders> response_headers_;
-
- std::string upload_content_; // HTTP POST payload
- std::string upload_content_type_; // MIME type of POST payload
-
- // The overload protection entry for this URL. This is used to
- // incrementally back off how rapidly we'll send requests to a particular
- // URL, to avoid placing too much demand on the remote resource. We update
- // this with the status of all requests as they return, and in turn use it
- // to determine how long to wait before making another request.
- URLFetcherProtectEntry* protect_entry_;
- // |num_retries_| indicates how many times we've failed to successfully
- // fetch this URL. Once this value exceeds the maximum number of retries
- // specified by the protection manager, we'll give up.
- int num_retries_;
-
- // True if the URLFetcher has been cancelled.
- bool was_cancelled_;
-
- friend class URLFetcher;
- DISALLOW_COPY_AND_ASSIGN(Core);
-};
-
-// static
-URLFetcher::Factory* URLFetcher::factory_ = NULL;
-
-URLFetcher::URLFetcher(const GURL& url,
- RequestType request_type,
- Delegate* d)
- : ALLOW_THIS_IN_INITIALIZER_LIST(
- core_(new Core(this, url, request_type, d))),
- automatically_retry_on_5xx_(true) {
-}
-
-URLFetcher::~URLFetcher() {
- core_->Stop();
-}
-
-// static
-URLFetcher* URLFetcher::Create(int id, const GURL& url,
- RequestType request_type, Delegate* d) {
- return factory_ ? factory_->CreateURLFetcher(id, url, request_type, d) :
- new URLFetcher(url, request_type, d);
-}
-
-URLFetcher::Core::Core(URLFetcher* fetcher,
- const GURL& original_url,
- RequestType request_type,
- URLFetcher::Delegate* d)
- : fetcher_(fetcher),
- original_url_(original_url),
- request_type_(request_type),
- delegate_(d),
- delegate_loop_(MessageLoop::current()),
- request_(NULL),
- load_flags_(net::LOAD_NORMAL),
- response_code_(-1),
- buffer_(new net::IOBuffer(kBufferSize)),
- protect_entry_(URLFetcherProtectManager::GetInstance()->Register(
- original_url_.host())),
- num_retries_(0),
- was_cancelled_(false) {
-}
-
-void URLFetcher::Core::Start() {
- DCHECK(delegate_loop_);
- CHECK(request_context_getter_) << "We need an URLRequestContext!";
- io_message_loop_proxy_ = request_context_getter_->GetIOMessageLoopProxy();
- CHECK(io_message_loop_proxy_.get()) << "We need an IO message loop proxy";
- io_message_loop_proxy_->PostDelayedTask(
- FROM_HERE,
- NewRunnableMethod(this, &Core::StartURLRequest),
- protect_entry_->UpdateBackoff(URLFetcherProtectEntry::SEND));
-}
-
-void URLFetcher::Core::Stop() {
- DCHECK_EQ(MessageLoop::current(), delegate_loop_);
- delegate_ = NULL;
- fetcher_ = NULL;
- if (io_message_loop_proxy_.get()) {
- io_message_loop_proxy_->PostTask(
- FROM_HERE, NewRunnableMethod(this, &Core::CancelURLRequest));
- }
-}
-
-void URLFetcher::Core::OnResponseStarted(URLRequest* request) {
- DCHECK(request == request_);
- DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
- if (request_->status().is_success()) {
- response_code_ = request_->GetResponseCode();
- response_headers_ = request_->response_headers();
- }
-
- int bytes_read = 0;
- // Some servers may treat HEAD requests as GET requests. To free up the
- // network connection as soon as possible, signal that the request has
- // completed immediately, without trying to read any data back (all we care
- // about is the response code and headers, which we already have).
- if (request_->status().is_success() && (request_type_ != HEAD))
- request_->Read(buffer_, kBufferSize, &bytes_read);
- OnReadCompleted(request_, bytes_read);
-}
-
-void URLFetcher::Core::OnReadCompleted(URLRequest* request, int bytes_read) {
- DCHECK(request == request_);
- DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
-
- url_ = request->url();
-
- do {
- if (!request_->status().is_success() || bytes_read <= 0)
- break;
- data_.append(buffer_->data(), bytes_read);
- } while (request_->Read(buffer_, kBufferSize, &bytes_read));
-
- if (request_->status().is_success())
- request_->GetResponseCookies(&cookies_);
-
- // See comments re: HEAD requests in OnResponseStarted().
- if (!request_->status().is_io_pending() || (request_type_ == HEAD)) {
- delegate_loop_->PostTask(FROM_HERE, NewRunnableMethod(
- this, &Core::OnCompletedURLRequest, request_->status()));
- delete request_;
- request_ = NULL;
- }
-}
-
-void URLFetcher::Core::StartURLRequest() {
- DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
-
- if (was_cancelled_) {
- // Since StartURLRequest() is posted as a *delayed* task, it may
- // run after the URLFetcher was already stopped.
- return;
- }
-
- CHECK(request_context_getter_);
- DCHECK(!request_);
-
- request_ = new URLRequest(original_url_, this);
- int flags = request_->load_flags() | load_flags_;
- if (!g_interception_enabled) {
- flags = flags | net::LOAD_DISABLE_INTERCEPT;
- }
- request_->set_load_flags(flags);
- request_->set_context(request_context_getter_->GetURLRequestContext());
-
- switch (request_type_) {
- case GET:
- break;
-
- case POST:
- DCHECK(!upload_content_.empty());
- DCHECK(!upload_content_type_.empty());
-
- request_->set_method("POST");
- if (!extra_request_headers_.empty())
- extra_request_headers_ += "\r\n";
- StringAppendF(&extra_request_headers_,
- "Content-Type: %s", upload_content_type_.c_str());
- request_->AppendBytesToUpload(upload_content_.data(),
- static_cast<int>(upload_content_.size()));
- break;
-
- case HEAD:
- request_->set_method("HEAD");
- break;
-
- default:
- NOTREACHED();
- }
-
- if (!extra_request_headers_.empty())
- request_->SetExtraRequestHeaders(extra_request_headers_);
-
- request_->Start();
-}
-
-void URLFetcher::Core::CancelURLRequest() {
- DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
-
- if (request_) {
- request_->Cancel();
- delete request_;
- request_ = NULL;
- }
- // Release the reference to the request context. There could be multiple
- // references to URLFetcher::Core at this point so it may take a while to
- // delete the object, but we cannot delay the destruction of the request
- // context.
- request_context_getter_ = NULL;
- was_cancelled_ = true;
-}
-
-void URLFetcher::Core::OnCompletedURLRequest(const URLRequestStatus& status) {
- DCHECK(MessageLoop::current() == delegate_loop_);
-
- // Checks the response from server.
- if (response_code_ >= 500) {
- // When encountering a server error, we will send the request again
- // after backoff time.
- int64 back_off_time =
- protect_entry_->UpdateBackoff(URLFetcherProtectEntry::FAILURE);
- if (delegate_) {
- fetcher_->backoff_delay_ =
- base::TimeDelta::FromMilliseconds(back_off_time);
- }
- ++num_retries_;
- // Restarts the request if we still need to notify the delegate.
- if (delegate_) {
- if (fetcher_->automatically_retry_on_5xx_ &&
- num_retries_ <= protect_entry_->max_retries()) {
- io_message_loop_proxy_->PostDelayedTask(
- FROM_HERE,
- NewRunnableMethod(this, &Core::StartURLRequest), back_off_time);
- } else {
- delegate_->OnURLFetchComplete(fetcher_, url_, status, response_code_,
- cookies_, data_);
- }
- }
- } else {
- protect_entry_->UpdateBackoff(URLFetcherProtectEntry::SUCCESS);
- if (delegate_) {
- fetcher_->backoff_delay_ = base::TimeDelta();
- delegate_->OnURLFetchComplete(fetcher_, url_, status, response_code_,
- cookies_, data_);
- }
- }
-}
-
-void URLFetcher::set_upload_data(const std::string& upload_content_type,
- const std::string& upload_content) {
- core_->upload_content_type_ = upload_content_type;
- core_->upload_content_ = upload_content;
-}
-
-const std::string& URLFetcher::upload_data() const {
- return core_->upload_content_;
-}
-
-void URLFetcher::set_load_flags(int load_flags) {
- core_->load_flags_ = load_flags;
-}
-
-int URLFetcher::load_flags() const {
- return core_->load_flags_;
-}
-
-void URLFetcher::set_extra_request_headers(
- const std::string& extra_request_headers) {
- core_->extra_request_headers_ = extra_request_headers;
-}
-
-void URLFetcher::set_request_context(
- URLRequestContextGetter* request_context_getter) {
- core_->request_context_getter_ = request_context_getter;
-}
-
-void URLFetcher::set_automatcally_retry_on_5xx(bool retry) {
- automatically_retry_on_5xx_ = retry;
-}
-
-net::HttpResponseHeaders* URLFetcher::response_headers() const {
- return core_->response_headers_;
-}
-
-void URLFetcher::Start() {
- core_->Start();
-}
-
-const GURL& URLFetcher::url() const {
- return core_->url_;
-}
-
-URLFetcher::Delegate* URLFetcher::delegate() const {
- return core_->delegate();
-}
diff --git a/chrome/browser/net/url_fetcher.h b/chrome/browser/net/url_fetcher.h
deleted file mode 100644
index b585124..0000000
--- a/chrome/browser/net/url_fetcher.h
+++ /dev/null
@@ -1,195 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// This file contains URLFetcher, a wrapper around URLRequest that handles
-// low-level details like thread safety, ref counting, and incremental buffer
-// reading. This is useful for callers who simply want to get the data from a
-// URL and don't care about all the nitty-gritty details.
-
-#ifndef CHROME_BROWSER_NET_URL_FETCHER_H_
-#define CHROME_BROWSER_NET_URL_FETCHER_H_
-
-#include <string>
-
-#include "base/leak_tracker.h"
-#include "base/message_loop.h"
-#include "base/ref_counted.h"
-#include "base/time.h"
-
-class GURL;
-typedef std::vector<std::string> ResponseCookies;
-class URLFetcher;
-class URLRequestContextGetter;
-class URLRequestStatus;
-
-namespace net {
-class HttpResponseHeaders;
-}
-
-// To use this class, create an instance with the desired URL and a pointer to
-// the object to be notified when the URL has been loaded:
-// URLFetcher* fetcher = new URLFetcher("http://www.google.com", this);
-//
-// Then, optionally set properties on this object, like the request context or
-// extra headers:
-// fetcher->SetExtraRequestHeaders("X-Foo: bar");
-//
-// Finally, start the request:
-// fetcher->Start();
-//
-// The object you supply as a delegate must inherit from URLFetcher::Delegate;
-// when the fetch is completed, OnURLFetchComplete() will be called with the
-// resulting status and (if applicable) HTTP response code. From that point
-// until the original URLFetcher instance is destroyed, you may examine the
-// provided status and data for the URL. (You should copy these objects if you
-// need them to live longer than the URLFetcher instance.) If the URLFetcher
-// instance is destroyed before the callback happens, the fetch will be
-// canceled and no callback will occur.
-//
-// You may create the URLFetcher instance on any thread; OnURLFetchComplete()
-// will be called back on the same thread you use to create the instance.
-//
-//
-// NOTE: By default URLFetcher requests are NOT intercepted, except when
-// interception is explicitly enabled in tests.
-
-class URLFetcher {
- public:
- enum RequestType {
- GET,
- POST,
- HEAD,
- };
-
- class Delegate {
- public:
- // This will be called when the URL has been fetched, successfully or not.
- // |response_code| is the HTTP response code (200, 404, etc.) if
- // applicable. |url|, |status| and |data| are all valid until the
- // URLFetcher instance is destroyed.
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data) = 0;
- };
-
- // URLFetcher::Create uses the currently registered Factory to create the
- // URLFetcher. Factory is intended for testing.
- class Factory {
- public:
- virtual URLFetcher* CreateURLFetcher(int id,
- const GURL& url,
- RequestType request_type,
- Delegate* d) = 0;
- };
-
- // |url| is the URL to send the request to.
- // |request_type| is the type of request to make.
- // |d| the object that will receive the callback on fetch completion.
- URLFetcher(const GURL& url, RequestType request_type, Delegate* d);
-
- virtual ~URLFetcher();
-
- // Sets the factory used by the static method Create to create a URLFetcher.
- // URLFetcher does not take ownership of |factory|. A value of NULL results
- // in a URLFetcher being created directly.
-#if defined(UNIT_TEST)
- static void set_factory(Factory* factory) { factory_ = factory; }
-#endif
-
- // Normally interception is disabled for URLFetcher, but you can use this
- // to enable it for tests. Also see the set_factory method for another way
- // of testing code that uses an URLFetcher.
- static void enable_interception_for_tests(bool enabled) {
- g_interception_enabled = enabled;
- }
-
- // Creates a URLFetcher, ownership returns to the caller. If there is no
- // Factory (the default) this creates and returns a new URLFetcher. See the
- // constructor for a description of the args. |id| may be used during testing
- // to identify who is creating the URLFetcher.
- static URLFetcher* Create(int id, const GURL& url, RequestType request_type,
- Delegate* d);
-
- // Sets data only needed by POSTs. All callers making POST requests should
- // call this before the request is started. |upload_content_type| is the MIME
- // type of the content, while |upload_content| is the data to be sent (the
- // Content-Length header value will be set to the length of this data).
- void set_upload_data(const std::string& upload_content_type,
- const std::string& upload_content);
-
- // Set one or more load flags as defined in net/base/load_flags.h. Must be
- // called before the request is started.
- void set_load_flags(int load_flags);
-
- // Returns the current load flags.
- int load_flags() const;
-
- // Set extra headers on the request. Must be called before the request
- // is started.
- void set_extra_request_headers(const std::string& extra_request_headers);
-
- // Set the URLRequestContext on the request. Must be called before the
- // request is started.
- void set_request_context(URLRequestContextGetter* request_context_getter);
-
- // If |retry| is false, 5xx responses will be propagated to the observer,
- // if it is true URLFetcher will automatically re-execute the request,
- // after backoff_delay() elapses. URLFetcher has it set to true by default.
- void set_automatcally_retry_on_5xx(bool retry);
-
- // Returns the back-off delay before the request will be retried,
- // when a 5xx response was received.
- base::TimeDelta backoff_delay() const { return backoff_delay_; }
-
- // Sets the back-off delay, allowing to mock 5xx requests in unit-tests.
-#if defined(UNIT_TEST)
- void set_backoff_delay(base::TimeDelta backoff_delay) {
- backoff_delay_ = backoff_delay;
- }
-#endif // defined(UNIT_TEST)
-
- // Retrieve the response headers from the request. Must only be called after
- // the OnURLFetchComplete callback has run.
- virtual net::HttpResponseHeaders* response_headers() const;
-
- // Start the request. After this is called, you may not change any other
- // settings.
- virtual void Start();
-
- // Return the URL that this fetcher is processing.
- const GURL& url() const;
-
- protected:
- // Returns the delegate.
- Delegate* delegate() const;
-
- // Used by tests.
- const std::string& upload_data() const;
-
- private:
- class Core;
-
- scoped_refptr<Core> core_;
-
- static Factory* factory_;
-
- base::LeakTracker<URLFetcher> leak_tracker_;
-
- // If |automatically_retry_on_5xx_| is false, 5xx responses will be
- // propagated to the observer, if it is true URLFetcher will automatically
- // re-execute the request, after the back-off delay has expired.
- // true by default.
- bool automatically_retry_on_5xx_;
- // Back-off time delay. 0 by default.
- base::TimeDelta backoff_delay_;
-
- static bool g_interception_enabled;
-
- DISALLOW_EVIL_CONSTRUCTORS(URLFetcher);
-};
-
-#endif // CHROME_BROWSER_NET_URL_FETCHER_H_
diff --git a/chrome/browser/net/url_fetcher_protect.cc b/chrome/browser/net/url_fetcher_protect.cc
deleted file mode 100644
index 748a675..0000000
--- a/chrome/browser/net/url_fetcher_protect.cc
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/net/url_fetcher_protect.h"
-
-#include "base/logging.h"
-
-// URLFetcherProtectEntry ----------------------------------------------------
-
-using base::TimeDelta;
-using base::TimeTicks;
-
-// Default parameters. Time is in milliseconds.
-// static
-const int URLFetcherProtectEntry::kDefaultSlidingWindowPeriod = 2000;
-
-const int URLFetcherProtectEntry::kDefaultMaxSendThreshold = 20;
-const int URLFetcherProtectEntry::kDefaultMaxRetries = 0;
-
-const int URLFetcherProtectEntry::kDefaultInitialTimeout = 100;
-const double URLFetcherProtectEntry::kDefaultMultiplier = 2.0;
-const int URLFetcherProtectEntry::kDefaultConstantFactor = 100;
-const int URLFetcherProtectEntry::kDefaultMaximumTimeout = 60000;
-
-
-URLFetcherProtectEntry::URLFetcherProtectEntry()
- : sliding_window_period_(kDefaultSlidingWindowPeriod),
- max_send_threshold_(kDefaultMaxSendThreshold),
- max_retries_(kDefaultMaxRetries),
- initial_timeout_(kDefaultInitialTimeout),
- multiplier_(kDefaultMultiplier),
- constant_factor_(kDefaultConstantFactor),
- maximum_timeout_(kDefaultMaximumTimeout) {
- ResetBackoff();
-}
-
-URLFetcherProtectEntry::URLFetcherProtectEntry(int sliding_window_period,
- int max_send_threshold,
- int max_retries,
- int initial_timeout,
- double multiplier,
- int constant_factor,
- int maximum_timeout)
- : sliding_window_period_(sliding_window_period),
- max_send_threshold_(max_send_threshold),
- max_retries_(max_retries),
- initial_timeout_(initial_timeout),
- multiplier_(multiplier),
- constant_factor_(constant_factor),
- maximum_timeout_(maximum_timeout) {
- ResetBackoff();
-}
-
-int64 URLFetcherProtectEntry::UpdateBackoff(EventType event_type) {
- // request may be sent in different threads
- AutoLock lock(lock_);
-
- TimeDelta t;
- switch (event_type) {
- case SEND:
- t = AntiOverload();
- break;
- case SUCCESS:
- t = ResetBackoff();
- break;
- case FAILURE:
- t = IncreaseBackoff();
- break;
- default:
- NOTREACHED();
- }
-
- int64 wait = t.InMilliseconds();
- DCHECK(wait >= 0);
- return wait;
-}
-
-TimeDelta URLFetcherProtectEntry::AntiOverload() {
- TimeDelta sw = TimeDelta::FromMilliseconds(sliding_window_period_);
- TimeTicks now = TimeTicks::Now();
- // Estimate when the next request will be sent.
- release_time_ = now;
- if (send_log_.size() > 0) {
- release_time_ = std::max(release_time_, send_log_.back());
- }
- // Checks if there are too many send events in recent time.
- if (send_log_.size() >= static_cast<unsigned>(max_send_threshold_)) {
- release_time_ = std::max(release_time_, send_log_.front() + sw);
- }
- // Logs the new send event.
- send_log_.push(release_time_);
- // Drops the out-of-date events in the event list.
- while (!send_log_.empty() &&
- (send_log_.front() + sw <= send_log_.back())) {
- send_log_.pop();
- }
- return release_time_ - now;
-}
-
-TimeDelta URLFetcherProtectEntry::ResetBackoff() {
- timeout_period_ = initial_timeout_;
- release_time_ = TimeTicks::Now();
- return TimeDelta::FromMilliseconds(0);
-}
-
-TimeDelta URLFetcherProtectEntry::IncreaseBackoff() {
- TimeTicks now = TimeTicks::Now();
-
- release_time_ = std::max(release_time_, now) +
- TimeDelta::FromMilliseconds(timeout_period_);
-
- // Calculates the new backoff time.
- timeout_period_ = static_cast<int>
- (multiplier_ * timeout_period_ + constant_factor_);
- if (maximum_timeout_ && timeout_period_ > maximum_timeout_)
- timeout_period_ = maximum_timeout_;
-
- return release_time_ - now;
-}
-
-// URLFetcherProtectManager --------------------------------------------------
-
-// static
-scoped_ptr<URLFetcherProtectManager> URLFetcherProtectManager::protect_manager_;
-Lock URLFetcherProtectManager::lock_;
-
-URLFetcherProtectManager::~URLFetcherProtectManager() {
- // Deletes all entries
- ProtectService::iterator i;
- for (i = services_.begin(); i != services_.end(); ++i) {
- if (i->second)
- delete i->second;
- }
-}
-
-// static
-URLFetcherProtectManager* URLFetcherProtectManager::GetInstance() {
- AutoLock lock(lock_);
-
- if (protect_manager_.get() == NULL) {
- protect_manager_.reset(new URLFetcherProtectManager());
- }
- return protect_manager_.get();
-}
-
-URLFetcherProtectEntry* URLFetcherProtectManager::Register(
- const std::string& id) {
- AutoLock lock(lock_);
-
- ProtectService::iterator i = services_.find(id);
-
- if (i != services_.end()) {
- // The entry exists.
- return i->second;
- }
-
- // Creates a new entry.
- URLFetcherProtectEntry* entry = new URLFetcherProtectEntry();
- services_[id] = entry;
- return entry;
-}
-
-URLFetcherProtectEntry* URLFetcherProtectManager::Register(
- const std::string& id, URLFetcherProtectEntry* entry) {
- AutoLock lock(lock_);
-
- ProtectService::iterator i = services_.find(id);
- if (i != services_.end()) {
- // The entry exists.
- delete i->second;
- }
-
- services_[id] = entry;
- return entry;
-}
diff --git a/chrome/browser/net/url_fetcher_protect.h b/chrome/browser/net/url_fetcher_protect.h
deleted file mode 100644
index f47e0d6..0000000
--- a/chrome/browser/net/url_fetcher_protect.h
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// This file implements backoff in the suggest system so that we don't
-// DOS the Suggest servers when using URLFetcher.
-
-#ifndef CHROME_BROWSER_NET_URL_FETCHER_PROTECT_H_
-#define CHROME_BROWSER_NET_URL_FETCHER_PROTECT_H_
-
-#include <map>
-#include <queue>
-#include <string>
-
-#include "base/lock.h"
-#include "base/scoped_ptr.h"
-#include "base/time.h"
-
-
-// This class is used to manage one service's rate protection. It maintains
-// a queue of connection successes and failures and analyzes the requests
-// over some period of time, in order to deduce the backoff time of every
-// request.
-// The backoff algorithm consists of two parts. Firstly, avoid too many
-// send events in a sliding window. That will prevent traffic overload.
-// Secondly, exponential backoff is used when receiving an error message
-// from server. Exponential backoff period is calculated using the following
-// formula:
-//
-// initial backoff time (the first time to receive error)
-// backoff = k * current_backoff + c (the second, third, ... error)
-// maximum backoff time (when backoff > maximum backoff time)
-//
-// where |k| is the multiplier, and |c| is the constant factor.
-class URLFetcherProtectEntry {
- public:
- enum EventType {
- SEND, // request will be sent out
- SUCCESS, // successful response
- FAILURE // no response or error
- };
-
- URLFetcherProtectEntry();
- URLFetcherProtectEntry(int sliding_window_period, int max_send_threshold,
- int max_retries, int initial_timeout,
- double multiplier, int constant_factor,
- int maximum_timeout);
-
-
- virtual ~URLFetcherProtectEntry() { }
-
- // When a connection event happens, log it to the queue, and recalculate
- // the timeout period. It returns the backoff time, in milliseconds, that
- // indicates to the sender how long should it wait before sending the request.
- // If the request is allowed to be sent immediately, the backoff time is 0.
- int64 UpdateBackoff(EventType event_type);
-
- // Returns the max retries allowed.
- int max_retries() const {
- return max_retries_;
- }
-
- private:
- // When a request comes, calculate the release time for it.
- // Returns the backoff time before sending.
- base::TimeDelta AntiOverload();
- // Resets backoff when service is ok.
- // Returns the backoff time before sending.
- base::TimeDelta ResetBackoff();
- // Calculates new backoff when encountering a failure.
- // Returns the backoff time before sending.
- base::TimeDelta IncreaseBackoff();
-
- // Default parameters. Time is in milliseconds.
- static const int kDefaultSlidingWindowPeriod;
- static const int kDefaultMaxSendThreshold;
- static const int kDefaultMaxRetries;
- static const int kDefaultInitialTimeout;
- static const double kDefaultMultiplier;
- static const int kDefaultConstantFactor;
- static const int kDefaultMaximumTimeout;
-
- // time to consider events when checking backoff
- int sliding_window_period_;
-
- // maximum number of requests allowed in sliding window period
- int max_send_threshold_;
- // maximum retris allowed
- int max_retries_;
-
- // initial timeout on first failure
- int initial_timeout_;
- // factor by which to multiply on exponential backoff (e.g., 2.0)
- double multiplier_;
- // constant time term to add to each attempt
- int constant_factor_;
- // maximum amount of time between requests
- int maximum_timeout_;
-
- // current exponential backoff period
- int timeout_period_;
- // time that protection is scheduled to end
- base::TimeTicks release_time_;
-
- // Sets up a lock to ensure thread safe.
- Lock lock_;
-
- // A list of the recent send events. We ues them to decide whether
- // there are too many requests sent in sliding window.
- std::queue<base::TimeTicks> send_log_;
-
- DISALLOW_COPY_AND_ASSIGN(URLFetcherProtectEntry);
-};
-
-
-// This singleton class is used to manage all protect entries.
-// Now we use the host name as service id.
-class URLFetcherProtectManager {
- public:
- ~URLFetcherProtectManager();
-
- // Returns the global instance of this class.
- static URLFetcherProtectManager* GetInstance();
-
- // Registers a new entry in this service. If the entry already exists,
- // just returns it. Ownership of the return object remains with the manager.
- URLFetcherProtectEntry* Register(const std::string& id);
- // Always registers the entry even when it exists; any existing entry for this
- // id will be deleted and existing references to it will become invalid.
- // Ownership of the return object remains with the manager.
- URLFetcherProtectEntry* Register(const std::string& id,
- URLFetcherProtectEntry* entry);
-
- private:
- URLFetcherProtectManager() { }
-
- typedef std::map<const std::string, URLFetcherProtectEntry*> ProtectService;
-
- static Lock lock_;
- static scoped_ptr<URLFetcherProtectManager> protect_manager_;
- ProtectService services_;
-
- DISALLOW_COPY_AND_ASSIGN(URLFetcherProtectManager);
-};
-
-#endif // CHROME_BROWSER_NET_URL_FETCHER_PROTECT_H_
diff --git a/chrome/browser/net/url_fetcher_unittest.cc b/chrome/browser/net/url_fetcher_unittest.cc
deleted file mode 100644
index 2a35b04..0000000
--- a/chrome/browser/net/url_fetcher_unittest.cc
+++ /dev/null
@@ -1,613 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/message_loop_proxy.h"
-#include "base/thread.h"
-#include "base/waitable_event.h"
-#include "chrome/browser/net/url_fetcher.h"
-#include "chrome/browser/net/url_fetcher_protect.h"
-#include "chrome/browser/net/url_request_context_getter.h"
-#include "chrome/common/chrome_plugin_lib.h"
-#include "net/http/http_response_headers.h"
-#include "net/socket/ssl_test_util.h"
-#include "net/url_request/url_request_unittest.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using base::Time;
-using base::TimeDelta;
-
-// TODO(eroman): Add a regression test for http://crbug.com/40505.
-
-namespace {
-
-const wchar_t kDocRoot[] = L"chrome/test/data";
-
-class TestURLRequestContextGetter : public URLRequestContextGetter {
- public:
- explicit TestURLRequestContextGetter(
- base::MessageLoopProxy* io_message_loop_proxy)
- : io_message_loop_proxy_(io_message_loop_proxy) {
- }
- virtual URLRequestContext* GetURLRequestContext() {
- if (!context_)
- context_ = new TestURLRequestContext();
- return context_;
- }
- virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() {
- return io_message_loop_proxy_;
- }
-
- protected:
- scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
-
- private:
- ~TestURLRequestContextGetter() {}
-
- scoped_refptr<URLRequestContext> context_;
-};
-
-class URLFetcherTest : public testing::Test, public URLFetcher::Delegate {
- public:
- URLFetcherTest() : fetcher_(NULL) { }
-
- // Creates a URLFetcher, using the program's main thread to do IO.
- virtual void CreateFetcher(const GURL& url);
-
- // URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data);
-
- scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy() {
- return io_message_loop_proxy_;
- }
-
- protected:
- virtual void SetUp() {
- testing::Test::SetUp();
-
- io_message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread();
-
- // Ensure that any plugin operations done by other tests are cleaned up.
- ChromePluginLib::UnloadAllPlugins();
- }
-
- // URLFetcher is designed to run on the main UI thread, but in our tests
- // we assume that the current thread is the IO thread where the URLFetcher
- // dispatches its requests to. When we wish to simulate being used from
- // a UI thread, we dispatch a worker thread to do so.
- MessageLoopForIO io_loop_;
- scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
-
- URLFetcher* fetcher_;
-};
-
-// Version of URLFetcherTest that does a POST instead
-class URLFetcherPostTest : public URLFetcherTest {
- public:
- virtual void CreateFetcher(const GURL& url);
-
- // URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data);
-};
-
-// Version of URLFetcherTest that tests headers.
-class URLFetcherHeadersTest : public URLFetcherTest {
- public:
- // URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data);
-};
-
-// Version of URLFetcherTest that tests overload protection.
-class URLFetcherProtectTest : public URLFetcherTest {
- public:
- virtual void CreateFetcher(const GURL& url);
- // URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data);
- private:
- Time start_time_;
-};
-
-// Version of URLFetcherTest that tests overload protection, when responses
-// passed through.
-class URLFetcherProtectTestPassedThrough : public URLFetcherTest {
- public:
- virtual void CreateFetcher(const GURL& url);
- // URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data);
- private:
- Time start_time_;
-};
-
-// Version of URLFetcherTest that tests bad HTTPS requests.
-class URLFetcherBadHTTPSTest : public URLFetcherTest {
- public:
- URLFetcherBadHTTPSTest();
-
- // URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data);
-
- private:
- FilePath cert_dir_;
-};
-
-// Version of URLFetcherTest that tests request cancellation on shutdown.
-class URLFetcherCancelTest : public URLFetcherTest {
- public:
- virtual void CreateFetcher(const GURL& url);
- // URLFetcher::Delegate
- virtual void OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data);
-
- void CancelRequest();
-};
-
-// Version of TestURLRequestContext that posts a Quit task to the IO
-// thread once it is deleted.
-class CancelTestURLRequestContext : public TestURLRequestContext {
- virtual ~CancelTestURLRequestContext() {
- // The d'tor should execute in the IO thread. Post the quit task to the
- // current thread.
- MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
- }
-};
-
-class CancelTestURLRequestContextGetter : public URLRequestContextGetter {
- public:
- explicit CancelTestURLRequestContextGetter(
- base::MessageLoopProxy* io_message_loop_proxy)
- : io_message_loop_proxy_(io_message_loop_proxy),
- context_created_(false, false) {
- }
- virtual URLRequestContext* GetURLRequestContext() {
- if (!context_) {
- context_ = new CancelTestURLRequestContext();
- context_created_.Signal();
- }
- return context_;
- }
- virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() {
- return io_message_loop_proxy_;
- }
- void WaitForContextCreation() {
- context_created_.Wait();
- }
-
- private:
- ~CancelTestURLRequestContextGetter() {}
-
- scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
- base::WaitableEvent context_created_;
- scoped_refptr<URLRequestContext> context_;
-};
-
-// Wrapper that lets us call CreateFetcher() on a thread of our choice. We
-// could make URLFetcherTest refcounted and use PostTask(FROM_HERE.. ) to call
-// CreateFetcher() directly, but the ownership of the URLFetcherTest is a bit
-// confusing in that case because GTest doesn't know about the refcounting.
-// It's less confusing to just do it this way.
-class FetcherWrapperTask : public Task {
- public:
- FetcherWrapperTask(URLFetcherTest* test, const GURL& url)
- : test_(test), url_(url) { }
- virtual void Run() {
- test_->CreateFetcher(url_);
- }
-
- private:
- URLFetcherTest* test_;
- GURL url_;
-};
-
-void URLFetcherTest::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcher(url, URLFetcher::GET, this);
- fetcher_->set_request_context(new TestURLRequestContextGetter(
- io_message_loop_proxy()));
- fetcher_->Start();
-}
-
-void URLFetcherTest::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data) {
- EXPECT_TRUE(status.is_success());
- EXPECT_EQ(200, response_code); // HTTP OK
- EXPECT_FALSE(data.empty());
-
- delete fetcher_; // Have to delete this here and not in the destructor,
- // because the destructor won't necessarily run on the
- // same thread that CreateFetcher() did.
-
- io_message_loop_proxy()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
- // If the current message loop is not the IO loop, it will be shut down when
- // the main loop returns and this thread subsequently goes out of scope.
-}
-
-void URLFetcherPostTest::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcher(url, URLFetcher::POST, this);
- fetcher_->set_request_context(new TestURLRequestContextGetter(
- io_message_loop_proxy()));
- fetcher_->set_upload_data("application/x-www-form-urlencoded",
- "bobsyeruncle");
- fetcher_->Start();
-}
-
-void URLFetcherPostTest::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data) {
- EXPECT_EQ(std::string("bobsyeruncle"), data);
- URLFetcherTest::OnURLFetchComplete(source, url, status, response_code,
- cookies, data);
-}
-
-void URLFetcherHeadersTest::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data) {
- std::string header;
- EXPECT_TRUE(source->response_headers()->GetNormalizedHeader("cache-control",
- &header));
- EXPECT_EQ("private", header);
- URLFetcherTest::OnURLFetchComplete(source, url, status, response_code,
- cookies, data);
-}
-
-void URLFetcherProtectTest::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcher(url, URLFetcher::GET, this);
- fetcher_->set_request_context(new TestURLRequestContextGetter(
- io_message_loop_proxy()));
- start_time_ = Time::Now();
- fetcher_->Start();
-}
-
-void URLFetcherProtectTest::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data) {
- const TimeDelta one_second = TimeDelta::FromMilliseconds(1000);
- if (response_code >= 500) {
- // Now running ServerUnavailable test.
- // It takes more than 1 second to finish all 11 requests.
- EXPECT_TRUE(Time::Now() - start_time_ >= one_second);
- EXPECT_TRUE(status.is_success());
- EXPECT_FALSE(data.empty());
- delete fetcher_;
- io_message_loop_proxy()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
- } else {
- // Now running Overload test.
- static int count = 0;
- count++;
- if (count < 20) {
- fetcher_->Start();
- } else {
- // We have already sent 20 requests continuously. And we expect that
- // it takes more than 1 second due to the overload pretection settings.
- EXPECT_TRUE(Time::Now() - start_time_ >= one_second);
- URLFetcherTest::OnURLFetchComplete(source, url, status, response_code,
- cookies, data);
- }
- }
-}
-
-void URLFetcherProtectTestPassedThrough::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcher(url, URLFetcher::GET, this);
- fetcher_->set_request_context(new TestURLRequestContextGetter(
- io_message_loop_proxy()));
- fetcher_->set_automatcally_retry_on_5xx(false);
- start_time_ = Time::Now();
- fetcher_->Start();
-}
-
-void URLFetcherProtectTestPassedThrough::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data) {
- const TimeDelta one_minute = TimeDelta::FromMilliseconds(60000);
- if (response_code >= 500) {
- // Now running ServerUnavailable test.
- // It should get here on the first attempt, so almost immediately and
- // *not* to attempt to execute all 11 requests (2.5 minutes).
- EXPECT_TRUE(Time::Now() - start_time_ < one_minute);
- EXPECT_TRUE(status.is_success());
- // Check that suggested back off time is bigger than 0.
- EXPECT_GT(fetcher_->backoff_delay().InMicroseconds(), 0);
- EXPECT_FALSE(data.empty());
- delete fetcher_;
- io_message_loop_proxy()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
- } else {
- // We should not get here!
- FAIL();
- }
-}
-
-
-URLFetcherBadHTTPSTest::URLFetcherBadHTTPSTest() {
- PathService::Get(base::DIR_SOURCE_ROOT, &cert_dir_);
- cert_dir_ = cert_dir_.AppendASCII("chrome");
- cert_dir_ = cert_dir_.AppendASCII("test");
- cert_dir_ = cert_dir_.AppendASCII("data");
- cert_dir_ = cert_dir_.AppendASCII("ssl");
- cert_dir_ = cert_dir_.AppendASCII("certificates");
-}
-
-// The "server certificate expired" error should result in automatic
-// cancellation of the request by
-// URLRequest::Delegate::OnSSLCertificateError.
-void URLFetcherBadHTTPSTest::OnURLFetchComplete(
- const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data) {
- // This part is different from URLFetcherTest::OnURLFetchComplete
- // because this test expects the request to be cancelled.
- EXPECT_EQ(URLRequestStatus::CANCELED, status.status());
- EXPECT_EQ(net::ERR_ABORTED, status.os_error());
- EXPECT_EQ(-1, response_code);
- EXPECT_TRUE(cookies.empty());
- EXPECT_TRUE(data.empty());
-
- // The rest is the same as URLFetcherTest::OnURLFetchComplete.
- delete fetcher_;
- io_message_loop_proxy()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
-}
-
-void URLFetcherCancelTest::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcher(url, URLFetcher::GET, this);
- CancelTestURLRequestContextGetter* context_getter =
- new CancelTestURLRequestContextGetter(io_message_loop_proxy());
- fetcher_->set_request_context(context_getter);
- fetcher_->Start();
- // We need to wait for the creation of the URLRequestContext, since we
- // rely on it being destroyed as a signal to end the test.
- context_getter->WaitForContextCreation();
- CancelRequest();
-}
-
-void URLFetcherCancelTest::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data) {
- // We should have cancelled the request before completion.
- ADD_FAILURE();
- delete fetcher_;
- io_message_loop_proxy()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
-}
-
-void URLFetcherCancelTest::CancelRequest() {
- delete fetcher_;
- // The URLFetcher's test context will post a Quit task once it is
- // deleted. So if this test simply hangs, it means cancellation
- // did not work.
-}
-
-TEST_F(URLFetcherTest, SameThreadsTest) {
- // Create the fetcher on the main thread. Since IO will happen on the main
- // thread, this will test URLFetcher's ability to do everything on one
- // thread.
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(kDocRoot, NULL);
- ASSERT_TRUE(NULL != server.get());
-
- CreateFetcher(GURL(server->TestServerPage("defaultresponse")));
-
- MessageLoop::current()->Run();
-}
-
-TEST_F(URLFetcherTest, DifferentThreadsTest) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(kDocRoot, NULL);
- ASSERT_TRUE(NULL != server.get());
- // Create a separate thread that will create the URLFetcher. The current
- // (main) thread will do the IO, and when the fetch is complete it will
- // terminate the main thread's message loop; then the other thread's
- // message loop will be shut down automatically as the thread goes out of
- // scope.
- base::Thread t("URLFetcher test thread");
- ASSERT_TRUE(t.Start());
- t.message_loop()->PostTask(FROM_HERE, new FetcherWrapperTask(this,
- GURL(server->TestServerPage("defaultresponse"))));
-
- MessageLoop::current()->Run();
-}
-
-TEST_F(URLFetcherPostTest, Basic) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(kDocRoot, NULL);
- ASSERT_TRUE(NULL != server.get());
- CreateFetcher(GURL(server->TestServerPage("echo")));
- MessageLoop::current()->Run();
-}
-
-TEST_F(URLFetcherHeadersTest, DISABLED_Headers) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(L"net/data/url_request_unittest", NULL);
- ASSERT_TRUE(NULL != server.get());
- CreateFetcher(GURL(server->TestServerPage("files/with-headers.html")));
- MessageLoop::current()->Run();
- // The actual tests are in the URLFetcherHeadersTest fixture.
-}
-
-TEST_F(URLFetcherProtectTest, Overload) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(kDocRoot, NULL);
- ASSERT_TRUE(NULL != server.get());
- GURL url = GURL(server->TestServerPage("defaultresponse"));
-
- // Registers an entry for test url. It only allows 3 requests to be sent
- // in 200 milliseconds.
- URLFetcherProtectManager* manager = URLFetcherProtectManager::GetInstance();
- URLFetcherProtectEntry* entry =
- new URLFetcherProtectEntry(200, 3, 11, 1, 2.0, 0, 256);
- manager->Register(url.host(), entry);
-
- CreateFetcher(url);
-
- MessageLoop::current()->Run();
-}
-
-TEST_F(URLFetcherProtectTest, ServerUnavailable) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(L"chrome/test/data", NULL);
- ASSERT_TRUE(NULL != server.get());
- GURL url = GURL(server->TestServerPage("files/server-unavailable.html"));
-
- // Registers an entry for test url. The backoff time is calculated by:
- // new_backoff = 2.0 * old_backoff + 0
- // and maximum backoff time is 256 milliseconds.
- // Maximum retries allowed is set to 11.
- URLFetcherProtectManager* manager = URLFetcherProtectManager::GetInstance();
- URLFetcherProtectEntry* entry =
- new URLFetcherProtectEntry(200, 3, 11, 1, 2.0, 0, 256);
- manager->Register(url.host(), entry);
-
- CreateFetcher(url);
-
- MessageLoop::current()->Run();
-}
-
-TEST_F(URLFetcherProtectTestPassedThrough, ServerUnavailablePropagateResponse) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(L"chrome/test/data", NULL);
- ASSERT_TRUE(NULL != server.get());
- GURL url = GURL(server->TestServerPage("files/server-unavailable.html"));
-
- // Registers an entry for test url. The backoff time is calculated by:
- // new_backoff = 2.0 * old_backoff + 0
- // and maximum backoff time is 256 milliseconds.
- // Maximum retries allowed is set to 11.
- URLFetcherProtectManager* manager = URLFetcherProtectManager::GetInstance();
- // Total time if *not* for not doing automatic backoff would be 150s.
- // In reality it should be "as soon as server responds".
- URLFetcherProtectEntry* entry =
- new URLFetcherProtectEntry(200, 3, 11, 100, 2.0, 0, 150000);
- manager->Register(url.host(), entry);
-
- CreateFetcher(url);
-
- MessageLoop::current()->Run();
-}
-
-
-TEST_F(URLFetcherBadHTTPSTest, BadHTTPSTest) {
- scoped_refptr<HTTPSTestServer> server =
- HTTPSTestServer::CreateExpiredServer(kDocRoot);
- ASSERT_TRUE(NULL != server.get());
-
- CreateFetcher(GURL(server->TestServerPage("defaultresponse")));
-
- MessageLoop::current()->Run();
-}
-
-TEST_F(URLFetcherCancelTest, ReleasesContext) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(L"chrome/test/data", NULL);
- ASSERT_TRUE(NULL != server.get());
- GURL url = GURL(server->TestServerPage("files/server-unavailable.html"));
-
- // Registers an entry for test url. The backoff time is calculated by:
- // new_backoff = 2.0 * old_backoff + 0
- // The initial backoff is 2 seconds and maximum backoff is 4 seconds.
- // Maximum retries allowed is set to 2.
- URLFetcherProtectManager* manager = URLFetcherProtectManager::GetInstance();
- URLFetcherProtectEntry* entry =
- new URLFetcherProtectEntry(200, 3, 2, 2000, 2.0, 0, 4000);
- manager->Register(url.host(), entry);
-
- // Create a separate thread that will create the URLFetcher. The current
- // (main) thread will do the IO, and when the fetch is complete it will
- // terminate the main thread's message loop; then the other thread's
- // message loop will be shut down automatically as the thread goes out of
- // scope.
- base::Thread t("URLFetcher test thread");
- ASSERT_TRUE(t.Start());
- t.message_loop()->PostTask(FROM_HERE, new FetcherWrapperTask(this, url));
-
- MessageLoop::current()->Run();
-}
-
-TEST_F(URLFetcherCancelTest, CancelWhileDelayedStartTaskPending) {
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(L"chrome/test/data", NULL);
- ASSERT_TRUE(NULL != server.get());
- GURL url = GURL(server->TestServerPage("files/server-unavailable.html"));
-
- // Register an entry for test url.
- //
- // Ideally we would mock URLFetcherProtectEntry to return XXX seconds
- // in response to entry->UpdateBackoff(SEND).
- //
- // Unfortunately this function is time sensitive, so we fudge some numbers
- // to make it at least somewhat likely to have a non-zero deferred
- // delay when running.
- //
- // Using a sliding window of 2 seconds, and max of 1 request, under a fast
- // run we expect to have a 4 second delay when posting the Start task.
- URLFetcherProtectManager* manager = URLFetcherProtectManager::GetInstance();
- URLFetcherProtectEntry* entry =
- new URLFetcherProtectEntry(2000, 1, 2, 2000, 2.0, 0, 4000);
- EXPECT_EQ(0, entry->UpdateBackoff(URLFetcherProtectEntry::SEND));
- entry->UpdateBackoff(URLFetcherProtectEntry::SEND); // Returns about 2000.
- manager->Register(url.host(), entry);
-
- // The next request we try to send will be delayed by ~4 seconds.
- // The slower the test runs, the less the delay will be (since it takes the
- // time difference from now).
-
- base::Thread t("URLFetcher test thread");
- ASSERT_TRUE(t.Start());
- t.message_loop()->PostTask(FROM_HERE, new FetcherWrapperTask(this, url));
-
- MessageLoop::current()->Run();
-}
-
-} // namespace.
diff --git a/chrome/browser/net/url_request_context_getter.cc b/chrome/browser/net/url_request_context_getter.cc
deleted file mode 100644
index 64198b5..0000000
--- a/chrome/browser/net/url_request_context_getter.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/message_loop_proxy.h"
-#include "chrome/browser/net/url_request_context_getter.h"
-#include "net/url_request/url_request_context.h"
-
-net::CookieStore* URLRequestContextGetter::GetCookieStore() {
- return GetURLRequestContext()->cookie_store();
-}
-
-void URLRequestContextGetter::OnDestruct() {
- scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy =
- GetIOMessageLoopProxy();
- DCHECK(io_message_loop_proxy);
- if (io_message_loop_proxy) {
- if (io_message_loop_proxy->BelongsToCurrentThread()) {
- delete this;
- } else {
- io_message_loop_proxy->DeleteSoon(FROM_HERE, this);
- }
- }
- // If no IO message loop proxy was available, we will just leak memory.
- // This is also true if the IO thread is gone.
-}
-
diff --git a/chrome/browser/net/url_request_context_getter.h b/chrome/browser/net/url_request_context_getter.h
deleted file mode 100644
index 2cedeb5..0000000
--- a/chrome/browser/net/url_request_context_getter.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_NET_URL_REQUEST_CONTEXT_GETTER_H_
-#define CHROME_BROWSER_NET_URL_REQUEST_CONTEXT_GETTER_H_
-
-#include "base/ref_counted.h"
-#include "base/task.h"
-
-namespace base {
-class MessageLoopProxy;
-}
-
-namespace net {
-class CookieStore;
-}
-
-class URLRequestContext;
-struct URLRequestContextGetterTraits;
-
-// Interface for retrieving an URLRequestContext.
-class URLRequestContextGetter
- : public base::RefCountedThreadSafe<URLRequestContextGetter,
- URLRequestContextGetterTraits> {
- public:
- virtual URLRequestContext* GetURLRequestContext() = 0;
-
- // Defaults to GetURLRequestContext()->cookie_store(), but
- // implementations can override it.
- virtual net::CookieStore* GetCookieStore();
- // Returns a MessageLoopProxy corresponding to the thread on which the
- // request IO happens (the thread on which the returned URLRequestContext
- // may be used).
- virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() = 0;
-
- protected:
- friend class DeleteTask<URLRequestContextGetter>;
- friend struct URLRequestContextGetterTraits;
-
- virtual ~URLRequestContextGetter() {}
- private:
- // OnDestruct is meant to ensure deletion on the thread on which the request
- // IO happens.
- void OnDestruct();
-};
-
-struct URLRequestContextGetterTraits {
- static void Destruct(URLRequestContextGetter* context_getter) {
- context_getter->OnDestruct();
- }
-};
-
-#endif // CHROME_BROWSER_NET_URL_REQUEST_CONTEXT_GETTER_H_
-
diff --git a/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc b/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc
index 8f0b7f1..0474e12 100644
--- a/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc
+++ b/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc
@@ -7,8 +7,8 @@
#include "base/hash_tables.h"
#include "base/histogram.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/profile.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/websockets/websocket.h"
diff --git a/chrome/browser/net/websocket_experiment/websocket_experiment_task.h b/chrome/browser/net/websocket_experiment/websocket_experiment_task.h
index e3ec500..fc62fd7 100644
--- a/chrome/browser/net/websocket_experiment/websocket_experiment_task.h
+++ b/chrome/browser/net/websocket_experiment/websocket_experiment_task.h
@@ -40,7 +40,7 @@
#include "base/basictypes.h"
#include "base/task.h"
#include "base/time.h"
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "googleurl/src/gurl.h"
#include "net/base/completion_callback.h"
#include "net/base/net_errors.h"
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index f64ca33..feede75 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -22,7 +22,6 @@
#include "chrome/browser/child_process_security_policy.h"
#include "chrome/browser/chrome_plugin_browsing_context.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/net/url_request_tracking.h"
#include "chrome/browser/plugin_service.h"
#include "chrome/browser/profile.h"
@@ -31,6 +30,7 @@
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/logging_chrome.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/plugin_messages.h"
#include "chrome/common/render_messages.h"
#include "gfx/native_widget_types.h"
diff --git a/chrome/browser/printing/cloud_print/cloud_print_helpers.cc b/chrome/browser/printing/cloud_print/cloud_print_helpers.cc
index 3fe81c5..3f0871f 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_helpers.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_helpers.cc
@@ -11,9 +11,9 @@
#include "base/task.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/printing/cloud_print/cloud_print_consts.h"
#include "chrome/browser/profile.h"
+#include "chrome/common/net/url_fetcher.h"
std::string StringFromJobStatus(cloud_print::PrintJobStatus status) {
std::string ret;
diff --git a/chrome/browser/printing/cloud_print/cloud_print_proxy_backend.h b/chrome/browser/printing/cloud_print/cloud_print_proxy_backend.h
index 675ae12..acced9a 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_proxy_backend.h
+++ b/chrome/browser/printing/cloud_print/cloud_print_proxy_backend.h
@@ -9,8 +9,8 @@
#include <string>
#include "base/thread.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/printing/cloud_print/printer_info.h"
+#include "chrome/common/net/url_fetcher.h"
class CloudPrintProxyService;
class DictionaryValue;
diff --git a/chrome/browser/printing/cloud_print/job_status_updater.h b/chrome/browser/printing/cloud_print/job_status_updater.h
index d480621..a951084 100644
--- a/chrome/browser/printing/cloud_print/job_status_updater.h
+++ b/chrome/browser/printing/cloud_print/job_status_updater.h
@@ -11,7 +11,7 @@
#include "base/ref_counted.h"
#include "base/thread.h"
#include "chrome/browser/printing/cloud_print/printer_info.h"
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "net/url_request/url_request_status.h"
// Periodically monitors the status of a local print job and updates the
diff --git a/chrome/browser/printing/cloud_print/printer_job_handler.h b/chrome/browser/printing/cloud_print/printer_job_handler.h
index 15e5cd5..4e8d61c 100644
--- a/chrome/browser/printing/cloud_print/printer_job_handler.h
+++ b/chrome/browser/printing/cloud_print/printer_job_handler.h
@@ -13,7 +13,7 @@
#include "base/thread.h"
#include "chrome/browser/printing/cloud_print/job_status_updater.h"
#include "chrome/browser/printing/cloud_print/printer_info.h"
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "net/url_request/url_request_status.h"
// A class that handles cloud print jobs for a particular printer. This class
diff --git a/chrome/browser/profile_manager.cc b/chrome/browser/profile_manager.cc
index 851ef3e..296ac4b 100644
--- a/chrome/browser/profile_manager.cc
+++ b/chrome/browser/profile_manager.cc
@@ -16,12 +16,12 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/pref_service.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/logging_chrome.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index fff6622..1bd8937 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -32,7 +32,6 @@
#include "chrome/browser/gpu_process_host.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/io_thread.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/plugin_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/audio_renderer_host.h"
@@ -48,6 +47,7 @@
#include "chrome/common/child_process_info.h"
#include "chrome/common/gpu_messages.h"
#include "chrome/common/logging_chrome.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/process_watcher.h"
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 2dc570e..ab436ec 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -21,7 +21,6 @@
#include "chrome/browser/dom_operation_notification_details.h"
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/metrics/user_metrics.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
@@ -36,6 +35,7 @@
#include "chrome/common/render_messages.h"
#include "chrome/common/result_codes.h"
#include "chrome/common/chrome_constants.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/thumbnail_score.h"
#include "chrome/common/translate_errors.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/browser/renderer_host/socket_stream_host.cc b/chrome/browser/renderer_host/socket_stream_host.cc
index 67e860a..51f7ec3 100644
--- a/chrome/browser/renderer_host/socket_stream_host.cc
+++ b/chrome/browser/renderer_host/socket_stream_host.cc
@@ -6,8 +6,8 @@
#include "base/logging.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/common/net/socket_stream.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/render_messages.h"
#include "net/socket_stream/socket_stream_job.h"
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index 0a293c8..5a8baae 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -16,11 +16,11 @@
#include "base/timer.h"
#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/safe_browsing/protocol_parser.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/common/env_vars.h"
+#include "chrome/common/net/url_request_context_getter.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/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h
index dc6d703..75201ae 100644
--- a/chrome/browser/safe_browsing/protocol_manager.h
+++ b/chrome/browser/safe_browsing/protocol_manager.h
@@ -19,11 +19,11 @@
#include "base/scoped_ptr.h"
#include "base/time.h"
#include "base/timer.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/safe_browsing/chunk_range.h"
#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 "chrome/common/net/url_fetcher.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
class Task;
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index be02dba..ede1587 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -10,7 +10,6 @@
#include "base/string_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/metrics_service.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/safe_browsing/protocol_manager.h"
@@ -20,6 +19,7 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "net/base/registry_controlled_domain.h"
diff --git a/chrome/browser/search_engines/template_url_fetcher.cc b/chrome/browser/search_engines/template_url_fetcher.cc
index 1d1edea..3e8815e6 100644
--- a/chrome/browser/search_engines/template_url_fetcher.cc
+++ b/chrome/browser/search_engines/template_url_fetcher.cc
@@ -6,13 +6,13 @@
#include "chrome/browser/search_engines/template_url_fetcher.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/search_engines/template_url_parser.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/notification_source.h"
#include "chrome/common/notification_type.h"
diff --git a/chrome/browser/spellcheck_host.cc b/chrome/browser/spellcheck_host.cc
index 4814ba4..1c0b266 100644
--- a/chrome/browser/spellcheck_host.cc
+++ b/chrome/browser/spellcheck_host.cc
@@ -12,12 +12,12 @@
#include "base/path_service.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/pref_member.h"
#include "chrome/browser/spellcheck_host_observer.h"
#include "chrome/browser/spellchecker_platform_engine.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/spellcheck_common.h"
diff --git a/chrome/browser/spellcheck_host.h b/chrome/browser/spellcheck_host.h
index 493f26c..c0382c8 100644
--- a/chrome/browser/spellcheck_host.h
+++ b/chrome/browser/spellcheck_host.h
@@ -12,7 +12,7 @@
#include "base/platform_file.h"
#include "base/ref_counted.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
class Profile;
class SpellCheckHostObserver;
diff --git a/chrome/browser/sync/glue/http_bridge.h b/chrome/browser/sync/glue/http_bridge.h
index e1e1bbd..548f5d3 100644
--- a/chrome/browser/sync/glue/http_bridge.h
+++ b/chrome/browser/sync/glue/http_bridge.h
@@ -9,9 +9,9 @@
#include "base/ref_counted.h"
#include "base/waitable_event.h"
-#include "chrome/browser/net/url_fetcher.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/sync/engine/syncapi.h"
+#include "chrome/common/net/url_fetcher.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_context.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
diff --git a/chrome/browser/sync/glue/http_bridge_unittest.cc b/chrome/browser/sync/glue/http_bridge_unittest.cc
index 076d8cd..8c28d16 100644
--- a/chrome/browser/sync/glue/http_bridge_unittest.cc
+++ b/chrome/browser/sync/glue/http_bridge_unittest.cc
@@ -5,8 +5,8 @@
#include "base/message_loop_proxy.h"
#include "base/thread.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/net/test_url_fetcher_factory.h"
#include "chrome/browser/sync/glue/http_bridge.h"
+#include "chrome/common/net/test_url_fetcher_factory.h"
#include "net/url_request/url_request_unittest.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h
index 4704f85..1f44df9 100644
--- a/chrome/browser/sync/glue/sync_backend_host.h
+++ b/chrome/browser/sync/glue/sync_backend_host.h
@@ -17,13 +17,13 @@
#include "base/thread.h"
#include "base/timer.h"
#include "chrome/browser/google_service_auth_error.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/sync/notification_method.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/engine/model_safe_worker.h"
#include "chrome/browser/sync/glue/data_type_controller.h"
#include "chrome/browser/sync/glue/ui_model_worker.h"
#include "chrome/browser/sync/syncable/model_type.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "googleurl/src/gurl.h"
class CancelableTask;
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index ff2361f..68a8602 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -24,7 +24,6 @@
#include "chrome/browser/find_bar_controller.h"
#include "chrome/browser/find_notification_details.h"
#include "chrome/browser/jsmessage_box_client.h"
-#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/password_manager/password_manager.h"
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/shell_dialogs.h"
@@ -40,6 +39,7 @@
#include "chrome/common/content_settings_types.h"
#include "chrome/common/extensions/url_pattern.h"
#include "chrome/common/navigation_types.h"
+#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/property_bag.h"
#include "chrome/common/renderer_preferences.h"
diff --git a/chrome/browser/translate/translate_manager.h b/chrome/browser/translate/translate_manager.h
index 14db089..1c44767 100644
--- a/chrome/browser/translate/translate_manager.h
+++ b/chrome/browser/translate/translate_manager.h
@@ -13,8 +13,8 @@
#include "base/lazy_instance.h"
#include "base/singleton.h"
#include "base/task.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/translate/translate_infobars_delegates.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/translate_errors.h"
diff --git a/chrome/browser/translate/translate_manager_unittest.cc b/chrome/browser/translate/translate_manager_unittest.cc
index 8c4d242..a4b1f6c 100644
--- a/chrome/browser/translate/translate_manager_unittest.cc
+++ b/chrome/browser/translate/translate_manager_unittest.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/renderer_host/test/test_render_view_host.h"
-#include "chrome/browser/net/test_url_fetcher_factory.h"
#include "chrome/browser/renderer_host/mock_render_process_host.h"
#include "chrome/browser/tab_contents/render_view_context_menu.h"
#include "chrome/browser/translate/translate_infobars_delegates.h"
@@ -18,6 +17,7 @@
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
+#include "chrome/common/net/test_url_fetcher_factory.h"
#include "chrome/test/testing_browser_process.h"
#include "grit/generated_resources.h"
#include "testing/gmock/include/gmock/gmock.h"
diff --git a/chrome/browser/views/bug_report_view.cc b/chrome/browser/views/bug_report_view.cc
index 352579e..4903c75 100644
--- a/chrome/browser/views/bug_report_view.cc
+++ b/chrome/browser/views/bug_report_view.cc
@@ -10,13 +10,13 @@
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_version_info.h"
#include "chrome/browser/bug_report_util.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_util.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/pref_names.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/views/bug_report_view.h b/chrome/browser/views/bug_report_view.h
index b79a823..7d641b1 100644
--- a/chrome/browser/views/bug_report_view.h
+++ b/chrome/browser/views/bug_report_view.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_
#define CHROME_BROWSER_VIEWS_BUG_REPORT_VIEW_H_
-#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/common/net/url_fetcher.h"
#include "googleurl/src/gurl.h"
#include "views/controls/combobox/combobox.h"
#include "views/controls/textfield/textfield.h"
diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc
index f30e90b..a18804a 100644
--- a/chrome/browser/web_resource/web_resource_service.cc
+++ b/chrome/browser/web_resource/web_resource_service.cc
@@ -10,8 +10,8 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/net/url_fetcher.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/pref_names.h"
#include "googleurl/src/gurl.h"
#include "net/base/load_flags.h"