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

Side by Side Diff: chrome/common/common_param_traits.h

Issue 6713084: Move the rest of the renderer->browser messages that belong in content. Also do a bunch of cleanup: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/common_message_generator.cc ('k') | chrome/common/common_param_traits.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file is used to define IPC::ParamTraits<> specializations for a number
6 // of types so that they can be serialized over IPC. IPC::ParamTraits<>
7 // specializations for basic types (like int and std::string) and types in the
8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains
9 // specializations for types that are shared by more than one child process.
10
11 #ifndef CHROME_COMMON_COMMON_PARAM_TRAITS_H_
12 #define CHROME_COMMON_COMMON_PARAM_TRAITS_H_
13 #pragma once
14
15 #include "base/file_util.h"
16 #include "base/ref_counted.h"
17 #include "chrome/common/content_settings.h"
18 #include "ipc/ipc_message_utils.h"
19 #include "printing/native_metafile.h"
20
21 // Forward declarations.
22 class DictionaryValue;
23 class ListValue;
24 struct ThumbnailScore;
25 struct WebApplicationInfo;
26
27 namespace printing {
28 struct PageRange;
29 struct PrinterCapsAndDefaults;
30 } // namespace printing
31
32 namespace IPC {
33
34 template <>
35 struct ParamTraits<ContentSetting> {
36 typedef ContentSetting param_type;
37 static void Write(Message* m, const param_type& p);
38 static bool Read(const Message* m, void** iter, param_type* r);
39 static void Log(const param_type& p, std::string* l);
40 };
41
42 template <>
43 struct ParamTraits<ContentSettingsType> {
44 typedef ContentSettingsType param_type;
45 static void Write(Message* m, const param_type& p) {
46 WriteParam(m, static_cast<int>(p));
47 }
48 static bool Read(const Message* m, void** iter, param_type* r) {
49 int value;
50 if (!ReadParam(m, iter, &value))
51 return false;
52 if (value < 0 || value >= static_cast<int>(CONTENT_SETTINGS_NUM_TYPES))
53 return false;
54 *r = static_cast<param_type>(value);
55 return true;
56 }
57 static void Log(const param_type& p, std::string* l) {
58 LogParam(static_cast<int>(p), l);
59 }
60 };
61
62 template <>
63 struct ParamTraits<ContentSettings> {
64 typedef ContentSettings param_type;
65 static void Write(Message* m, const param_type& p);
66 static bool Read(const Message* m, void** iter, param_type* r);
67 static void Log(const param_type& p, std::string* l);
68 };
69
70 template <>
71 struct ParamTraits<WebApplicationInfo> {
72 typedef WebApplicationInfo param_type;
73 static void Write(Message* m, const param_type& p);
74 static bool Read(const Message* m, void** iter, param_type* r);
75 static void Log(const param_type& p, std::string* l);
76 };
77
78 template<>
79 struct ParamTraits<ThumbnailScore> {
80 typedef ThumbnailScore param_type;
81 static void Write(Message* m, const param_type& p);
82 static bool Read(const Message* m, void** iter, param_type* r);
83 static void Log(const param_type& p, std::string* l);
84 };
85
86 template <>
87 struct ParamTraits<printing::PageRange> {
88 typedef printing::PageRange param_type;
89 static void Write(Message* m, const param_type& p);
90 static bool Read(const Message* m, void** iter, param_type* r);
91 static void Log(const param_type& p, std::string* l);
92 };
93
94 template <>
95 struct ParamTraits<printing::NativeMetafile> {
96 typedef printing::NativeMetafile param_type;
97 static void Write(Message* m, const param_type& p);
98 static bool Read(const Message* m, void** iter, param_type* r);
99 static void Log(const param_type& p, std::string* l);
100 };
101
102 template <>
103 struct ParamTraits<printing::PrinterCapsAndDefaults> {
104 typedef printing::PrinterCapsAndDefaults param_type;
105 static void Write(Message* m, const param_type& p);
106 static bool Read(const Message* m, void** iter, param_type* r);
107 static void Log(const param_type& p, std::string* l);
108 };
109
110 } // namespace IPC
111
112 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_
OLDNEW
« no previous file with comments | « chrome/common/common_message_generator.cc ('k') | chrome/common/common_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698