diff options
66 files changed, 153 insertions, 351 deletions
@@ -195,7 +195,6 @@ group("both_gn_and_gyp") { "//ui/events:events_unittests", "//ui/gl:gl_unittests", "//ui/touch_selection:ui_touch_selection_unittests", - "//url/ipc:url_ipc", ] } else { deps += [ diff --git a/android_webview/android_webview.gyp b/android_webview/android_webview.gyp index f0cd0e0..8378d0e 100644 --- a/android_webview/android_webview.gyp +++ b/android_webview/android_webview.gyp @@ -262,7 +262,6 @@ '../ui/events/events.gyp:gesture_detection', '../ui/gl/gl.gyp:gl', '../ui/shell_dialogs/shell_dialogs.gyp:shell_dialogs', - '../url/ipc/url_ipc.gyp:url_ipc', '../v8/tools/gyp/v8.gyp:v8', 'android_webview_pak', 'android_webview_version', diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index c90d3e6..3e884bb 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -18,7 +18,6 @@ #include "base/macros.h" #include "base/path_service.h" #include "base/strings/string_number_conversions.h" -#include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 9328cf7..dc732b1 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -358,7 +358,6 @@ '<(DEPTH)/ui/gfx/ipc/gfx_ipc.gyp:gfx_ipc', '<(DEPTH)/ui/resources/ui_resources.gyp:ui_resources', '<(DEPTH)/url/url.gyp:url_lib', - '<(DEPTH)/url/ipc/url_ipc.gyp:url_ipc', ], 'sources': [ '<@(chrome_common_sources)' @@ -497,10 +496,7 @@ ], }, { # Non-Android. - 'sources': [ '<@(chrome_common_importer_sources)' ], - 'dependencies': [ - '<(DEPTH)/url/ipc/url_ipc.gyp:url_ipc', - ], + 'sources': [ '<@(chrome_common_importer_sources)' ] }], ['OS=="win"', { 'include_dirs': [ diff --git a/chrome/common/common_message_generator.cc b/chrome/common/common_message_generator.cc index eb1dda2..959f148 100644 --- a/chrome/common/common_message_generator.cc +++ b/chrome/common/common_message_generator.cc @@ -36,3 +36,4 @@ namespace IPC { namespace IPC { #include "chrome/common/common_message_generator.h" } // namespace IPC + diff --git a/chrome/common/common_message_generator.h b/chrome/common/common_message_generator.h index 13238da..e7a3f68 100644 --- a/chrome/common/common_message_generator.h +++ b/chrome/common/common_message_generator.h @@ -6,14 +6,11 @@ #include "chrome/common/benchmarking_messages.h" #include "chrome/common/chrome_utility_messages.h" -#include "chrome/common/common_param_traits_macros.h" #include "chrome/common/mac/app_shim_messages.h" #include "chrome/common/prerender_messages.h" #include "chrome/common/render_messages.h" #include "chrome/common/safe_browsing/safebrowsing_messages.h" #include "chrome/common/tts_messages.h" -#include "content/public/common/common_param_traits.h" -#include "content/public/common/common_param_traits_macros.h" #if defined(ENABLE_EXTENSIONS) #include "chrome/common/cast_messages.h" @@ -36,3 +33,4 @@ #if defined(ENABLE_WEBRTC) #include "chrome/common/media/webrtc_logging_messages.h" #endif + diff --git a/chrome/common/importer/profile_import_process_messages.h b/chrome/common/importer/profile_import_process_messages.h index e53c171..63e3708 100644 --- a/chrome/common/importer/profile_import_process_messages.h +++ b/chrome/common/importer/profile_import_process_messages.h @@ -18,9 +18,9 @@ #include "components/autofill/content/common/autofill_param_traits_macros.h" #include "components/autofill/core/common/password_form.h" #include "components/favicon_base/favicon_usage_data.h" +#include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" -#include "url/ipc/url_param_traits.h" // Force multiple inclusion of the param traits file to generate all methods. #undef CHROME_COMMON_IMPORTER_PROFILE_IMPORT_PROCESS_PARAM_TRAITS_MACROS_H_ diff --git a/chrome/common/prerender_messages.h b/chrome/common/prerender_messages.h index a9ca9f6..fc373fe 100644 --- a/chrome/common/prerender_messages.h +++ b/chrome/common/prerender_messages.h @@ -6,13 +6,13 @@ #include <stdint.h> +#include "content/public/common/common_param_traits.h" #include "content/public/common/referrer.h" #include "ipc/ipc_message.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_param_traits.h" #include "ui/gfx/geometry/size.h" #include "url/gurl.h" -#include "url/ipc/url_param_traits.h" #define IPC_MESSAGE_START PrerenderMsgStart diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 74efb68..a34683a 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -11,23 +11,19 @@ #include "base/strings/string16.h" #include "base/time/time.h" #include "build/build_config.h" +#include "chrome/common/common_param_traits.h" #include "chrome/common/instant_types.h" #include "chrome/common/ntp_logging_events.h" #include "chrome/common/search_provider.h" #include "chrome/common/web_application_info.h" -#include "components/content_settings/core/common/content_settings.h" -#include "components/content_settings/core/common/content_settings_pattern.h" #include "components/omnibox/common/omnibox_focus_state.h" +#include "content/public/common/common_param_traits.h" #include "content/public/common/top_controls_state.h" -#include "content/public/common/webplugininfo.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_platform_file.h" #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerPromptReply.h" #include "third_party/WebKit/public/web/WebConsoleMessage.h" -#include "third_party/WebKit/public/web/WebWindowFeatures.h" -#include "ui/base/window_open_disposition.h" -#include "url/ipc/url_param_traits.h" // Singly-included section for enums and custom IPC traits. #ifndef CHROME_COMMON_RENDER_MESSAGES_H_ diff --git a/chrome/renderer/chrome_render_frame_observer.cc b/chrome/renderer/chrome_render_frame_observer.cc index b49f1be..af94139 100644 --- a/chrome/renderer/chrome_render_frame_observer.cc +++ b/chrome/renderer/chrome_render_frame_observer.cc @@ -12,7 +12,6 @@ #include "base/command_line.h" #include "base/metrics/histogram.h" -#include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/common/chrome_isolated_world_ids.h" @@ -23,7 +22,6 @@ #include "chrome/renderer/prerender/prerender_helper.h" #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" #include "components/translate/content/renderer/translate_helper.h" -#include "content/public/common/ssl_status.h" #include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_view.h" #include "extensions/common/constants.h" diff --git a/components/autofill.gypi b/components/autofill.gypi index ac1660d..60a1d56 100644 --- a/components/autofill.gypi +++ b/components/autofill.gypi @@ -325,7 +325,6 @@ '../ui/gfx/gfx.gyp:gfx', '../ui/gfx/ipc/gfx_ipc.gyp:gfx_ipc', '../url/url.gyp:url_lib', - '../url/ipc/url_ipc.gyp:url_ipc', ], 'include_dirs': [ '..', diff --git a/components/content_settings.gypi b/components/content_settings.gypi index 243fcce..1d9b317 100644 --- a/components/content_settings.gypi +++ b/components/content_settings.gypi @@ -128,9 +128,9 @@ 'dependencies': [ 'content_settings_core_common', '../base/base.gyp:base', + '../content/content.gyp:content_common', '../ipc/ipc.gyp:ipc', '../url/url.gyp:url_lib', - '../url/ipc/url_ipc.gyp:url_ipc', ], 'include_dirs': [ '..', diff --git a/components/content_settings/content/common/content_settings_messages.h b/components/content_settings/content/common/content_settings_messages.h index 63a64c0..3b7225c 100644 --- a/components/content_settings/content/common/content_settings_messages.h +++ b/components/content_settings/content/common/content_settings_messages.h @@ -5,9 +5,10 @@ // Multiply-included file, no traditional include guard. #include "base/strings/string16.h" #include "components/content_settings/core/common/content_settings_types.h" +#include "content/public/common/common_param_traits.h" +#include "content/public/common/common_param_traits_macros.h" #include "ipc/ipc_message_macros.h" #include "url/gurl.h" -#include "url/ipc/url_param_traits.h" #define IPC_MESSAGE_START ContentSettingsMsgStart diff --git a/components/nacl.gyp b/components/nacl.gyp index 9ac06d2..fc65e43 100644 --- a/components/nacl.gyp +++ b/components/nacl.gyp @@ -464,7 +464,6 @@ ], 'dependencies': [ '../content/content.gyp:content_common', - '../url/ipc/url_ipc.gyp:url_ipc', ], }, ] diff --git a/components/nacl/common/nacl_host_messages.h b/components/nacl/common/nacl_host_messages.h index f7c5588..2e4d829 100644 --- a/components/nacl/common/nacl_host_messages.h +++ b/components/nacl/common/nacl_host_messages.h @@ -13,11 +13,11 @@ #include "components/nacl/common/nacl_types.h" #include "components/nacl/common/nacl_types_param_traits.h" #include "components/nacl/common/pnacl_types.h" +#include "content/public/common/common_param_traits.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_platform_file.h" #include "url/gurl.h" -#include "url/ipc/url_param_traits.h" #define IPC_MESSAGE_START NaClHostMsgStart diff --git a/components/nacl/loader/BUILD.gn b/components/nacl/loader/BUILD.gn index f1cb228..7b28bf0 100644 --- a/components/nacl/loader/BUILD.gn +++ b/components/nacl/loader/BUILD.gn @@ -117,7 +117,6 @@ if (is_linux) { "//crypto", "//ipc", "//sandbox/linux:sandbox_services", - "//url/ipc:url_ipc", ] cflags = [ "-fPIE" ] diff --git a/components/network_hints.gypi b/components/network_hints.gypi index a828c9f..418d79e 100644 --- a/components/network_hints.gypi +++ b/components/network_hints.gypi @@ -7,9 +7,6 @@ { # GN version: //components/network_hints/common 'target_name': 'network_hints_common', - - 'defines': [ 'URL_PARAM_TRAITS_FIX' ], - 'type': 'static_library', 'include_dirs': [ '..', @@ -17,7 +14,6 @@ 'dependencies': [ '../base/base.gyp:base', '../ui/accessibility/accessibility.gyp:accessibility', - '../url/ipc/url_ipc.gyp:url_ipc', ], 'sources': [ 'network_hints/common/network_hints_common.cc', diff --git a/components/network_hints/common/network_hints_messages.h b/components/network_hints/common/network_hints_messages.h index 82fce8f..fb037db 100644 --- a/components/network_hints/common/network_hints_messages.h +++ b/components/network_hints/common/network_hints_messages.h @@ -7,9 +7,9 @@ #include <vector> #include "components/network_hints/common/network_hints_common.h" +#include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" -#include "url/ipc/url_param_traits.h" // Singly-included section for custom IPC traits. #ifndef COMPONENTS_NETWORK_HINTS_COMMON_NETWORK_HINTS_MESSAGES_H_ diff --git a/components/network_hints/renderer/renderer_dns_prefetch.cc b/components/network_hints/renderer/renderer_dns_prefetch.cc index 1eed299..a28d020 100644 --- a/components/network_hints/renderer/renderer_dns_prefetch.cc +++ b/components/network_hints/renderer/renderer_dns_prefetch.cc @@ -12,7 +12,6 @@ #include "base/location.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" -#include "base/thread_task_runner_handle.h" #include "components/network_hints/common/network_hints_common.h" #include "components/network_hints/common/network_hints_messages.h" #include "components/network_hints/renderer/dns_prefetch_queue.h" diff --git a/components/password_manager.gypi b/components/password_manager.gypi index 17ab476..0b005bf 100644 --- a/components/password_manager.gypi +++ b/components/password_manager.gypi @@ -259,7 +259,6 @@ '../content/content.gyp:content_common', '../ipc/ipc.gyp:ipc', '../third_party/WebKit/public/blink.gyp:blink_minimal', - '../url/ipc/url_ipc.gyp:url_ipc', 'password_manager_core_common', ], 'include_dirs': [ @@ -282,7 +281,6 @@ '../content/content.gyp:content_common', '../ipc/ipc.gyp:ipc', '../third_party/WebKit/public/blink.gyp:blink', - '../url/ipc/url_ipc.gyp:url_ipc', 'password_manager_core_common', 'password_manager_content_common', ], diff --git a/components/password_manager/content/common/credential_manager_messages.h b/components/password_manager/content/common/credential_manager_messages.h index 6ac642f..694e1e58 100644 --- a/components/password_manager/content/common/credential_manager_messages.h +++ b/components/password_manager/content/common/credential_manager_messages.h @@ -10,11 +10,11 @@ #include "base/strings/string16.h" #include "components/password_manager/core/common/credential_manager_types.h" #include "content/public/common/common_param_traits.h" +#include "content/public/common/common_param_traits_macros.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" #include "third_party/WebKit/public/platform/WebCredentialManagerError.h" #include "url/gurl.h" -#include "url/ipc/url_param_traits.h" #define IPC_MESSAGE_START CredentialManagerMsgStart diff --git a/components/pdf.gypi b/components/pdf.gypi index 2d3eb2e..ead1646 100644 --- a/components/pdf.gypi +++ b/components/pdf.gypi @@ -14,7 +14,6 @@ '<(DEPTH)/content/content.gyp:content_common', '<(DEPTH)/ipc/ipc.gyp:ipc', '<(DEPTH)/url/url.gyp:url_lib', - '<(DEPTH)/url/ipc/url_ipc.gyp:url_ipc', ], 'sources': [ 'pdf/common/pdf_message_generator.cc', diff --git a/components/pdf/common/pdf_messages.h b/components/pdf/common/pdf_messages.h index 20420cd..72e974f 100644 --- a/components/pdf/common/pdf_messages.h +++ b/components/pdf/common/pdf_messages.h @@ -5,11 +5,11 @@ // Multiply-included file, no traditional include guard. #include <string.h> +#include "content/public/common/common_param_traits.h" #include "content/public/common/common_param_traits_macros.h" #include "content/public/common/referrer.h" #include "ipc/ipc_message_macros.h" #include "url/gurl.h" -#include "url/ipc/url_param_traits.h" #define IPC_MESSAGE_START PDFMsgStart diff --git a/components/safe_json/safe_json_parser_messages.h b/components/safe_json/safe_json_parser_messages.h index 6b405c7..ad92795 100644 --- a/components/safe_json/safe_json_parser_messages.h +++ b/components/safe_json/safe_json_parser_messages.h @@ -8,6 +8,8 @@ #include <vector> #include "base/strings/string16.h" +#include "content/public/common/common_param_traits.h" +#include "content/public/common/common_param_traits_macros.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" diff --git a/components/translate.gypi b/components/translate.gypi index dfe328f..a9a3cc8 100644 --- a/components/translate.gypi +++ b/components/translate.gypi @@ -172,8 +172,8 @@ 'translate_core_common', 'translate_core_language_detection', '../base/base.gyp:base', + '../content/content.gyp:content_common', '../ipc/ipc.gyp:ipc', - '../url/ipc/url_ipc.gyp:url_ipc', ], 'include_dirs': [ '..', diff --git a/components/translate/content/common/translate_messages.h b/components/translate/content/common/translate_messages.h index ef394f5..05d2313d1 100644 --- a/components/translate/content/common/translate_messages.h +++ b/components/translate/content/common/translate_messages.h @@ -6,9 +6,9 @@ #include "components/translate/core/common/language_detection_details.h" #include "components/translate/core/common/translate_errors.h" +#include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" -#include "url/ipc/url_param_traits.h" #define IPC_MESSAGE_START TranslateMsgStart diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc index f23cdee..50ff49c 100644 --- a/content/browser/frame_host/navigator_impl.cc +++ b/content/browser/frame_host/navigator_impl.cc @@ -42,7 +42,6 @@ #include "content/public/common/resource_response.h" #include "content/public/common/url_constants.h" #include "net/base/net_errors.h" -#include "url/url_constants.h" namespace content { @@ -291,8 +290,8 @@ bool NavigatorImpl::NavigateToEntry( // The renderer will reject IPC messages with URLs longer than // this limit, so don't attempt to navigate with a longer URL. - if (dest_url.spec().size() > url::kMaxURLChars) { - LOG(WARNING) << "Refusing to load URL as it exceeds " << url::kMaxURLChars + if (dest_url.spec().size() > kMaxURLChars) { + LOG(WARNING) << "Refusing to load URL as it exceeds " << kMaxURLChars << " characters."; return false; } diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index 9cabfd4..506b87f 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc @@ -51,7 +51,6 @@ #include "net/test/cert_test_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkColor.h" -#include "url/url_constants.h" namespace content { namespace { @@ -489,7 +488,7 @@ TEST_F(WebContentsImplTest, SimpleNavigation) { TEST_F(WebContentsImplTest, NavigateToExcessivelyLongURL) { // Construct a URL that's kMaxURLChars + 1 long of all 'a's. const GURL url(std::string("http://example.org/").append( - url::kMaxURLChars + 1, 'a')); + kMaxURLChars + 1, 'a')); controller().LoadURL( url, Referrer(), ui::PAGE_TRANSITION_GENERATED, std::string()); diff --git a/content/child/plugin_messages.h b/content/child/plugin_messages.h index 501dfdb..74bb5d32 100644 --- a/content/child/plugin_messages.h +++ b/content/child/plugin_messages.h @@ -11,13 +11,12 @@ #include "content/common/content_export.h" #include "content/common/content_param_traits.h" #include "content/common/cursors/webcursor.h" +#include "content/public/common/common_param_traits.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message_macros.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/ipc/gfx_param_traits.h" #include "ui/gfx/native_widget_types.h" -#include "ui/surface/transport_dib.h" -#include "url/ipc/url_param_traits.h" #if defined(OS_POSIX) #include "base/file_descriptor_posix.h" diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc index 72ba685..b8fd1421 100644 --- a/content/child/service_worker/service_worker_dispatcher.cc +++ b/content/child/service_worker/service_worker_dispatcher.cc @@ -25,7 +25,6 @@ #include "content/public/common/content_constants.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h" -#include "url/url_constants.h" using blink::WebServiceWorkerError; using blink::WebServiceWorkerProvider; @@ -111,8 +110,8 @@ void ServiceWorkerDispatcher::RegisterServiceWorker( WebServiceWorkerRegistrationCallbacks* callbacks) { DCHECK(callbacks); - if (pattern.possibly_invalid_spec().size() > url::kMaxURLChars || - script_url.possibly_invalid_spec().size() > url::kMaxURLChars) { + if (pattern.possibly_invalid_spec().size() > kMaxURLChars || + script_url.possibly_invalid_spec().size() > kMaxURLChars) { scoped_ptr<WebServiceWorkerRegistrationCallbacks> owned_callbacks(callbacks); std::string error_message(kServiceWorkerRegisterErrorPrefix); @@ -162,7 +161,7 @@ void ServiceWorkerDispatcher::GetRegistration( WebServiceWorkerGetRegistrationCallbacks* callbacks) { DCHECK(callbacks); - if (document_url.possibly_invalid_spec().size() > url::kMaxURLChars) { + if (document_url.possibly_invalid_spec().size() > kMaxURLChars) { scoped_ptr<WebServiceWorkerGetRegistrationCallbacks> owned_callbacks( callbacks); std::string error_message(kServiceWorkerGetRegistrationErrorPrefix); diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn index 63d416a..3854840 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn @@ -170,7 +170,6 @@ source_set("common") { "//ui/gfx/ipc", "//ui/shell_dialogs", "//url", - "//url/ipc:url_ipc", ] if (!is_ios) { diff --git a/content/common/accessibility_messages.h b/content/common/accessibility_messages.h index 660484c..5a0a598 100644 --- a/content/common/accessibility_messages.h +++ b/content/common/accessibility_messages.h @@ -8,6 +8,7 @@ #include "content/common/ax_content_node_data.h" #include "content/common/content_export.h" #include "content/common/view_message_enums.h" +#include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" #include "ipc/ipc_param_traits.h" diff --git a/content/common/appcache_messages.h b/content/common/appcache_messages.h index 95964f7..7e74848 100644 --- a/content/common/appcache_messages.h +++ b/content/common/appcache_messages.h @@ -9,7 +9,6 @@ #include <stdint.h> #include "content/common/appcache_interfaces.h" -#include "url/ipc/url_param_traits.h" #define IPC_MESSAGE_START AppCacheMsgStart diff --git a/content/common/browser_plugin/browser_plugin_messages.h b/content/common/browser_plugin/browser_plugin_messages.h index f85bafe..ef1640f 100644 --- a/content/common/browser_plugin/browser_plugin_messages.h +++ b/content/common/browser_plugin/browser_plugin_messages.h @@ -12,6 +12,7 @@ #include "content/common/content_param_traits.h" #include "content/common/cursors/webcursor.h" #include "content/common/edit_command.h" +#include "content/public/common/common_param_traits.h" #include "content/public/common/drop_data.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message_macros.h" @@ -25,6 +26,7 @@ #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/ipc/gfx_param_traits.h" +#include "url/gurl.h" #undef IPC_MESSAGE_EXPORT #define IPC_MESSAGE_EXPORT CONTENT_EXPORT diff --git a/content/common/clipboard_messages.h b/content/common/clipboard_messages.h index 36877f0..00a198c 100644 --- a/content/common/clipboard_messages.h +++ b/content/common/clipboard_messages.h @@ -10,16 +10,13 @@ #include <string> #include <vector> -#include "build/build_config.h" #include "base/memory/shared_memory.h" #include "base/strings/string16.h" #include "build/build_config.h" #include "content/common/clipboard_format.h" -#include "content/common/content_export.h" +#include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" -#include "ipc/param_traits_macros.h" #include "ui/base/clipboard/clipboard.h" -#include "url/ipc/url_param_traits.h" // Singly-included section for types and/or struct declarations. #ifndef CONTENT_COMMON_CLIPBOARD_MESSAGES_H_ diff --git a/content/common/common_param_traits_unittest.cc b/content/common/common_param_traits_unittest.cc index 648e6a6..03c19a0 100644 --- a/content/common/common_param_traits_unittest.cc +++ b/content/common/common_param_traits_unittest.cc @@ -20,6 +20,68 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/ipc/gfx_param_traits.h" +#include "url/gurl.h" + +// Tests that serialize/deserialize correctly understand each other +TEST(IPCMessageTest, Serialize) { + const char* serialize_cases[] = { + "http://www.google.com/", + "http://user:pass@host.com:888/foo;bar?baz#nop", + }; + + for (size_t i = 0; i < arraysize(serialize_cases); i++) { + GURL input(serialize_cases[i]); + IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); + IPC::ParamTraits<GURL>::Write(&msg, input); + + GURL output; + base::PickleIterator iter(msg); + EXPECT_TRUE(IPC::ParamTraits<GURL>::Read(&msg, &iter, &output)); + + // We want to test each component individually to make sure its range was + // correctly serialized and deserialized, not just the spec. + EXPECT_EQ(input.possibly_invalid_spec(), output.possibly_invalid_spec()); + EXPECT_EQ(input.is_valid(), output.is_valid()); + EXPECT_EQ(input.scheme(), output.scheme()); + EXPECT_EQ(input.username(), output.username()); + EXPECT_EQ(input.password(), output.password()); + EXPECT_EQ(input.host(), output.host()); + EXPECT_EQ(input.port(), output.port()); + EXPECT_EQ(input.path(), output.path()); + EXPECT_EQ(input.query(), output.query()); + EXPECT_EQ(input.ref(), output.ref()); + } + + // Test an excessively long GURL. + { + const std::string url = std::string("http://example.org/").append( + content::kMaxURLChars + 1, 'a'); + GURL input(url.c_str()); + IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); + IPC::ParamTraits<GURL>::Write(&msg, input); + + GURL output; + base::PickleIterator iter(msg); + EXPECT_TRUE(IPC::ParamTraits<GURL>::Read(&msg, &iter, &output)); + EXPECT_TRUE(output.is_empty()); + } + + // Test an invalid GURL. + { + IPC::Message msg; + msg.WriteString("#inva://idurl/"); + GURL output; + base::PickleIterator iter(msg); + EXPECT_FALSE(IPC::ParamTraits<GURL>::Read(&msg, &iter, &output)); + } + + // Also test the corrupt case. + IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); + msg.WriteInt(99); + GURL output; + base::PickleIterator iter(msg); + EXPECT_FALSE(IPC::ParamTraits<GURL>::Read(&msg, &iter, &output)); +} // Tests std::pair serialization TEST(IPCMessageTest, Pair) { diff --git a/content/common/devtools_messages.h b/content/common/devtools_messages.h index 4c7c24a..f61525c 100644 --- a/content/common/devtools_messages.h +++ b/content/common/devtools_messages.h @@ -43,6 +43,7 @@ #include <string> #include "content/common/content_export.h" +#include "content/public/common/common_param_traits.h" #include "content/public/common/console_message_level.h" #include "ipc/ipc_message_macros.h" diff --git a/content/common/dom_storage/dom_storage_messages.h b/content/common/dom_storage/dom_storage_messages.h index 59d22c9..7fd4426 100644 --- a/content/common/dom_storage/dom_storage_messages.h +++ b/content/common/dom_storage/dom_storage_messages.h @@ -7,11 +7,11 @@ #include <stdint.h> #include "content/common/dom_storage/dom_storage_types.h" +#include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_param_traits.h" #include "third_party/WebKit/public/platform/WebStorageArea.h" #include "url/gurl.h" -#include "url/ipc/url_param_traits.h" #define IPC_MESSAGE_START DOMStorageMsgStart diff --git a/content/common/drag_messages.h b/content/common/drag_messages.h index 8d2fd77..455bbff 100644 --- a/content/common/drag_messages.h +++ b/content/common/drag_messages.h @@ -6,6 +6,7 @@ // Multiply-included message file, hence no include guard. #include "content/common/drag_event_source_info.h" +#include "content/public/common/common_param_traits.h" #include "content/public/common/drop_data.h" #include "ipc/ipc_message_macros.h" #include "third_party/WebKit/public/web/WebDragOperation.h" diff --git a/content/common/fileapi/webblob_messages.h b/content/common/fileapi/webblob_messages.h index 603e501..0dd3141 100644 --- a/content/common/fileapi/webblob_messages.h +++ b/content/common/fileapi/webblob_messages.h @@ -8,9 +8,9 @@ #include <stddef.h> #include "content/common/content_export.h" +#include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #include "storage/common/data_element.h" -#include "url/ipc/url_param_traits.h" #undef IPC_MESSAGE_EXPORT #define IPC_MESSAGE_EXPORT CONTENT_EXPORT diff --git a/content/common/gpu/gpu_host_messages.h b/content/common/gpu/gpu_host_messages.h index 1428c8a..b0414ab 100644 --- a/content/common/gpu/gpu_host_messages.h +++ b/content/common/gpu/gpu_host_messages.h @@ -23,7 +23,6 @@ #include "ui/gfx/ipc/gfx_param_traits.h" #include "ui/gfx/native_widget_types.h" #include "url/gurl.h" -#include "url/ipc/url_param_traits.h" #if defined(OS_MACOSX) #include "content/common/gpu/accelerated_surface_buffers_swapped_params_mac.h" diff --git a/content/common/input_messages.h b/content/common/input_messages.h index cf4dc12..cef5568 100644 --- a/content/common/input_messages.h +++ b/content/common/input_messages.h @@ -24,6 +24,7 @@ #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" #include "content/common/input/synthetic_tap_gesture_params.h" #include "content/common/input/touch_action.h" +#include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #include "third_party/WebKit/public/web/WebInputEvent.h" #include "ui/events/ipc/latency_info_param_traits.h" diff --git a/content/content_browser.gypi b/content/content_browser.gypi index f2d4939..87cda02 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -63,7 +63,6 @@ '../ui/snapshot/snapshot.gyp:snapshot', '../ui/surface/surface.gyp:surface', '../ui/touch_selection/ui_touch_selection.gyp:ui_touch_selection', - '../url/ipc/url_ipc.gyp:url_ipc', 'app/resources/content_resources.gyp:content_resources', 'app/strings/content_strings.gyp:content_strings', 'browser/background_sync/background_sync_proto.gyp:background_sync_proto', diff --git a/content/content_child.gypi b/content/content_child.gypi index 80f4fe3..3feb6cf 100644 --- a/content/content_child.gypi +++ b/content/content_child.gypi @@ -24,7 +24,6 @@ '../ui/gfx/gfx.gyp:gfx', '../ui/gfx/gfx.gyp:gfx_geometry', '../url/url.gyp:url_lib', - '../url/ipc/url_ipc.gyp:url_ipc', 'app/resources/content_resources.gyp:content_resources', 'app/strings/content_strings.gyp:content_strings', 'content_common_mojo_bindings.gyp:content_common_mojo_bindings', diff --git a/content/content_common.gypi b/content/content_common.gypi index e472b9f..372bab7 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -46,7 +46,6 @@ '../ui/gl/gl.gyp:gl', '../ui/shell_dialogs/shell_dialogs.gyp:shell_dialogs', '../url/url.gyp:url_lib', - '../url/ipc/url_ipc.gyp:url_ipc', 'content.gyp:common_features', 'content_common_mojo_bindings.gyp:content_common_mojo_bindings', ], diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index 594d692..11078c4 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -47,7 +47,6 @@ '../ui/gfx/gfx.gyp:gfx_geometry', '../ui/native_theme/native_theme.gyp:native_theme', '../ui/surface/surface.gyp:surface', - '../url/ipc/url_ipc.gyp:url_ipc', '../v8/tools/gyp/v8.gyp:v8', 'content_common_mojo_bindings.gyp:content_common_mojo_bindings', ], diff --git a/content/content_shell.gypi b/content/content_shell.gypi index dd6fe7d..ee17cb3 100644 --- a/content/content_shell.gypi +++ b/content/content_shell.gypi @@ -71,7 +71,6 @@ '../ui/gfx/ipc/gfx_ipc.gyp:gfx_ipc', '../ui/gl/gl.gyp:gl', '../url/url.gyp:url_lib', - '../url/ipc/url_ipc.gyp:url_ipc', '../v8/tools/gyp/v8.gyp:v8', ], 'include_dirs': [ diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn index 9075452..83d47d6 100644 --- a/content/public/common/BUILD.gn +++ b/content/public/common/BUILD.gn @@ -88,7 +88,6 @@ source_set("common_sources") { public_deps = [ "//content/common", "//mojo/public/cpp/bindings", - "//url/ipc:url_ipc", ] deps = [ "//net", diff --git a/content/public/common/common_param_traits.cc b/content/public/common/common_param_traits.cc index f402cca..6a937c6 100644 --- a/content/public/common/common_param_traits.cc +++ b/content/public/common/common_param_traits.cc @@ -15,6 +15,47 @@ namespace IPC { +void ParamTraits<GURL>::Write(base::Pickle* m, const GURL& p) { + if (p.possibly_invalid_spec().length() > content::kMaxURLChars) { + m->WriteString(std::string()); + return; + } + + // Beware of print-parse inconsistency which would change an invalid + // URL into a valid one. Ideally, the message would contain this flag + // so that the read side could make the check, but performing it here + // avoids changing the on-the-wire representation of such a fundamental + // type as GURL. See https://crbug.com/166486 for additional work in + // this area. + if (!p.is_valid()) { + m->WriteString(std::string()); + return; + } + + m->WriteString(p.possibly_invalid_spec()); + // TODO(brettw) bug 684583: Add encoding for query params. +} + +bool ParamTraits<GURL>::Read(const base::Pickle* m, + base::PickleIterator* iter, + GURL* p) { + std::string s; + if (!iter->ReadString(&s) || s.length() > content::kMaxURLChars) { + *p = GURL(); + return false; + } + *p = GURL(s); + if (!s.empty() && !p->is_valid()) { + *p = GURL(); + return false; + } + return true; +} + +void ParamTraits<GURL>::Log(const GURL& p, std::string* l) { + l->append(p.spec()); +} + void ParamTraits<url::Origin>::Write(base::Pickle* m, const url::Origin& p) { WriteParam(m, p.unique()); WriteParam(m, p.scheme()); diff --git a/content/public/common/common_param_traits.h b/content/public/common/common_param_traits.h index 4e7610c..5f55f13 100644 --- a/content/public/common/common_param_traits.h +++ b/content/public/common/common_param_traits.h @@ -25,7 +25,7 @@ #include "ipc/ipc_message_utils.h" #include "ui/gfx/native_widget_types.h" #include "ui/surface/transport_dib.h" -#include "url/ipc/url_param_traits.h" +#include "url/gurl.h" #include "url/origin.h" #if defined(OS_WIN) @@ -45,6 +45,16 @@ class IPEndPoint; namespace IPC { template <> +struct CONTENT_EXPORT ParamTraits<GURL> { + typedef GURL param_type; + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> struct CONTENT_EXPORT ParamTraits<url::Origin> { typedef url::Origin param_type; static void Write(base::Pickle* m, const param_type& p); diff --git a/content/public/common/content_constants.cc b/content/public/common/content_constants.cc index e337433..3a97a09 100644 --- a/content/public/common/content_constants.cc +++ b/content/public/common/content_constants.cc @@ -26,6 +26,7 @@ const char kSilverlightPluginMimeTypePrefix[] = "application/x-silverlight"; const size_t kMaxRendererProcessCount = 82; const int kMaxSessionHistoryEntries = 50; const size_t kMaxTitleChars = 4 * 1024; +const size_t kMaxURLChars = 2 * 1024 * 1024; const size_t kMaxURLDisplayChars = 32 * 1024; #if defined(GOOGLE_CHROME_BUILD) diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index a628700..5c2cade 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -180,7 +180,6 @@ #include "third_party/WebKit/public/web/WebSurroundingText.h" #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" #include "third_party/WebKit/public/web/WebView.h" -#include "url/url_constants.h" #include "url/url_util.h" #if defined(ENABLE_PLUGINS) @@ -3661,7 +3660,7 @@ void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) { // in the context menu. // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large // data encoded images. We should have a way to save them. - if (params.src_url.spec().size() > url::kMaxURLChars) + if (params.src_url.spec().size() > kMaxURLChars) params.src_url = GURL(); context_menu_node_ = data.node; diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 34d50c8..6b7de27 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -175,7 +175,6 @@ #include "ui/gfx/geometry/rect_conversions.h" #include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/native_widget_types.h" -#include "url/url_constants.h" #include "v8/include/v8.h" #if defined(OS_ANDROID) @@ -1897,7 +1896,7 @@ void RenderViewImpl::UpdateTargetURL(const GURL& url, } else { // URLs larger than |kMaxURLChars| cannot be sent through IPC - // see |ParamTraits<GURL>|. - if (latest_url.possibly_invalid_spec().size() > url::kMaxURLChars) + if (latest_url.possibly_invalid_spec().size() > kMaxURLChars) latest_url = GURL(); Send(new ViewHostMsg_UpdateTargetURL(routing_id(), latest_url)); target_url_ = latest_url; diff --git a/content/shell/common/layout_test/layout_test_messages.h b/content/shell/common/layout_test/layout_test_messages.h index 0ca3309..b81b0bc 100644 --- a/content/shell/common/layout_test/layout_test_messages.h +++ b/content/shell/common/layout_test/layout_test_messages.h @@ -6,11 +6,11 @@ #include <string> #include <vector> +#include "content/public/common/common_param_traits.h" #include "content/public/common/permission_status.mojom.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_platform_file.h" #include "url/gurl.h" -#include "url/ipc/url_param_traits.h" #define IPC_MESSAGE_START LayoutTestMsgStart diff --git a/extensions/common/extension_utility_messages.h b/extensions/common/extension_utility_messages.h index 24df23f..cfaf273 100644 --- a/extensions/common/extension_utility_messages.h +++ b/extensions/common/extension_utility_messages.h @@ -10,7 +10,6 @@ #include "ipc/ipc_message_macros.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/ipc/gfx_param_traits.h" -#include "url/ipc/url_param_traits.h" #define IPC_MESSAGE_START ExtensionUtilityMsgStart diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index 855f50b..82e7d6a 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -68,7 +68,6 @@ '../url/url.gyp:url_lib', '../third_party/boringssl/boringssl.gyp:boringssl', '../third_party/libxml/libxml.gyp:libxml', - '../url/ipc/url_ipc.gyp:url_ipc', 'common/api/api.gyp:extensions_api', 'extensions_resources.gyp:extensions_resources', 'extensions_strings.gyp:extensions_strings', @@ -200,13 +199,9 @@ # GN version: //extensions/renderer 'target_name': 'extensions_renderer', 'type': 'static_library', - - 'defines': [ 'URL_PARAM_TRAITS_FIX' ], - 'dependencies': [ 'extensions_resources.gyp:extensions_resources', '../components/components.gyp:guest_view_renderer', - '../content/content.gyp:content_common', '../content/content.gyp:content_resources', '../gin/gin.gyp:gin', '../mojo/mojo_public.gyp:mojo_js_bindings', diff --git a/extensions/utility/unpacker.cc b/extensions/utility/unpacker.cc index 083cb72..be0a4b5 100644 --- a/extensions/utility/unpacker.cc +++ b/extensions/utility/unpacker.cc @@ -20,6 +20,7 @@ #include "base/threading/thread.h" #include "base/values.h" #include "content/public/child/image_decoder_utils.h" +#include "content/public/common/common_param_traits.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" #include "extensions/common/extension_l10n_util.h" diff --git a/url/BUILD.gn b/url/BUILD.gn index 460cbd3..6924784 100644 --- a/url/BUILD.gn +++ b/url/BUILD.gn @@ -132,7 +132,6 @@ if (!is_android) { deps = [ ":url", - "ipc:url_ipc", "//base", "//base/test:run_all_unittests", "//testing/gtest", diff --git a/url/ipc/BUILD.gn b/url/ipc/BUILD.gn deleted file mode 100644 index 1edbe20..0000000 --- a/url/ipc/BUILD.gn +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 2016 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. - -import("//testing/test.gni") - -component("url_ipc") { - sources = [ - "url_ipc_export.h", - "url_param_traits.cc", - "url_param_traits.h", - ] - - defines = [ "URL_IPC_IMPLEMENTATION" ] - - public_deps = [ - "//ipc", - "//url", - ] - deps = [ - "//base", - ] -} - -test("url_ipc_unittests") { - sources = [ - "url_param_traits_unittest.cc", - ] - - deps = [ - ":url_ipc", - "//base", - "//base/test:run_all_unittests", - "//ipc:test_support", - "//testing/gtest", - "//url:url", - ] -} diff --git a/url/ipc/url_ipc.gyp b/url/ipc/url_ipc.gyp deleted file mode 100644 index de0f76f..0000000 --- a/url/ipc/url_ipc.gyp +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2016 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. - -{ - 'variables': { - 'chromium_code': 1, - }, - 'targets': [ - { - # GN version: //url/ipc - 'target_name': 'url_ipc', - 'type': '<(component)', - 'dependencies': [ - '../../base/base.gyp:base', - '../../ipc/ipc.gyp:ipc', - '../../url/url.gyp:url_lib', - ], - 'defines': [ - 'URL_IPC_IMPLEMENTATION', - 'URL_PARAM_TRAITS_FIX', - ], - 'include_dirs': [ - '../..', - ], - 'sources': [ - 'url_ipc_export.h', - 'url_param_traits.cc', - 'url_param_traits.h', - ], - }, - { - 'target_name': 'url_ipc_unittests', - 'type': 'executable', - 'dependencies': [ - '../../base/base.gyp:run_all_unittests', - '../../ipc/ipc.gyp:test_support_ipc', - '../../testing/gtest.gyp:gtest', - '../url.gyp:url_lib', - 'url_ipc', - ], - 'sources': [ 'url_param_traits_unittest.cc' ], - }, - ], -} diff --git a/url/ipc/url_ipc_export.h b/url/ipc/url_ipc_export.h deleted file mode 100644 index 1da0fa6..0000000 --- a/url/ipc/url_ipc_export.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 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 URL_IPC_EXPORT_H_ -#define URL_IPC_EXPORT_H_ - -#if defined(COMPONENT_BUILD) -#if defined(WIN32) - -#if defined(URL_IPC_IMPLEMENTATION) -#define URL_IPC_EXPORT __declspec(dllexport) -#else -#define URL_IPC_EXPORT __declspec(dllimport) -#endif // defined(URL_IPC_IMPLEMENTATION) - -#else // defined(WIN32) -#if defined(URL_IPC_IMPLEMENTATION) -#define URL_IPC_EXPORT __attribute__((visibility("default"))) -#else -#define URL_IPC_EXPORT -#endif -#endif - -#else // defined(COMPONENT_BUILD) -#define URL_IPC_EXPORT -#endif - -#endif // URL_IPC_EXPORT_H_ diff --git a/url/ipc/url_param_traits.cc b/url/ipc/url_param_traits.cc deleted file mode 100644 index e40ae8f..0000000 --- a/url/ipc/url_param_traits.cc +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2016 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 "url/ipc/url_param_traits.h" - -#include "url/gurl.h" - -namespace IPC { - -void ParamTraits<GURL>::Write(base::Pickle* m, const GURL& p) { - if (p.possibly_invalid_spec().length() > url::kMaxURLChars) { - m->WriteString(std::string()); - return; - } - - // Beware of print-parse inconsistency which would change an invalid - // URL into a valid one. Ideally, the message would contain this flag - // so that the read side could make the check, but performing it here - // avoids changing the on-the-wire representation of such a fundamental - // type as GURL. See https://crbug.com/166486 for additional work in - // this area. - if (!p.is_valid()) { - m->WriteString(std::string()); - return; - } - - m->WriteString(p.possibly_invalid_spec()); - // TODO(brettw) bug 684583: Add encoding for query params. -} - -bool ParamTraits<GURL>::Read(const base::Pickle* m, - base::PickleIterator* iter, - GURL* p) { - std::string s; - if (!iter->ReadString(&s) || s.length() > url::kMaxURLChars) { - *p = GURL(); - return false; - } - *p = GURL(s); - if (!s.empty() && !p->is_valid()) { - *p = GURL(); - return false; - } - return true; -} - -void ParamTraits<GURL>::Log(const GURL& p, std::string* l) { - l->append(p.spec()); -} - -} // namespace IPC diff --git a/url/ipc/url_param_traits.h b/url/ipc/url_param_traits.h deleted file mode 100644 index 4ef2ea6..0000000 --- a/url/ipc/url_param_traits.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2016 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 URL_IPC_URL_PARAM_TRAITS_H_ -#define URL_IPC_URL_PARAM_TRAITS_H_ - -#include "ipc/ipc_message_utils.h" -#include "url/gurl.h" -#include "url/ipc/url_ipc_export.h" - -#ifndef URL_PARAM_TRAITS_FIX -// #error yo -#endif - -namespace IPC { - -template <> -struct URL_IPC_EXPORT ParamTraits<GURL> { - typedef GURL param_type; - static void Write(base::Pickle* m, const param_type& p); - static bool Read(const base::Pickle* m, - base::PickleIterator* iter, - param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -} // namespace IPC - -#endif // URL_IPC_URL_PARAM_TRAITS_H_ diff --git a/url/ipc/url_param_traits_unittest.cc b/url/ipc/url_param_traits_unittest.cc deleted file mode 100644 index 16eeab0..0000000 --- a/url/ipc/url_param_traits_unittest.cc +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2016 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 <string> - -#include "ipc/ipc_message.h" -#include "ipc/ipc_message_utils.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "url/gurl.h" -#include "url/ipc/url_param_traits.h" - -// Tests that serialize/deserialize correctly understand each other. -TEST(IPCMessageTest, Serialize) { - const char* serialize_cases[] = { - "http://www.google.com/", - "http://user:pass@host.com:888/foo;bar?baz#nop", - }; - - for (size_t i = 0; i < arraysize(serialize_cases); i++) { - GURL input(serialize_cases[i]); - IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); - IPC::ParamTraits<GURL>::Write(&msg, input); - - GURL output; - base::PickleIterator iter(msg); - EXPECT_TRUE(IPC::ParamTraits<GURL>::Read(&msg, &iter, &output)); - - // We want to test each component individually to make sure its range was - // correctly serialized and deserialized, not just the spec. - EXPECT_EQ(input.possibly_invalid_spec(), output.possibly_invalid_spec()); - EXPECT_EQ(input.is_valid(), output.is_valid()); - EXPECT_EQ(input.scheme(), output.scheme()); - EXPECT_EQ(input.username(), output.username()); - EXPECT_EQ(input.password(), output.password()); - EXPECT_EQ(input.host(), output.host()); - EXPECT_EQ(input.port(), output.port()); - EXPECT_EQ(input.path(), output.path()); - EXPECT_EQ(input.query(), output.query()); - EXPECT_EQ(input.ref(), output.ref()); - } - - // Test an excessively long GURL. - { - const std::string url = std::string("http://example.org/").append( - url::kMaxURLChars + 1, 'a'); - GURL input(url.c_str()); - IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); - IPC::ParamTraits<GURL>::Write(&msg, input); - - GURL output; - base::PickleIterator iter(msg); - EXPECT_TRUE(IPC::ParamTraits<GURL>::Read(&msg, &iter, &output)); - EXPECT_TRUE(output.is_empty()); - } - - // Test an invalid GURL. - { - IPC::Message msg; - msg.WriteString("#inva://idurl/"); - GURL output; - base::PickleIterator iter(msg); - EXPECT_FALSE(IPC::ParamTraits<GURL>::Read(&msg, &iter, &output)); - } - - // Also test the corrupt case. - IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); - msg.WriteInt(99); - GURL output; - base::PickleIterator iter(msg); - EXPECT_FALSE(IPC::ParamTraits<GURL>::Read(&msg, &iter, &output)); -} diff --git a/url/url_constants.cc b/url/url_constants.cc index 0388fbc..2dc1478 100644 --- a/url/url_constants.cc +++ b/url/url_constants.cc @@ -25,6 +25,4 @@ const char kWssScheme[] = "wss"; const char kStandardSchemeSeparator[] = "://"; -const size_t kMaxURLChars = 2 * 1024 * 1024; - } // namespace url diff --git a/url/url_constants.h b/url/url_constants.h index fa71164..c48dafc 100644 --- a/url/url_constants.h +++ b/url/url_constants.h @@ -5,8 +5,6 @@ #ifndef URL_URL_CONSTANTS_H_ #define URL_URL_CONSTANTS_H_ -#include <stddef.h> - #include "url/url_export.h" namespace url { @@ -32,8 +30,6 @@ URL_EXPORT extern const char kWssScheme[]; // Used to separate a standard scheme and the hostname: "://". URL_EXPORT extern const char kStandardSchemeSeparator[]; -URL_EXPORT extern const size_t kMaxURLChars; - } // namespace url #endif // URL_URL_CONSTANTS_H_ |