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

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

Issue 115491: Add IPC serialization for DictionaryValue, with unit tests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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/ipc_message_unittest.cc ('k') | chrome/common/ipc_message_utils.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_COMMON_IPC_MESSAGE_UTILS_H_ 5 #ifndef CHROME_COMMON_IPC_MESSAGE_UTILS_H_
6 #define CHROME_COMMON_IPC_MESSAGE_UTILS_H_ 6 #define CHROME_COMMON_IPC_MESSAGE_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include <map> 10 #include <map>
11 11
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "base/tuple.h" 15 #include "base/tuple.h"
16 #if defined(OS_POSIX) 16 #if defined(OS_POSIX)
17 #include "chrome/common/file_descriptor_set_posix.h" 17 #include "chrome/common/file_descriptor_set_posix.h"
18 #endif 18 #endif
19 #include "chrome/common/ipc_sync_message.h" 19 #include "chrome/common/ipc_sync_message.h"
20 #include "chrome/common/thumbnail_score.h" 20 #include "chrome/common/thumbnail_score.h"
21 #include "chrome/common/transport_dib.h" 21 #include "chrome/common/transport_dib.h"
22 #include "webkit/glue/webcursor.h" 22 #include "webkit/glue/webcursor.h"
23 #include "webkit/glue/window_open_disposition.h" 23 #include "webkit/glue/window_open_disposition.h"
24 24
25 // Forward declarations. 25 // Forward declarations.
26 class GURL; 26 class GURL;
27 class SkBitmap; 27 class SkBitmap;
28 class DictionaryValue;
29 class ListValue;
28 30
29 namespace gfx { 31 namespace gfx {
30 class Point; 32 class Point;
31 class Rect; 33 class Rect;
32 class Size; 34 class Size;
33 } // namespace gfx 35 } // namespace gfx
34 36
35 namespace webkit_glue { 37 namespace webkit_glue {
36 struct WebApplicationInfo; 38 struct WebApplicationInfo;
37 } // namespace webkit_glue 39 } // namespace webkit_glue
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 static void Write(Message* m, const param_type& p); 354 static void Write(Message* m, const param_type& p);
353 355
354 // Note: This function expects parameter |r| to be of type &SkBitmap since 356 // Note: This function expects parameter |r| to be of type &SkBitmap since
355 // r->SetConfig() and r->SetPixels() are called. 357 // r->SetConfig() and r->SetPixels() are called.
356 static bool Read(const Message* m, void** iter, param_type* r); 358 static bool Read(const Message* m, void** iter, param_type* r);
357 359
358 static void Log(const param_type& p, std::wstring* l); 360 static void Log(const param_type& p, std::wstring* l);
359 }; 361 };
360 362
361 template <> 363 template <>
364 struct ParamTraits<DictionaryValue> {
365 typedef DictionaryValue param_type;
366 static void Write(Message* m, const param_type& p);
367 static bool Read(const Message* m, void** iter, param_type* r);
368 static void Log(const param_type& p, std::wstring* l);
369 };
370
371 template <>
372 struct ParamTraits<ListValue> {
373 typedef ListValue param_type;
374 static void Write(Message* m, const param_type& p);
375 static bool Read(const Message* m, void** iter, param_type* r);
376 static void Log(const param_type& p, std::wstring* l);
377 };
378
379 template <>
362 struct ParamTraits<std::string> { 380 struct ParamTraits<std::string> {
363 typedef std::string param_type; 381 typedef std::string param_type;
364 static void Write(Message* m, const param_type& p) { 382 static void Write(Message* m, const param_type& p) {
365 m->WriteString(p); 383 m->WriteString(p);
366 } 384 }
367 static bool Read(const Message* m, void** iter, param_type* r) { 385 static bool Read(const Message* m, void** iter, param_type* r) {
368 return m->ReadString(iter, r); 386 return m->ReadString(iter, r);
369 } 387 }
370 static void Log(const param_type& p, std::wstring* l) { 388 static void Log(const param_type& p, std::wstring* l) {
371 l->append(UTF8ToWide(p)); 389 l->append(UTF8ToWide(p));
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 ReplyParam p(a, b, c, d, e); 1363 ReplyParam p(a, b, c, d, e);
1346 WriteParam(reply, p); 1364 WriteParam(reply, p);
1347 } 1365 }
1348 }; 1366 };
1349 1367
1350 //----------------------------------------------------------------------------- 1368 //-----------------------------------------------------------------------------
1351 1369
1352 } // namespace IPC 1370 } // namespace IPC
1353 1371
1354 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_ 1372 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/common/ipc_message_unittest.cc ('k') | chrome/common/ipc_message_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698