summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-25 15:04:22 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-25 15:04:22 +0000
commit9d8ea308b93fdd1b78cded9e604268e9752e2909 (patch)
tree5a4e49524786f0fb259726e0f92bb1fd64ed01ac /chrome
parent20cd74f9317b37e8faee699dfdf7dcf2a7eea12c (diff)
downloadchromium_src-9d8ea308b93fdd1b78cded9e604268e9752e2909.zip
chromium_src-9d8ea308b93fdd1b78cded9e604268e9752e2909.tar.gz
chromium_src-9d8ea308b93fdd1b78cded9e604268e9752e2909.tar.bz2
Cleanup the IPC param traits structure:
-traits that are only used by chrome should be in chrome -traits that aren't used by chrome shouldn't be in content/public -use macros for serialization where possible -traits that are only used by one message file should just be listed in it -get rid of webkit_param_traits since it's not needed anymore. It was added as a hack to keep npchrome_frame.dll's size small by giving a hint to the MSVS linker, but now that there's more split between the message files because of the content split it's not necessary anymore. I've verified that npchrome_frame.dll's size (Release, non-component) size doesn't change. Review URL: https://codereview.chromium.org/10980010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158570 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/component_updater/component_updater_service.cc1
-rw-r--r--chrome/browser/importer/profile_import_process_messages.h2
-rw-r--r--chrome/common/autofill_messages.h2
-rw-r--r--chrome/common/automation_messages.cc203
-rw-r--r--chrome/common/automation_messages.h25
-rw-r--r--chrome/common/render_messages.h1
-rw-r--r--chrome/renderer/autofill/form_autocomplete_browsertest.cc1
-rw-r--r--chrome/renderer/page_click_tracker.cc1
-rw-r--r--chrome/renderer/plugins/plugin_placeholder.cc1
9 files changed, 199 insertions, 38 deletions
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index cbf3e99..f005a44 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -33,6 +33,7 @@
#include "net/base/load_flags.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_fetcher_delegate.h"
+#include "net/url_request/url_request_status.h"
using content::BrowserThread;
using content::UtilityProcessHost;
diff --git a/chrome/browser/importer/profile_import_process_messages.h b/chrome/browser/importer/profile_import_process_messages.h
index 9a6ed03..d2300dd 100644
--- a/chrome/browser/importer/profile_import_process_messages.h
+++ b/chrome/browser/importer/profile_import_process_messages.h
@@ -13,8 +13,8 @@
#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/importer/profile_writer.h"
#include "chrome/browser/search_engines/template_url.h"
+#include "chrome/common/common_param_traits_macros.h"
#include "content/public/common/common_param_traits.h"
-#include "content/public/common/webkit_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
#include "webkit/forms/password_form.h"
diff --git a/chrome/common/autofill_messages.h b/chrome/common/autofill_messages.h
index 4317b94..e23d510 100644
--- a/chrome/common/autofill_messages.h
+++ b/chrome/common/autofill_messages.h
@@ -7,7 +7,7 @@
#include <string>
#include "base/time.h"
-#include "content/public/common/webkit_param_traits.h"
+#include "chrome/common/common_param_traits_macros.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
#include "ui/gfx/rect.h"
diff --git a/chrome/common/automation_messages.cc b/chrome/common/automation_messages.cc
index e5b59a1..8aadece 100644
--- a/chrome/common/automation_messages.cc
+++ b/chrome/common/automation_messages.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/public/common/webkit_param_traits.h"
#include "ui/base/models/menu_model.h"
// Get basic type definitions.
@@ -53,7 +52,36 @@ ContextMenuModel::Item::Item()
namespace IPC {
-// static
+void ParamTraits<AutomationMouseEvent>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, std::string(reinterpret_cast<const char*>(&p.mouse_event),
+ sizeof(p.mouse_event)));
+ WriteParam(m, p.location_script_chain);
+}
+
+bool ParamTraits<AutomationMouseEvent>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* p) {
+ std::string mouse_event;
+ if (!ReadParam(m, iter, &mouse_event))
+ return false;
+ memcpy(&p->mouse_event, mouse_event.c_str(), mouse_event.length());
+ if (!ReadParam(m, iter, &p->location_script_chain))
+ return false;
+ return true;
+}
+
+void ParamTraits<AutomationMouseEvent>::Log(const param_type& p,
+ std::string* l) {
+ l->append("(");
+ LogParam(std::string(reinterpret_cast<const char*>(&p.mouse_event),
+ sizeof(p.mouse_event)),
+ l);
+ l->append(", ");
+ LogParam(p.location_script_chain, l);
+ l->append(")");
+}
+
void ParamTraits<ContextMenuModel>::Write(Message* m,
const param_type& p) {
WriteParam(m, p.items.size());
@@ -70,7 +98,6 @@ void ParamTraits<ContextMenuModel>::Write(Message* m,
}
}
-// static
bool ParamTraits<ContextMenuModel>::Read(const Message* m,
PickleIterator* iter,
param_type* p) {
@@ -107,7 +134,6 @@ bool ParamTraits<ContextMenuModel>::Read(const Message* m,
return true;
}
-// static
void ParamTraits<ContextMenuModel>::Log(const param_type& p,
std::string* l) {
l->append("(");
@@ -134,37 +160,158 @@ void ParamTraits<ContextMenuModel>::Log(const param_type& p,
l->append(")");
}
-// static
-void ParamTraits<AutomationMouseEvent>::Write(Message* m,
- const param_type& p) {
- WriteParam(m, std::string(reinterpret_cast<const char*>(&p.mouse_event),
- sizeof(p.mouse_event)));
- WriteParam(m, p.location_script_chain);
+// Only the net::UploadData ParamTraits<> definition needs this definition, so
+// keep this in the implementation file so we can forward declare UploadData in
+// the header.
+template <>
+struct ParamTraits<net::UploadElement> {
+ typedef net::UploadElement param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, static_cast<int>(p.type()));
+ switch (p.type()) {
+ case net::UploadElement::TYPE_BYTES: {
+ m->WriteData(p.bytes(), static_cast<int>(p.bytes_length()));
+ break;
+ }
+ default: {
+ DCHECK(p.type() == net::UploadElement::TYPE_FILE);
+ WriteParam(m, p.file_path());
+ WriteParam(m, p.file_range_offset());
+ WriteParam(m, p.file_range_length());
+ WriteParam(m, p.expected_file_modification_time());
+ break;
+ }
+ }
+ }
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
+ int type;
+ if (!ReadParam(m, iter, &type))
+ return false;
+ switch (type) {
+ case net::UploadElement::TYPE_BYTES: {
+ const char* data;
+ int len;
+ if (!m->ReadData(iter, &data, &len))
+ return false;
+ r->SetToBytes(data, len);
+ break;
+ }
+ default: {
+ DCHECK(type == net::UploadElement::TYPE_FILE);
+ FilePath file_path;
+ uint64 offset, length;
+ base::Time expected_modification_time;
+ if (!ReadParam(m, iter, &file_path))
+ return false;
+ if (!ReadParam(m, iter, &offset))
+ return false;
+ if (!ReadParam(m, iter, &length))
+ return false;
+ if (!ReadParam(m, iter, &expected_modification_time))
+ return false;
+ r->SetToFilePathRange(file_path, offset, length,
+ expected_modification_time);
+ break;
+ }
+ }
+ return true;
+ }
+ static void Log(const param_type& p, std::string* l) {
+ l->append("<net::UploadElement>");
+ }
+};
+
+void ParamTraits<scoped_refptr<net::UploadData> >::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, p.get() != NULL);
+ if (p) {
+ WriteParam(m, *p->elements());
+ WriteParam(m, p->identifier());
+ WriteParam(m, p->is_chunked());
+ WriteParam(m, p->last_chunk_appended());
+ }
}
-// static
-bool ParamTraits<AutomationMouseEvent>::Read(const Message* m,
- PickleIterator* iter,
- param_type* p) {
- std::string mouse_event;
- if (!ReadParam(m, iter, &mouse_event))
+bool ParamTraits<scoped_refptr<net::UploadData> >::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* r) {
+ bool has_object;
+ if (!ReadParam(m, iter, &has_object))
return false;
- memcpy(&p->mouse_event, mouse_event.c_str(), mouse_event.length());
- if (!ReadParam(m, iter, &p->location_script_chain))
+ if (!has_object)
+ return true;
+ std::vector<net::UploadElement> elements;
+ if (!ReadParam(m, iter, &elements))
+ return false;
+ int64 identifier;
+ if (!ReadParam(m, iter, &identifier))
+ return false;
+ bool is_chunked = false;
+ if (!ReadParam(m, iter, &is_chunked))
return false;
+ bool last_chunk_appended = false;
+ if (!ReadParam(m, iter, &last_chunk_appended))
+ return false;
+ *r = new net::UploadData;
+ (*r)->swap_elements(&elements);
+ (*r)->set_identifier(identifier);
+ (*r)->set_is_chunked(is_chunked);
+ (*r)->set_last_chunk_appended(last_chunk_appended);
return true;
}
-// static
-void ParamTraits<AutomationMouseEvent>::Log(const param_type& p,
- std::string* l) {
- l->append("(");
- LogParam(std::string(reinterpret_cast<const char*>(&p.mouse_event),
- sizeof(p.mouse_event)),
- l);
- l->append(", ");
- LogParam(p.location_script_chain, l);
- l->append(")");
+void ParamTraits<scoped_refptr<net::UploadData> >::Log(const param_type& p,
+ std::string* l) {
+ l->append("<net::UploadData>");
+}
+
+void ParamTraits<net::URLRequestStatus>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, static_cast<int>(p.status()));
+ WriteParam(m, p.error());
+}
+
+bool ParamTraits<net::URLRequestStatus>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* r) {
+ int status, error;
+ if (!ReadParam(m, iter, &status) || !ReadParam(m, iter, &error))
+ return false;
+ r->set_status(static_cast<net::URLRequestStatus::Status>(status));
+ r->set_error(error);
+ return true;
+}
+
+void ParamTraits<net::URLRequestStatus>::Log(const param_type& p,
+ std::string* l) {
+ std::string status;
+ switch (p.status()) {
+ case net::URLRequestStatus::SUCCESS:
+ status = "SUCCESS";
+ break;
+ case net::URLRequestStatus::IO_PENDING:
+ status = "IO_PENDING ";
+ break;
+ case net::URLRequestStatus::CANCELED:
+ status = "CANCELED";
+ break;
+ case net::URLRequestStatus::FAILED:
+ status = "FAILED";
+ break;
+ default:
+ status = "UNKNOWN";
+ break;
+ }
+ if (p.status() == net::URLRequestStatus::FAILED)
+ l->append("(");
+
+ LogParam(status, l);
+
+ if (p.status() == net::URLRequestStatus::FAILED) {
+ l->append(", ");
+ LogParam(p.error(), l);
+ l->append(")");
+ }
}
} // namespace IPC
diff --git a/chrome/common/automation_messages.h b/chrome/common/automation_messages.h
index 1d86150..0a011ce 100644
--- a/chrome/common/automation_messages.h
+++ b/chrome/common/automation_messages.h
@@ -15,7 +15,6 @@
#include "content/public/common/common_param_traits.h"
#include "content/public/common/page_type.h"
#include "content/public/common/security_style.h"
-#include "content/public/common/webkit_param_traits.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
@@ -194,7 +193,14 @@ struct ContextMenuModel {
namespace IPC {
-// Traits for ContextMenuModel structure to pack/unpack.
+template <>
+struct ParamTraits<AutomationMouseEvent> {
+ typedef AutomationMouseEvent param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, PickleIterator* iter, param_type* p);
+ static void Log(const param_type& p, std::string* l);
+};
+
template <>
struct ParamTraits<ContextMenuModel> {
typedef ContextMenuModel param_type;
@@ -203,12 +209,19 @@ struct ParamTraits<ContextMenuModel> {
static void Log(const param_type& p, std::string* l);
};
-// Traits for AutomationMouseEvent structure to pack/unpack.
template <>
-struct ParamTraits<AutomationMouseEvent> {
- typedef AutomationMouseEvent param_type;
+struct ParamTraits<scoped_refptr<net::UploadData> > {
+ typedef scoped_refptr<net::UploadData> param_type;
static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, PickleIterator* iter, param_type* p);
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r);
+ static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct ParamTraits<net::URLRequestStatus> {
+ typedef net::URLRequestStatus param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r);
static void Log(const param_type& p, std::string* l);
};
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index cb077e5..d7334f1 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -25,7 +25,6 @@
#include "chrome/common/thumbnail_score.h"
#include "chrome/common/translate_errors.h"
#include "content/public/common/common_param_traits.h"
-#include "content/public/common/webkit_param_traits.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h"
diff --git a/chrome/renderer/autofill/form_autocomplete_browsertest.cc b/chrome/renderer/autofill/form_autocomplete_browsertest.cc
index 0e5d662..5285231 100644
--- a/chrome/renderer/autofill/form_autocomplete_browsertest.cc
+++ b/chrome/renderer/autofill/form_autocomplete_browsertest.cc
@@ -16,7 +16,6 @@
using webkit::forms::FormData;
using WebKit::WebFrame;
using WebKit::WebString;
-using WebKit::WebTextDirection;
using WebKit::WebURLError;
typedef ChromeRenderViewTest FormAutocompleteTest;
diff --git a/chrome/renderer/page_click_tracker.cc b/chrome/renderer/page_click_tracker.cc
index 9e40679..1ed680d 100644
--- a/chrome/renderer/page_click_tracker.cc
+++ b/chrome/renderer/page_click_tracker.cc
@@ -12,6 +12,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMMouseEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
diff --git a/chrome/renderer/plugins/plugin_placeholder.cc b/chrome/renderer/plugins/plugin_placeholder.cc
index c1b3158..9c92579 100644
--- a/chrome/renderer/plugins/plugin_placeholder.cc
+++ b/chrome/renderer/plugins/plugin_placeholder.cc
@@ -22,6 +22,7 @@
#include "grit/generated_resources.h"
#include "grit/renderer_resources.h"
#include "grit/webkit_strings.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"