Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Unified Diff: chrome/common/common_param_traits.cc

Issue 10577040: Generate param traits even when shared by mutliple message files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/common_param_traits.h ('k') | chrome/common/common_param_traits_macros.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/common_param_traits.cc
===================================================================
--- chrome/common/common_param_traits.cc (revision 143430)
+++ chrome/common/common_param_traits.cc (working copy)
@@ -2,104 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Get basic type definitions.
#include "chrome/common/common_param_traits.h"
-#include "ipc/ipc_message.h"
-#include "ipc/ipc_message_utils.h"
+// Generate param traits write methods.
+#include "ipc/param_traits_write_macros.h"
+namespace IPC {
+#undef CHROME_COMMON_COMMON_PARAM_TRAITS_MACROS_H_
+#include "chrome/common/common_param_traits_macros.h"
+} // namespace IPC
+// Generate param traits read methods.
+#include "ipc/param_traits_read_macros.h"
namespace IPC {
+#undef CHROME_COMMON_COMMON_PARAM_TRAITS_MACROS_H_
+#include "chrome/common/common_param_traits_macros.h"
+} // namespace IPC
-void ParamTraits<ContentSetting>::Write(Message* m, const param_type& p) {
- m->WriteInt(static_cast<int>(p));
-}
-
-bool ParamTraits<ContentSetting>::Read(const Message* m, PickleIterator* iter,
- param_type* p) {
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
- *p = static_cast<param_type>(type);
- return true;
-}
-
-void ParamTraits<ContentSetting>::Log(const param_type& p, std::string* l) {
- std::string content_setting;
- switch (p) {
- case CONTENT_SETTING_DEFAULT:
- content_setting = "CONTENT_SETTING_DEFAULT";
- break;
- case CONTENT_SETTING_ALLOW:
- content_setting = "CONTENT_SETTING_ALLOW";
- break;
- case CONTENT_SETTING_BLOCK:
- content_setting = "CONTENT_SETTING_BLOCK";
- break;
- case CONTENT_SETTING_ASK:
- content_setting = "CONTENT_SETTING_ASK";
- break;
- case CONTENT_SETTING_SESSION_ONLY:
- content_setting = "CONTENT_SETTING_SESSION_ONLY";
- break;
- default:
- content_setting = "UNKNOWN";
- break;
- }
- LogParam(content_setting, l);
-}
-
-void ParamTraits<ContentSettingsType>::Write(Message* m, const param_type& p) {
- m->WriteInt(static_cast<int>(p));
-}
-
-bool ParamTraits<ContentSettingsType>::Read(const Message* m,
- PickleIterator* iter,
- param_type* p) {
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
- *p = static_cast<param_type>(type);
- return true;
-}
-
-void ParamTraits<ContentSettingsType>::Log(const param_type& p,
- std::string* l) {
- std::string setting_type;
- switch (p) {
- case CONTENT_SETTINGS_TYPE_DEFAULT:
- setting_type = "CONTENT_SETTINGS_TYPE_DEFAULT";
- break;
- case CONTENT_SETTINGS_TYPE_COOKIES:
- setting_type = "CONTENT_SETTINGS_TYPE_COOKIES";
- break;
- case CONTENT_SETTINGS_TYPE_IMAGES:
- setting_type = "CONTENT_SETTINGS_TYPE_IMAGES";
- break;
- case CONTENT_SETTINGS_TYPE_JAVASCRIPT:
- setting_type = "CONTENT_SETTINGS_TYPE_JAVASCRIPT";
- break;
- case CONTENT_SETTINGS_TYPE_PLUGINS:
- setting_type = "CONTENT_SETTINGS_TYPE_PLUGINS";
- break;
- case CONTENT_SETTINGS_TYPE_POPUPS:
- setting_type = "CONTENT_SETTINGS_TYPE_POPUPS";
- break;
- case CONTENT_SETTINGS_TYPE_GEOLOCATION:
- setting_type = "CONTENT_SETTINGS_TYPE_GEOLOCATION";
- break;
- case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
- setting_type = "CONTENT_SETTINGS_TYPE_NOTIFICATIONS";
- break;
- case CONTENT_SETTINGS_TYPE_INTENTS:
- setting_type = "CONTENT_SETTINGS_TYPE_INTENTS";
- break;
- case CONTENT_SETTINGS_TYPE_MIXEDSCRIPT:
- setting_type = "CONTENT_SETTINGS_TYPE_MIXEDSCRIPT";
- break;
- default:
- setting_type = "UNKNOWN";
- break;
- }
- LogParam(setting_type, l);
-}
-
+// Generate param traits log methods.
+#include "ipc/param_traits_log_macros.h"
+namespace IPC {
+#undef CHROME_COMMON_COMMON_PARAM_TRAITS_MACROS_H_
+#include "chrome/common/common_param_traits_macros.h"
} // namespace IPC
« no previous file with comments | « chrome/common/common_param_traits.h ('k') | chrome/common/common_param_traits_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698