summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn1
-rw-r--r--android_webview/android_webview.gyp1
-rw-r--r--chrome/browser/chrome_content_browser_client.cc1
-rw-r--r--chrome/chrome_common.gypi6
-rw-r--r--chrome/common/common_message_generator.cc1
-rw-r--r--chrome/common/common_message_generator.h4
-rw-r--r--chrome/common/importer/profile_import_process_messages.h2
-rw-r--r--chrome/common/prerender_messages.h2
-rw-r--r--chrome/common/render_messages.h8
-rw-r--r--chrome/renderer/chrome_render_frame_observer.cc2
-rw-r--r--components/autofill.gypi1
-rw-r--r--components/content_settings.gypi2
-rw-r--r--components/content_settings/content/common/content_settings_messages.h3
-rw-r--r--components/nacl.gyp1
-rw-r--r--components/nacl/common/nacl_host_messages.h2
-rw-r--r--components/nacl/loader/BUILD.gn1
-rw-r--r--components/network_hints.gypi4
-rw-r--r--components/network_hints/common/network_hints_messages.h2
-rw-r--r--components/network_hints/renderer/renderer_dns_prefetch.cc1
-rw-r--r--components/password_manager.gypi2
-rw-r--r--components/password_manager/content/common/credential_manager_messages.h2
-rw-r--r--components/pdf.gypi1
-rw-r--r--components/pdf/common/pdf_messages.h2
-rw-r--r--components/safe_json/safe_json_parser_messages.h2
-rw-r--r--components/translate.gypi2
-rw-r--r--components/translate/content/common/translate_messages.h2
-rw-r--r--content/browser/frame_host/navigator_impl.cc5
-rw-r--r--content/browser/web_contents/web_contents_impl_unittest.cc3
-rw-r--r--content/child/plugin_messages.h3
-rw-r--r--content/child/service_worker/service_worker_dispatcher.cc7
-rw-r--r--content/common/BUILD.gn1
-rw-r--r--content/common/accessibility_messages.h1
-rw-r--r--content/common/appcache_messages.h1
-rw-r--r--content/common/browser_plugin/browser_plugin_messages.h2
-rw-r--r--content/common/clipboard_messages.h5
-rw-r--r--content/common/common_param_traits_unittest.cc62
-rw-r--r--content/common/devtools_messages.h1
-rw-r--r--content/common/dom_storage/dom_storage_messages.h2
-rw-r--r--content/common/drag_messages.h1
-rw-r--r--content/common/fileapi/webblob_messages.h2
-rw-r--r--content/common/gpu/gpu_host_messages.h1
-rw-r--r--content/common/input_messages.h1
-rw-r--r--content/content_browser.gypi1
-rw-r--r--content/content_child.gypi1
-rw-r--r--content/content_common.gypi1
-rw-r--r--content/content_renderer.gypi1
-rw-r--r--content/content_shell.gypi1
-rw-r--r--content/public/common/BUILD.gn1
-rw-r--r--content/public/common/common_param_traits.cc41
-rw-r--r--content/public/common/common_param_traits.h12
-rw-r--r--content/public/common/content_constants.cc1
-rw-r--r--content/renderer/render_frame_impl.cc3
-rw-r--r--content/renderer/render_view_impl.cc3
-rw-r--r--content/shell/common/layout_test/layout_test_messages.h2
-rw-r--r--extensions/common/extension_utility_messages.h1
-rw-r--r--extensions/extensions.gyp5
-rw-r--r--extensions/utility/unpacker.cc1
-rw-r--r--url/BUILD.gn1
-rw-r--r--url/ipc/BUILD.gn38
-rw-r--r--url/ipc/url_ipc.gyp45
-rw-r--r--url/ipc/url_ipc_export.h29
-rw-r--r--url/ipc/url_param_traits.cc52
-rw-r--r--url/ipc/url_param_traits.h30
-rw-r--r--url/ipc/url_param_traits_unittest.cc72
-rw-r--r--url/url_constants.cc2
-rw-r--r--url/url_constants.h4
66 files changed, 351 insertions, 153 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 58eb32f..a29d870 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -195,6 +195,7 @@ 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 8378d0e..f0cd0e0 100644
--- a/android_webview/android_webview.gyp
+++ b/android_webview/android_webview.gyp
@@ -262,6 +262,7 @@
'../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 3e884bb..c90d3e6 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -18,6 +18,7 @@
#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 dc732b1..9328cf7 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -358,6 +358,7 @@
'<(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)'
@@ -496,7 +497,10 @@
],
}, {
# Non-Android.
- 'sources': [ '<@(chrome_common_importer_sources)' ]
+ 'sources': [ '<@(chrome_common_importer_sources)' ],
+ 'dependencies': [
+ '<(DEPTH)/url/ipc/url_ipc.gyp:url_ipc',
+ ],
}],
['OS=="win"', {
'include_dirs': [
diff --git a/chrome/common/common_message_generator.cc b/chrome/common/common_message_generator.cc
index 959f148..eb1dda2 100644
--- a/chrome/common/common_message_generator.cc
+++ b/chrome/common/common_message_generator.cc
@@ -36,4 +36,3 @@ 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 e7a3f68..13238da 100644
--- a/chrome/common/common_message_generator.h
+++ b/chrome/common/common_message_generator.h
@@ -6,11 +6,14 @@
#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"
@@ -33,4 +36,3 @@
#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 63e3708..e53c171 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 fc373fe..a9ca9f6 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 a34683a..74efb68 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -11,19 +11,23 @@
#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 af94139..b49f1be 100644
--- a/chrome/renderer/chrome_render_frame_observer.cc
+++ b/chrome/renderer/chrome_render_frame_observer.cc
@@ -12,6 +12,7 @@
#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"
@@ -22,6 +23,7 @@
#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 60a1d56..ac1660d 100644
--- a/components/autofill.gypi
+++ b/components/autofill.gypi
@@ -325,6 +325,7 @@
'../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 1d9b317..243fcce 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 3b7225c..63a64c0 100644
--- a/components/content_settings/content/common/content_settings_messages.h
+++ b/components/content_settings/content/common/content_settings_messages.h
@@ -5,10 +5,9 @@
// 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 fc65e43..9ac06d2 100644
--- a/components/nacl.gyp
+++ b/components/nacl.gyp
@@ -464,6 +464,7 @@
],
'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 2e4d829..f7c5588 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 7b28bf0..f1cb228 100644
--- a/components/nacl/loader/BUILD.gn
+++ b/components/nacl/loader/BUILD.gn
@@ -117,6 +117,7 @@ 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 418d79e..a828c9f 100644
--- a/components/network_hints.gypi
+++ b/components/network_hints.gypi
@@ -7,6 +7,9 @@
{
# GN version: //components/network_hints/common
'target_name': 'network_hints_common',
+
+ 'defines': [ 'URL_PARAM_TRAITS_FIX' ],
+
'type': 'static_library',
'include_dirs': [
'..',
@@ -14,6 +17,7 @@
'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 fb037db..82fce8f 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 a28d020..1eed299 100644
--- a/components/network_hints/renderer/renderer_dns_prefetch.cc
+++ b/components/network_hints/renderer/renderer_dns_prefetch.cc
@@ -12,6 +12,7 @@
#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 0b005bf..17ab476 100644
--- a/components/password_manager.gypi
+++ b/components/password_manager.gypi
@@ -259,6 +259,7 @@
'../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': [
@@ -281,6 +282,7 @@
'../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 694e1e58..6ac642f 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 ead1646..2d3eb2e 100644
--- a/components/pdf.gypi
+++ b/components/pdf.gypi
@@ -14,6 +14,7 @@
'<(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 72e974f..20420cd 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 ad92795..6b405c7 100644
--- a/components/safe_json/safe_json_parser_messages.h
+++ b/components/safe_json/safe_json_parser_messages.h
@@ -8,8 +8,6 @@
#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 a9a3cc8..dfe328f 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 05d2313d1..ef394f5 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 50ff49c..f23cdee 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -42,6 +42,7 @@
#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 {
@@ -290,8 +291,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() > kMaxURLChars) {
- LOG(WARNING) << "Refusing to load URL as it exceeds " << kMaxURLChars
+ if (dest_url.spec().size() > url::kMaxURLChars) {
+ LOG(WARNING) << "Refusing to load URL as it exceeds " << url::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 506b87f..9cabfd4 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -51,6 +51,7 @@
#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 {
@@ -488,7 +489,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(
- kMaxURLChars + 1, 'a'));
+ url::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 74bb5d32..501dfdb 100644
--- a/content/child/plugin_messages.h
+++ b/content/child/plugin_messages.h
@@ -11,12 +11,13 @@
#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 b8fd1421..72ba685 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -25,6 +25,7 @@
#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;
@@ -110,8 +111,8 @@ void ServiceWorkerDispatcher::RegisterServiceWorker(
WebServiceWorkerRegistrationCallbacks* callbacks) {
DCHECK(callbacks);
- if (pattern.possibly_invalid_spec().size() > kMaxURLChars ||
- script_url.possibly_invalid_spec().size() > kMaxURLChars) {
+ if (pattern.possibly_invalid_spec().size() > url::kMaxURLChars ||
+ script_url.possibly_invalid_spec().size() > url::kMaxURLChars) {
scoped_ptr<WebServiceWorkerRegistrationCallbacks>
owned_callbacks(callbacks);
std::string error_message(kServiceWorkerRegisterErrorPrefix);
@@ -161,7 +162,7 @@ void ServiceWorkerDispatcher::GetRegistration(
WebServiceWorkerGetRegistrationCallbacks* callbacks) {
DCHECK(callbacks);
- if (document_url.possibly_invalid_spec().size() > kMaxURLChars) {
+ if (document_url.possibly_invalid_spec().size() > url::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 3854840..63d416a 100644
--- a/content/common/BUILD.gn
+++ b/content/common/BUILD.gn
@@ -170,6 +170,7 @@ 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 5a0a598..660484c 100644
--- a/content/common/accessibility_messages.h
+++ b/content/common/accessibility_messages.h
@@ -8,7 +8,6 @@
#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 7e74848..95964f7 100644
--- a/content/common/appcache_messages.h
+++ b/content/common/appcache_messages.h
@@ -9,6 +9,7 @@
#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 ef1640f..f85bafe 100644
--- a/content/common/browser_plugin/browser_plugin_messages.h
+++ b/content/common/browser_plugin/browser_plugin_messages.h
@@ -12,7 +12,6 @@
#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"
@@ -26,7 +25,6 @@
#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 00a198c..36877f0 100644
--- a/content/common/clipboard_messages.h
+++ b/content/common/clipboard_messages.h
@@ -10,13 +10,16 @@
#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/public/common/common_param_traits.h"
+#include "content/common/content_export.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 03c19a0..648e6a6 100644
--- a/content/common/common_param_traits_unittest.cc
+++ b/content/common/common_param_traits_unittest.cc
@@ -20,68 +20,6 @@
#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 f61525c..4c7c24a 100644
--- a/content/common/devtools_messages.h
+++ b/content/common/devtools_messages.h
@@ -43,7 +43,6 @@
#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 7fd4426..59d22c9 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 455bbff..8d2fd77 100644
--- a/content/common/drag_messages.h
+++ b/content/common/drag_messages.h
@@ -6,7 +6,6 @@
// 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 0dd3141..603e501 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 b0414ab..1428c8a 100644
--- a/content/common/gpu/gpu_host_messages.h
+++ b/content/common/gpu/gpu_host_messages.h
@@ -23,6 +23,7 @@
#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 cef5568..cf4dc12 100644
--- a/content/common/input_messages.h
+++ b/content/common/input_messages.h
@@ -24,7 +24,6 @@
#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 87cda02..f2d4939 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -63,6 +63,7 @@
'../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 3feb6cf..80f4fe3 100644
--- a/content/content_child.gypi
+++ b/content/content_child.gypi
@@ -24,6 +24,7 @@
'../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 372bab7..e472b9f 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -46,6 +46,7 @@
'../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 11078c4..594d692 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -47,6 +47,7 @@
'../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 ee17cb3..dd6fe7d 100644
--- a/content/content_shell.gypi
+++ b/content/content_shell.gypi
@@ -71,6 +71,7 @@
'../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 83d47d6..9075452 100644
--- a/content/public/common/BUILD.gn
+++ b/content/public/common/BUILD.gn
@@ -88,6 +88,7 @@ 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 6a937c6..f402cca 100644
--- a/content/public/common/common_param_traits.cc
+++ b/content/public/common/common_param_traits.cc
@@ -15,47 +15,6 @@
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 5f55f13..4e7610c 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/gurl.h"
+#include "url/ipc/url_param_traits.h"
#include "url/origin.h"
#if defined(OS_WIN)
@@ -45,16 +45,6 @@ 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 3a97a09..e337433 100644
--- a/content/public/common/content_constants.cc
+++ b/content/public/common/content_constants.cc
@@ -26,7 +26,6 @@ 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 5c2cade..a628700 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -180,6 +180,7 @@
#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)
@@ -3660,7 +3661,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() > kMaxURLChars)
+ if (params.src_url.spec().size() > url::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 6b7de27..34d50c8 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -175,6 +175,7 @@
#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)
@@ -1896,7 +1897,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() > kMaxURLChars)
+ if (latest_url.possibly_invalid_spec().size() > url::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 b81b0bc..0ca3309 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 cfaf273..24df23f 100644
--- a/extensions/common/extension_utility_messages.h
+++ b/extensions/common/extension_utility_messages.h
@@ -10,6 +10,7 @@
#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 82e7d6a..855f50b 100644
--- a/extensions/extensions.gyp
+++ b/extensions/extensions.gyp
@@ -68,6 +68,7 @@
'../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',
@@ -199,9 +200,13 @@
# 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 be0a4b5..083cb72 100644
--- a/extensions/utility/unpacker.cc
+++ b/extensions/utility/unpacker.cc
@@ -20,7 +20,6 @@
#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 6924784..460cbd3 100644
--- a/url/BUILD.gn
+++ b/url/BUILD.gn
@@ -132,6 +132,7 @@ 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
new file mode 100644
index 0000000..1edbe20
--- /dev/null
+++ b/url/ipc/BUILD.gn
@@ -0,0 +1,38 @@
+# 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
new file mode 100644
index 0000000..de0f76f
--- /dev/null
+++ b/url/ipc/url_ipc.gyp
@@ -0,0 +1,45 @@
+# 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
new file mode 100644
index 0000000..1da0fa6
--- /dev/null
+++ b/url/ipc/url_ipc_export.h
@@ -0,0 +1,29 @@
+// 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
new file mode 100644
index 0000000..e40ae8f
--- /dev/null
+++ b/url/ipc/url_param_traits.cc
@@ -0,0 +1,52 @@
+// 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
new file mode 100644
index 0000000..4ef2ea6
--- /dev/null
+++ b/url/ipc/url_param_traits.h
@@ -0,0 +1,30 @@
+// 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
new file mode 100644
index 0000000..16eeab0
--- /dev/null
+++ b/url/ipc/url_param_traits_unittest.cc
@@ -0,0 +1,72 @@
+// 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 2dc1478..0388fbc 100644
--- a/url/url_constants.cc
+++ b/url/url_constants.cc
@@ -25,4 +25,6 @@ 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 c48dafc..fa71164 100644
--- a/url/url_constants.h
+++ b/url/url_constants.h
@@ -5,6 +5,8 @@
#ifndef URL_URL_CONSTANTS_H_
#define URL_URL_CONSTANTS_H_
+#include <stddef.h>
+
#include "url/url_export.h"
namespace url {
@@ -30,6 +32,8 @@ 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_