diff options
author | groby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-09 22:34:36 +0000 |
---|---|---|
committer | groby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-09 22:34:36 +0000 |
commit | 06305964e02af11bda4699175340ffec2f784f6b (patch) | |
tree | bb565cff1a2e9218ca85b98d953f1a1b2ab070b6 | |
parent | 3ebf7d606bfd9d3d90c34542db5a370340af63b8 (diff) | |
download | chromium_src-06305964e02af11bda4699175340ffec2f784f6b.zip chromium_src-06305964e02af11bda4699175340ffec2f784f6b.tar.gz chromium_src-06305964e02af11bda4699175340ffec2f784f6b.tar.bz2 |
Moved url_utils from chrome/browser/net to chrome/common/net.
There is an upcoming CL that needs those functions from
chrome/common/extensions.
TBR=satorux@chromium.org, pkasting@chromium.org
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10384086
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136154 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.cc | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_documents_service.cc | 4 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_operations.cc | 22 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/existing_user_controller.cc | 8 | ||||
-rw-r--r-- | chrome/browser/google/google_util.cc | 6 | ||||
-rw-r--r-- | chrome/browser/intents/cws_intents_registry.cc | 10 | ||||
-rw-r--r-- | chrome/browser/tab_contents/render_view_context_menu.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/browser.cc | 4 | ||||
-rw-r--r-- | chrome/browser/web_resource/notification_promo.cc | 8 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_common.gypi | 8 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 2 | ||||
-rw-r--r-- | chrome/common/net/url_util.cc (renamed from chrome/browser/net/browser_url_util.cc) | 6 | ||||
-rw-r--r-- | chrome/common/net/url_util.h (renamed from chrome/browser/net/browser_url_util.h) | 10 | ||||
-rw-r--r-- | chrome/common/net/url_util_unittest.cc (renamed from chrome/browser/net/browser_url_util_unittest.cc) | 10 |
15 files changed, 55 insertions, 55 deletions
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc index 79d909a..0aadb4f 100644 --- a/chrome/browser/chromeos/cros/network_library.cc +++ b/chrome/browser/chromeos/cros/network_library.cc @@ -19,7 +19,7 @@ #include "chrome/browser/chromeos/cros/native_network_parser.h" #include "chrome/browser/chromeos/cros/network_library_impl_cros.h" #include "chrome/browser/chromeos/cros/network_library_impl_stub.h" -#include "chrome/browser/net/browser_url_util.h" +#include "chrome/common/net/url_util.h" #include "chrome/common/net/x509_certificate_model.h" #include "content/public/browser/browser_thread.h" #include "grit/generated_resources.h" @@ -857,10 +857,10 @@ GURL CellularNetwork::GetAccountInfoUrl() const { return GURL(payment_url()); GURL base_url(kRedirectExtensionPage); - GURL temp_url = chrome_browser_net::AppendQueryParameter(base_url, + GURL temp_url = chrome_common_net::AppendQueryParameter(base_url, "post_data", post_data_); - GURL redir_url = chrome_browser_net::AppendQueryParameter(temp_url, + GURL redir_url = chrome_common_net::AppendQueryParameter(temp_url, "formUrl", payment_url()); return redir_url; diff --git a/chrome/browser/chromeos/gdata/gdata_documents_service.cc b/chrome/browser/chromeos/gdata/gdata_documents_service.cc index 830ef01..41c2bce 100644 --- a/chrome/browser/chromeos/gdata/gdata_documents_service.cc +++ b/chrome/browser/chromeos/gdata/gdata_documents_service.cc @@ -10,8 +10,8 @@ #include "base/message_loop_proxy.h" #include "chrome/browser/chromeos/gdata/gdata_file_system.h" #include "chrome/browser/chromeos/gdata/gdata_operations.h" -#include "chrome/browser/net/browser_url_util.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/net/url_util.h" #include "content/public/browser/browser_thread.h" using content::BrowserThread; @@ -138,7 +138,7 @@ void DocumentsService::DownloadDocument( DownloadFile( virtual_path, local_cache_path, - chrome_browser_net::AppendQueryParameter(document_url, + chrome_common_net::AppendQueryParameter(document_url, "exportFormat", GetExportFormatParam(format)), callback, diff --git a/chrome/browser/chromeos/gdata/gdata_operations.cc b/chrome/browser/chromeos/gdata/gdata_operations.cc index 52bf6d9..9f9ae36 100644 --- a/chrome/browser/chromeos/gdata/gdata_operations.cc +++ b/chrome/browser/chromeos/gdata/gdata_operations.cc @@ -12,10 +12,10 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/gdata/gdata_file_system.h" #include "chrome/browser/chromeos/gdata/gdata_util.h" -#include "chrome/browser/net/browser_url_util.h" #include "chrome/common/libxml_utils.h" -#include "chrome/common/net/gaia/google_service_auth_error.h" #include "chrome/common/net/gaia/gaia_urls.h" +#include "chrome/common/net/gaia/google_service_auth_error.h" +#include "chrome/common/net/url_util.h" #include "net/base/escape.h" #include "net/http/http_util.h" @@ -90,9 +90,9 @@ const char kUserContentScope[] = "https://docs.googleusercontent.com/"; // folders in the feed are added to document feed URLs. GURL AddStandardUrlParams(const GURL& url) { GURL result = - chrome_browser_net::AppendOrReplaceQueryParameter(url, "v", "3"); + chrome_common_net::AppendOrReplaceQueryParameter(url, "v", "3"); result = - chrome_browser_net::AppendOrReplaceQueryParameter(result, "alt", "json"); + chrome_common_net::AppendOrReplaceQueryParameter(result, "alt", "json"); return result; } @@ -100,7 +100,7 @@ GURL AddStandardUrlParams(const GURL& url) { // applications. GURL AddMetadataUrlParams(const GURL& url) { GURL result = AddStandardUrlParams(url); - result = chrome_browser_net::AppendOrReplaceQueryParameter( + result = chrome_common_net::AppendOrReplaceQueryParameter( result, "include-installed-apps", "true"); return result; } @@ -112,26 +112,26 @@ GURL AddFeedUrlParams(const GURL& url, int changestamp, const std::string& search_string) { GURL result = AddStandardUrlParams(url); - result = chrome_browser_net::AppendOrReplaceQueryParameter( + result = chrome_common_net::AppendOrReplaceQueryParameter( result, "showfolders", "true"); - result = chrome_browser_net::AppendOrReplaceQueryParameter( + result = chrome_common_net::AppendOrReplaceQueryParameter( result, "max-results", base::StringPrintf("%d", num_items_to_fetch)); - result = chrome_browser_net::AppendOrReplaceQueryParameter( + result = chrome_common_net::AppendOrReplaceQueryParameter( result, "include-installed-apps", "true"); if (changestamp) { - result = chrome_browser_net::AppendQueryParameter( + result = chrome_common_net::AppendQueryParameter( result, "start-index", base::StringPrintf("%d", changestamp)); } if (!search_string.empty()) { - result = chrome_browser_net::AppendOrReplaceQueryParameter( + result = chrome_common_net::AppendOrReplaceQueryParameter( result, "q", search_string); } return result; @@ -836,7 +836,7 @@ InitiateUploadOperation::InitiateUploadOperation( profile), callback_(callback), params_(params), - initiate_upload_url_(chrome_browser_net::AppendOrReplaceQueryParameter( + initiate_upload_url_(chrome_common_net::AppendOrReplaceQueryParameter( params.resumable_create_media_link, kUploadParamConvertKey, kUploadParamConvertValue)) { diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index 241d778..1b55207 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc @@ -32,7 +32,6 @@ #include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/system/statistics_provider.h" #include "chrome/browser/google/google_util.h" -#include "chrome/browser/net/browser_url_util.h" #include "chrome/browser/policy/policy_service.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/session_startup_pref.h" @@ -41,6 +40,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/net/gaia/google_service_auth_error.h" +#include "chrome/common/net/url_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chromeos/dbus/dbus_thread_manager.h" @@ -762,18 +762,18 @@ std::string ExistingUserController::GetGettingStartedGuideURL() const { if (!provider->GetMachineStatistic(kMachineInfoBoard, &board)) LOG(ERROR) << "Failed to get board information"; if (!board.empty()) { - guide_url = chrome_browser_net::AppendQueryParameter(guide_url, + guide_url = chrome_common_net::AppendQueryParameter(guide_url, kGetStartedBoardParam, board); } if (is_owner_login_) { - guide_url = chrome_browser_net::AppendQueryParameter( + guide_url = chrome_common_net::AppendQueryParameter( guide_url, kGetStartedOwnerParam, kGetStartedOwnerParamValue); } guide_url = google_util::AppendGoogleLocaleParam(guide_url); - guide_url = chrome_browser_net::AppendQueryParameter( + guide_url = chrome_common_net::AppendQueryParameter( guide_url, kGetStartedInitialLocaleParam, WizardController::GetInitialLocale()); diff --git a/chrome/browser/google/google_util.cc b/chrome/browser/google/google_util.cc index e0edd2b..eda66b3 100644 --- a/chrome/browser/google/google_util.cc +++ b/chrome/browser/google/google_util.cc @@ -14,8 +14,8 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/google/google_url_tracker.h" -#include "chrome/browser/net/browser_url_util.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/net/url_util.h" #include "chrome/installer/util/google_update_settings.h" #include "googleurl/src/gurl.h" #include "net/base/registry_controlled_domain.h" @@ -66,7 +66,7 @@ GURL AppendGoogleLocaleParam(const GURL& url) { std::string locale = g_browser_process->GetApplicationLocale(); if (locale == "nb") locale = "no"; - return chrome_browser_net::AppendQueryParameter(url, "hl", locale); + return chrome_common_net::AppendQueryParameter(url, "hl", locale); } std::string StringAppendGoogleLocaleParam(const std::string& url) { @@ -85,7 +85,7 @@ GURL AppendGoogleTLDParam(Profile* profile, const GURL& url) { NOTREACHED(); return url; } - return chrome_browser_net::AppendQueryParameter( + return chrome_common_net::AppendQueryParameter( url, "sd", google_domain.substr(first_dot + 1)); } diff --git a/chrome/browser/intents/cws_intents_registry.cc b/chrome/browser/intents/cws_intents_registry.cc index e17f0b0..fd00f1b 100644 --- a/chrome/browser/intents/cws_intents_registry.cc +++ b/chrome/browser/intents/cws_intents_registry.cc @@ -11,12 +11,12 @@ #include "base/string16.h" #include "base/utf_string_conversions.h" #include "chrome/browser/intents/api_key.h" -#include "chrome/browser/net/browser_url_util.h" #include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/browser/webdata/web_data_service.h" +#include "chrome/common/net/url_util.h" #include "content/public/common/url_fetcher.h" -#include "net/base/mime_util.h" #include "net/base/load_flags.h" +#include "net/base/mime_util.h" namespace { @@ -161,12 +161,12 @@ void CWSIntentsRegistry::GetIntentServices(const string16& action, GURL CWSIntentsRegistry::BuildQueryURL(const string16& action, const string16& type) { GURL request(kCWSIntentServiceURL); - request = chrome_browser_net::AppendQueryParameter(request, "intent", + request = chrome_common_net::AppendQueryParameter(request, "intent", UTF16ToUTF8(action)); - request = chrome_browser_net::AppendQueryParameter(request, "mime_types", + request = chrome_common_net::AppendQueryParameter(request, "mime_types", UTF16ToUTF8(type)); if (web_intents::kApiKey[0]) { - request = chrome_browser_net::AppendQueryParameter(request, "key", + request = chrome_common_net::AppendQueryParameter(request, "key", web_intents::kApiKey); } diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 7214e0b..5931178 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -27,7 +27,6 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/google/google_util.h" -#include "chrome/browser/net/browser_url_util.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" #include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/prefs/pref_service.h" @@ -55,6 +54,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_view_type.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/net/url_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/print_messages.h" #include "chrome/common/spellcheck_messages.h" @@ -1966,7 +1966,7 @@ void RenderViewContextMenu::Inspect(int x, int y) { } void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { - chrome_browser_net::WriteURLToClipboard( + chrome_common_net::WriteURLToClipboard( url, profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), g_browser_process->clipboard()); diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index d6a38f4..13c4daf 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -65,7 +65,6 @@ #include "chrome/browser/instant/instant_unload_handler.h" #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" #include "chrome/browser/intents/web_intents_util.h" -#include "chrome/browser/net/browser_url_util.h" #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/browser/platform_util.h" @@ -147,6 +146,7 @@ #include "chrome/common/custom_handlers/protocol_handler.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" +#include "chrome/common/net/url_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/profiling.h" #include "chrome/common/url_constants.h" @@ -1757,7 +1757,7 @@ void Browser::WriteCurrentURLToClipboard() { if (!toolbar_model_->ShouldDisplayURL()) return; - chrome_browser_net::WriteURLToClipboard( + chrome_common_net::WriteURLToClipboard( contents->GetURL(), profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), g_browser_process->clipboard()); diff --git a/chrome/browser/web_resource/notification_promo.cc b/chrome/browser/web_resource/notification_promo.cc index 0c24e8f..6f31d9b 100644 --- a/chrome/browser/web_resource/notification_promo.cc +++ b/chrome/browser/web_resource/notification_promo.cc @@ -12,11 +12,11 @@ #include "base/string_number_conversions.h" #include "base/time.h" #include "base/values.h" -#include "chrome/browser/net/browser_url_util.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile_impl.h" #include "chrome/browser/web_resource/promo_resource_service.h" #include "chrome/common/chrome_version_info.h" +#include "chrome/common/net/url_util.h" #include "chrome/common/pref_names.h" #include "content/public/browser/user_metrics.h" #include "googleurl/src/gurl.h" @@ -445,11 +445,11 @@ int NotificationPromo::CurrentPlatform() { // static GURL NotificationPromo::PromoServerURL() { GURL url(promo_server_url); - url = chrome_browser_net::AppendQueryParameter( + url = chrome_common_net::AppendQueryParameter( url, "dist", ChannelString()); - url = chrome_browser_net::AppendQueryParameter( + url = chrome_common_net::AppendQueryParameter( url, "osname", PlatformString()); - url = chrome_browser_net::AppendQueryParameter( + url = chrome_common_net::AppendQueryParameter( url, "branding", chrome::VersionInfo().Version()); DVLOG(1) << "PromoServerURL=" << url.spec(); // Note that locale param is added by WebResourceService. diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 035969e..6ac2f68 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1348,8 +1348,6 @@ 'browser/metrics/tracking_synchronizer.h', 'browser/metrics/tracking_synchronizer_observer.h', 'browser/native_window_notification_source.h', - 'browser/net/browser_url_util.cc', - 'browser/net/browser_url_util.h', 'browser/net/chrome_cookie_notification_details.h', 'browser/net/chrome_fraudulent_certificate_reporter.cc', 'browser/net/chrome_fraudulent_certificate_reporter.h', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index ebc123b..b0a3075 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -412,9 +412,6 @@ 'target_name': 'common_net', 'type': 'static_library', 'sources': [ - 'common/net/net_resource_provider.cc', - 'common/net/net_resource_provider.h', - 'common/net/predictor_common.h', 'common/net/gaia/gaia_auth_consumer.cc', 'common/net/gaia/gaia_auth_consumer.h', 'common/net/gaia/gaia_auth_fetcher.cc', @@ -442,6 +439,11 @@ 'common/net/gaia/oauth2_revocation_consumer.h', 'common/net/gaia/oauth2_revocation_fetcher.cc', 'common/net/gaia/oauth2_revocation_fetcher.h', + 'common/net/net_resource_provider.cc', + 'common/net/net_resource_provider.h', + 'common/net/predictor_common.h', + 'common/net/url_util.cc', + 'common/net/url_util.h', 'common/net/x509_certificate_model.cc', 'common/net/x509_certificate_model_nss.cc', 'common/net/x509_certificate_model_openssl.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 72c6dda..3e82e71 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1355,7 +1355,6 @@ 'browser/metrics/metrics_response_unittest.cc', 'browser/metrics/metrics_service_unittest.cc', 'browser/metrics/thread_watcher_unittest.cc', - 'browser/net/browser_url_util_unittest.cc', 'browser/net/chrome_fraudulent_certificate_reporter_unittest.cc', 'browser/net/chrome_net_log_unittest.cc', 'browser/net/connection_tester_unittest.cc', @@ -1932,6 +1931,7 @@ 'common/metrics/metrics_log_base_unittest.cc', 'common/metrics/metrics_log_manager_unittest.cc', 'common/multi_process_lock_unittest.cc', + 'common/net/url_util_unittest.cc', 'common/net/gaia/gaia_auth_fetcher_unittest.cc', 'common/net/gaia/gaia_authenticator_unittest.cc', 'common/net/gaia/gaia_oauth_client_unittest.cc', diff --git a/chrome/browser/net/browser_url_util.cc b/chrome/common/net/url_util.cc index a21625b..c72c208 100644 --- a/chrome/browser/net/browser_url_util.cc +++ b/chrome/common/net/url_util.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/net/browser_url_util.h" +#include "chrome/common/net/url_util.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -13,7 +13,7 @@ #include "net/base/net_util.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" -namespace chrome_browser_net { +namespace chrome_common_net { void WriteURLToClipboard(const GURL& url, const std::string& languages, @@ -91,4 +91,4 @@ GURL AppendOrReplaceQueryParameter(const GURL& url, return url.ReplaceComponents(replacements); } -} // namespace chrome_browser_net +} // namespace chrome_common_net diff --git a/chrome/browser/net/browser_url_util.h b/chrome/common/net/url_util.h index 2669c27..c801d40 100644 --- a/chrome/browser/net/browser_url_util.h +++ b/chrome/common/net/url_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_NET_BROWSER_URL_UTIL_H_ -#define CHROME_BROWSER_NET_BROWSER_URL_UTIL_H_ +#ifndef CHROME_COMMON_NET_URL_UTIL_H_ +#define CHROME_COMMON_NET_URL_UTIL_H_ #pragma once #include <string> @@ -14,7 +14,7 @@ namespace ui { class Clipboard; } -namespace chrome_browser_net { +namespace chrome_common_net { // Writes a string representation of |url| to the system clipboard. void WriteURLToClipboard(const GURL& url, @@ -52,6 +52,6 @@ GURL AppendOrReplaceQueryParameter(const GURL& url, const std::string& name, const std::string& value); -} // namespace chrome_browser_net +} // namespace chrome_common_net -#endif // CHROME_BROWSER_NET_BROWSER_URL_UTIL_H_ +#endif // CHROME_COMMON_NET_URL_UTIL_H_ diff --git a/chrome/browser/net/browser_url_util_unittest.cc b/chrome/common/net/url_util_unittest.cc index b9a0b2e..ebcdfcc 100644 --- a/chrome/browser/net/browser_url_util_unittest.cc +++ b/chrome/common/net/url_util_unittest.cc @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/net/browser_url_util.h" +#include "chrome/common/net/url_util.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" -namespace chrome_browser_net { +namespace chrome_common_net { -TEST(BrowserUrlUtilTest, AppendQueryParameter) { +TEST(UrlUtilTest, AppendQueryParameter) { // Appending a name-value pair to a URL without a query component. EXPECT_EQ("http://example.com/path?name=value", AppendQueryParameter(GURL("http://example.com/path"), @@ -30,7 +30,7 @@ TEST(BrowserUrlUtilTest, AppendQueryParameter) { } -TEST(BrowserUrlUtilTest, AppendOrReplaceQueryParameter) { +TEST(UrlUtilTest, AppendOrReplaceQueryParameter) { // Appending a name-value pair to a URL without a query component. EXPECT_EQ("http://example.com/path?name=value", AppendOrReplaceQueryParameter(GURL("http://example.com/path"), @@ -80,4 +80,4 @@ TEST(BrowserUrlUtilTest, AppendOrReplaceQueryParameter) { "name", "new").spec()); } -} // namespace chrome_browser_net. +} // namespace chrome_common_net. |