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

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

Issue 6682033: Move plugin messages to content. (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.h ('k') | chrome/common/logging_chrome.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file is used to define IPC::ParamTraits<> specializations for a number 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<> 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 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 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. 9 // specializations for types that are shared by more than one child process.
10 10
11 #ifndef CHROME_COMMON_COMMON_PARAM_TRAITS_H_ 11 #ifndef CHROME_COMMON_COMMON_PARAM_TRAITS_H_
12 #define CHROME_COMMON_COMMON_PARAM_TRAITS_H_ 12 #define CHROME_COMMON_COMMON_PARAM_TRAITS_H_
13 #pragma once 13 #pragma once
14 14
15 #include "app/surface/transport_dib.h"
16 #include "base/file_util.h" 15 #include "base/file_util.h"
17 #include "base/ref_counted.h" 16 #include "base/ref_counted.h"
18 #include "chrome/common/content_settings.h" 17 #include "chrome/common/content_settings.h"
19 #include "chrome/common/page_zoom.h" 18 #include "chrome/common/page_zoom.h"
20 #include "ipc/ipc_message_utils.h" 19 #include "ipc/ipc_message_utils.h"
21 #include "printing/native_metafile.h" 20 #include "printing/native_metafile.h"
22 // !!! WARNING: DO NOT ADD NEW WEBKIT DEPENDENCIES !!! 21 // !!! WARNING: DO NOT ADD NEW WEBKIT DEPENDENCIES !!!
23 // 22 //
24 // That means don't add #includes to any file in 'webkit/' or 23 // That means don't add #includes to any file in 'webkit/' or
25 // 'third_party/WebKit/'. Chrome Frame and NACL build parts of base/ and 24 // 'third_party/WebKit/'. Chrome Frame and NACL build parts of base/ and
26 // chrome/common/ for a mini-library that doesn't depend on webkit. 25 // chrome/common/ for a mini-library that doesn't depend on webkit.
27 // 26 //
28 // TODO(erg): The following headers are historical and only work because 27 // TODO(erg): The following headers are historical and only work because
29 // their definitions are inlined, which also needs to be fixed. 28 // their definitions are inlined, which also needs to be fixed.
30 #include "webkit/glue/webcursor.h"
31 #include "webkit/glue/window_open_disposition.h" 29 #include "webkit/glue/window_open_disposition.h"
32 30
33 // Forward declarations. 31 // Forward declarations.
34 struct Geoposition; 32 struct Geoposition;
35 class SkBitmap; 33 class SkBitmap;
36 class DictionaryValue; 34 class DictionaryValue;
37 class ListValue; 35 class ListValue;
38 struct ThumbnailScore; 36 struct ThumbnailScore;
39 struct WebApplicationInfo; 37 struct WebApplicationInfo;
40 class WebCursor;
41 38
42 namespace printing { 39 namespace printing {
43 struct PageRange; 40 struct PageRange;
44 struct PrinterCapsAndDefaults; 41 struct PrinterCapsAndDefaults;
45 } // namespace printing 42 } // namespace printing
46 43
47 namespace webkit_glue { 44 namespace webkit_glue {
48 struct PasswordForm; 45 struct PasswordForm;
49 } // namespace webkit_glue 46 } // namespace webkit_glue
50 47
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 if (!ReadParam(m, iter, &value)) 125 if (!ReadParam(m, iter, &value))
129 return false; 126 return false;
130 *r = static_cast<param_type>(value); 127 *r = static_cast<param_type>(value);
131 return true; 128 return true;
132 } 129 }
133 static void Log(const param_type& p, std::string* l) { 130 static void Log(const param_type& p, std::string* l) {
134 LogParam(static_cast<int>(p), l); 131 LogParam(static_cast<int>(p), l);
135 } 132 }
136 }; 133 };
137 134
138
139 template <>
140 struct ParamTraits<WebCursor> {
141 typedef WebCursor param_type;
142 static void Write(Message* m, const param_type& p) {
143 p.Serialize(m);
144 }
145 static bool Read(const Message* m, void** iter, param_type* r) {
146 return r->Deserialize(m, iter);
147 }
148 static void Log(const param_type& p, std::string* l) {
149 l->append("<WebCursor>");
150 }
151 };
152
153
154 template <> 135 template <>
155 struct ParamTraits<WebApplicationInfo> { 136 struct ParamTraits<WebApplicationInfo> {
156 typedef WebApplicationInfo param_type; 137 typedef WebApplicationInfo param_type;
157 static void Write(Message* m, const param_type& p); 138 static void Write(Message* m, const param_type& p);
158 static bool Read(const Message* m, void** iter, param_type* r); 139 static bool Read(const Message* m, void** iter, param_type* r);
159 static void Log(const param_type& p, std::string* l); 140 static void Log(const param_type& p, std::string* l);
160 }; 141 };
161 142
162
163 #if defined(OS_WIN)
164 template<>
165 struct ParamTraits<TransportDIB::Id> {
166 typedef TransportDIB::Id param_type;
167 static void Write(Message* m, const param_type& p) {
168 WriteParam(m, p.handle);
169 WriteParam(m, p.sequence_num);
170 }
171 static bool Read(const Message* m, void** iter, param_type* r) {
172 return (ReadParam(m, iter, &r->handle) &&
173 ReadParam(m, iter, &r->sequence_num));
174 }
175 static void Log(const param_type& p, std::string* l) {
176 l->append("TransportDIB(");
177 LogParam(p.handle, l);
178 l->append(", ");
179 LogParam(p.sequence_num, l);
180 l->append(")");
181 }
182 };
183 #endif
184
185 template<> 143 template<>
186 struct ParamTraits<ThumbnailScore> { 144 struct ParamTraits<ThumbnailScore> {
187 typedef ThumbnailScore param_type; 145 typedef ThumbnailScore param_type;
188 static void Write(Message* m, const param_type& p); 146 static void Write(Message* m, const param_type& p);
189 static bool Read(const Message* m, void** iter, param_type* r); 147 static bool Read(const Message* m, void** iter, param_type* r);
190 static void Log(const param_type& p, std::string* l); 148 static void Log(const param_type& p, std::string* l);
191 }; 149 };
192 150
193 template <> 151 template <>
194 struct ParamTraits<Geoposition> { 152 struct ParamTraits<Geoposition> {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 struct ParamTraits<printing::PrinterCapsAndDefaults> { 184 struct ParamTraits<printing::PrinterCapsAndDefaults> {
227 typedef printing::PrinterCapsAndDefaults param_type; 185 typedef printing::PrinterCapsAndDefaults param_type;
228 static void Write(Message* m, const param_type& p); 186 static void Write(Message* m, const param_type& p);
229 static bool Read(const Message* m, void** iter, param_type* r); 187 static bool Read(const Message* m, void** iter, param_type* r);
230 static void Log(const param_type& p, std::string* l); 188 static void Log(const param_type& p, std::string* l);
231 }; 189 };
232 190
233 } // namespace IPC 191 } // namespace IPC
234 192
235 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ 193 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_
OLDNEW
« no previous file with comments | « chrome/common/common_message_generator.h ('k') | chrome/common/logging_chrome.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698