summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-16 03:12:09 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-16 03:12:09 +0000
commit0e60083039fa5b27a8cb32b549063fa0cfd925ea (patch)
tree91e59f2e41c0b1a34cf4d55194af466cad96efcb /chrome
parent5bdb5e7ffe172b58b2e78f8abb45fea4f8a858cd (diff)
downloadchromium_src-0e60083039fa5b27a8cb32b549063fa0cfd925ea.zip
chromium_src-0e60083039fa5b27a8cb32b549063fa0cfd925ea.tar.gz
chromium_src-0e60083039fa5b27a8cb32b549063fa0cfd925ea.tar.bz2
Convert dom_storage, pepper, pepper_file, and automation messages to new format.
dom_storage now generated by the common generator. Pepper and pepper_file still have dedicated .cc files rather than using the common generator because they still contain a small amount of hand-coded code. Automation_messages has its own .cc file, since it appears this may well link into other places. Review URL: http://codereview.chromium.org/6695032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78330 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/chrome_common.gypi1
-rw-r--r--chrome/common/automation_messages.h16
-rw-r--r--chrome/common/common_message_generator.h1
-rw-r--r--chrome/common/dom_storage_messages.cc125
-rw-r--r--chrome/common/dom_storage_messages.h56
-rw-r--r--chrome/common/pepper_file_messages.h14
-rw-r--r--chrome/common/pepper_messages.h17
7 files changed, 41 insertions, 189 deletions
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 485057c..3f035a9 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -52,7 +52,6 @@
'common/content_settings_types.h',
'common/devtools_messages.cc',
'common/devtools_messages.h',
- 'common/dom_storage_messages.cc',
'common/dom_storage_messages.h',
'common/font_config_ipc_linux.cc',
'common/font_config_ipc_linux.h',
diff --git a/chrome/common/automation_messages.h b/chrome/common/automation_messages.h
index 7bd13fe..3bf0ca5 100644
--- a/chrome/common/automation_messages.h
+++ b/chrome/common/automation_messages.h
@@ -2,10 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_COMMON_AUTOMATION_MESSAGES_H__
-#define CHROME_COMMON_AUTOMATION_MESSAGES_H__
-#pragma once
-
+// Multiply-included message file, no traditional include guard.
#include <string>
#include "base/basictypes.h"
@@ -14,10 +11,16 @@
#include "chrome/common/page_type.h"
#include "chrome/common/security_style.h"
#include "content/common/common_param_traits.h"
+#include "ipc/ipc_message_macros.h"
+#include "ipc/ipc_message_utils.h"
#include "net/base/host_port_pair.h"
#include "net/base/upload_data.h"
#include "ui/gfx/rect.h"
+// Singly-included section, not yet converted.
+#ifndef CHROME_COMMON_AUTOMATION_MESSAGES_H__
+#define CHROME_COMMON_AUTOMATION_MESSAGES_H__
+
struct AutomationMsg_Find_Params {
// Unused value, which exists only for backwards compat.
int unused;
@@ -355,6 +358,9 @@ struct ParamTraits<AttachExternalTabParams> {
} // namespace IPC
+#endif // CHROME_COMMON_AUTOMATION_MESSAGES_H__
+
+// Keep this internal message file unchanged to preserve line numbering
+// (and hence the dubious __LINE__-based message numberings) across versions.
#include "chrome/common/automation_messages_internal.h"
-#endif // CHROME_COMMON_AUTOMATION_MESSAGES_H__
diff --git a/chrome/common/common_message_generator.h b/chrome/common/common_message_generator.h
index a681f73..3b52043 100644
--- a/chrome/common/common_message_generator.h
+++ b/chrome/common/common_message_generator.h
@@ -6,6 +6,7 @@
#include "chrome/common/autofill_messages.h"
#include "chrome/common/clipboard_messages.h"
+#include "chrome/common/dom_storage_messages.h"
#include "chrome/common/indexed_db_messages.h"
#include "chrome/common/safebrowsing_messages.h"
#include "chrome/common/service_messages.h"
diff --git a/chrome/common/dom_storage_messages.cc b/chrome/common/dom_storage_messages.cc
deleted file mode 100644
index 3ee1f8d..0000000
--- a/chrome/common/dom_storage_messages.cc
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright (c) 2010 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 "content/common/common_param_traits.h"
-
-#define IPC_MESSAGE_IMPL
-#include "chrome/common/dom_storage_messages.h"
-
-DOMStorageMsg_Event_Params::DOMStorageMsg_Event_Params()
- : storage_type(DOM_STORAGE_LOCAL) {
-}
-
-DOMStorageMsg_Event_Params::~DOMStorageMsg_Event_Params() {
-}
-
-namespace IPC {
-
-void ParamTraits<DOMStorageMsg_Event_Params>::Write(Message* m,
- const param_type& p) {
- WriteParam(m, p.key);
- WriteParam(m, p.old_value);
- WriteParam(m, p.new_value);
- WriteParam(m, p.origin);
- WriteParam(m, p.url);
- WriteParam(m, p.storage_type);
-}
-
-bool ParamTraits<DOMStorageMsg_Event_Params>::Read(const Message* m,
- void** iter,
- param_type* p) {
- return
- ReadParam(m, iter, &p->key) &&
- ReadParam(m, iter, &p->old_value) &&
- ReadParam(m, iter, &p->new_value) &&
- ReadParam(m, iter, &p->origin) &&
- ReadParam(m, iter, &p->url) &&
- ReadParam(m, iter, &p->storage_type);
-}
-
-void ParamTraits<DOMStorageMsg_Event_Params>::Log(const param_type& p,
- std::string* l) {
- l->append("(");
- LogParam(p.key, l);
- l->append(", ");
- LogParam(p.old_value, l);
- l->append(", ");
- LogParam(p.new_value, l);
- l->append(", ");
- LogParam(p.origin, l);
- l->append(", ");
- LogParam(p.url, l);
- l->append(", ");
- LogParam(p.storage_type, l);
- l->append(")");
-}
-
-void ParamTraits<DOMStorageType>::Write(Message* m, const param_type& p) {
- m->WriteInt(p);
-}
-
-bool ParamTraits<DOMStorageType>::Read(const Message* m,
- void** iter,
- param_type* p) {
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
- *p = static_cast<param_type>(type);
- return true;
-}
-
-void ParamTraits<DOMStorageType>::Log(const param_type& p, std::string* l) {
- std::string control;
- switch (p) {
- case DOM_STORAGE_LOCAL:
- control = "DOM_STORAGE_LOCAL";
- break;
- case DOM_STORAGE_SESSION:
- control = "DOM_STORAGE_SESSION";
- break;
- default:
- NOTIMPLEMENTED();
- control = "UNKNOWN";
- break;
- }
- LogParam(control, l);
-}
-
-void ParamTraits<WebKit::WebStorageArea::Result>::Write(Message* m,
- const param_type& p) {
- m->WriteInt(p);
-}
-
-bool ParamTraits<WebKit::WebStorageArea::Result>::Read(const Message* m,
- void** iter,
- param_type* p) {
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
- *p = static_cast<param_type>(type);
- return true;
-}
-
-void ParamTraits<WebKit::WebStorageArea::Result>::Log(const param_type& p,
- std::string* l) {
- std::string control;
- switch (p) {
- case WebKit::WebStorageArea::ResultOK:
- control = "WebKit::WebStorageArea::ResultOK";
- break;
- case WebKit::WebStorageArea::ResultBlockedByQuota:
- control = "WebKit::WebStorageArea::ResultBlockedByQuota";
- break;
- case WebKit::WebStorageArea::ResultBlockedByPolicy:
- control = "WebKit::WebStorageArea::ResultBlockedByPolicy";
- break;
- default:
- NOTIMPLEMENTED();
- control = "UNKNOWN";
- break;
- }
- LogParam(control, l);
-}
-
-} // namespace IPC
diff --git a/chrome/common/dom_storage_messages.h b/chrome/common/dom_storage_messages.h
index 85db0e6..6b41750 100644
--- a/chrome/common/dom_storage_messages.h
+++ b/chrome/common/dom_storage_messages.h
@@ -2,10 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_COMMON_DOM_STORAGE_MESSAGES_H_
-#define CHROME_COMMON_DOM_STORAGE_MESSAGES_H_
-#pragma once
-
+// Multiply-included message file, no traditional include guard.
#include "chrome/common/dom_storage_common.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_macros.h"
@@ -15,56 +12,28 @@
#define IPC_MESSAGE_START DOMStorageMsgStart
// Signals a storage event.
-struct DOMStorageMsg_Event_Params {
- DOMStorageMsg_Event_Params();
- ~DOMStorageMsg_Event_Params();
-
+IPC_STRUCT_BEGIN(DOMStorageMsg_Event_Params)
// The key that generated the storage event. Null if clear() was called.
- NullableString16 key;
+ IPC_STRUCT_MEMBER(NullableString16, key)
// The old value of this key. Null on clear() or if it didn't have a value.
- NullableString16 old_value;
+ IPC_STRUCT_MEMBER(NullableString16, old_value)
// The new value of this key. Null on removeItem() or clear().
- NullableString16 new_value;
+ IPC_STRUCT_MEMBER(NullableString16, new_value)
// The origin this is associated with.
- string16 origin;
+ IPC_STRUCT_MEMBER(string16, origin)
// The URL of the page that caused the storage event.
- GURL url;
+ IPC_STRUCT_MEMBER(GURL, url)
// The storage type of this event.
- DOMStorageType storage_type;
-};
-
-namespace IPC {
-
-template <>
-struct ParamTraits<DOMStorageMsg_Event_Params> {
- typedef DOMStorageMsg_Event_Params param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
-struct ParamTraits<DOMStorageType> {
- typedef DOMStorageType param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
-struct ParamTraits<WebKit::WebStorageArea::Result> {
- typedef WebKit::WebStorageArea::Result param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-} // namespace IPC
+ IPC_STRUCT_MEMBER(DOMStorageType, storage_type)
+IPC_STRUCT_END()
+
+IPC_ENUM_TRAITS(DOMStorageType)
+IPC_ENUM_TRAITS(WebKit::WebStorageArea::Result)
// DOM Storage messages sent from the browser to the renderer.
@@ -122,4 +91,3 @@ IPC_SYNC_MESSAGE_CONTROL2_1(DOMStorageHostMsg_Clear,
GURL /* url */,
bool /* something_cleared */)
-#endif // CHROME_COMMON_DOM_STORAGE_MESSAGES_H_
diff --git a/chrome/common/pepper_file_messages.h b/chrome/common/pepper_file_messages.h
index 1298414..2825623 100644
--- a/chrome/common/pepper_file_messages.h
+++ b/chrome/common/pepper_file_messages.h
@@ -2,10 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_COMMON_PEPPER_FILE_MESSAGES_H_
-#define CHROME_COMMON_PEPPER_FILE_MESSAGES_H_
-#pragma once
-
+// Multiply-included message file, no traditional include guard.
#include "content/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
@@ -13,7 +10,9 @@
#include "webkit/plugins/ppapi/dir_contents.h"
#include "webkit/plugins/ppapi/file_path.h"
-#define IPC_MESSAGE_START PepperFileMsgStart
+// Singly-included section, still not converted
+#ifndef CHROME_COMMON_PEPPER_FILE_MESSAGES_H_
+#define CHROME_COMMON_PEPPER_FILE_MESSAGES_H_
namespace IPC {
@@ -36,6 +35,10 @@ struct ParamTraits<webkit::ppapi::PepperFilePath> {
} // namespace IPC
+#endif // CHROME_COMMON_PEPPER_FILE_MESSAGES_H_
+
+#define IPC_MESSAGE_START PepperFileMsgStart
+
// Trusted Pepper Filesystem messages from the renderer to the browser.
// Open the file.
@@ -74,4 +77,3 @@ IPC_SYNC_MESSAGE_CONTROL1_2(PepperFileMsg_GetDirContents,
webkit::ppapi::DirContents, /* contents */
base::PlatformFileError /* error_code */)
-#endif // CHROME_COMMON_PEPPER_FILE_MESSAGES_H_
diff --git a/chrome/common/pepper_messages.h b/chrome/common/pepper_messages.h
index 60bf768..5330438 100644
--- a/chrome/common/pepper_messages.h
+++ b/chrome/common/pepper_messages.h
@@ -2,18 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_COMMON_PEPPER_MESSAGES_H_
-#define CHROME_COMMON_PEPPER_MESSAGES_H_
-#pragma once
-
+// Multiply-included message file, no traditional include guard
#include "chrome/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
#include "ipc/ipc_platform_file.h"
+#include "ppapi/c/private/ppb_flash_net_connector.h"
-#define IPC_MESSAGE_START PepperMsgStart
-
-struct PP_Flash_NetAddress;
+// Singly-included section, not yet converted.
+#ifndef CHROME_COMMON_PEPPER_MESSAGES_H_
+#define CHROME_COMMON_PEPPER_MESSAGES_H_
namespace IPC {
@@ -27,6 +25,10 @@ struct ParamTraits<PP_Flash_NetAddress> {
} // namespace IPC
+#define IPC_MESSAGE_START PepperMsgStart
+
+#endif // CHROME_COMMON_PEPPER_MESSAGES_H_
+
// Pepper (non-file-system) messages sent from the browser to the renderer.
// The response to PepperMsg_ConnectTcp(Address).
@@ -49,4 +51,3 @@ IPC_MESSAGE_CONTROL3(PepperMsg_ConnectTcpAddress,
int /* request_id */,
PP_Flash_NetAddress /* addr */)
-#endif // CHROME_COMMON_PEPPER_MESSAGES_H_