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

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

Issue 6628035: Move resource related IPCs to their own file in 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
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 used by the content code, and which need 9 // specializations for types that are used by the content code, and which need
10 // manual serialization code. This is usually because they're not structs with 10 // manual serialization code. This is usually because they're not structs with
11 // public members.. 11 // public members..
12 12
13 #ifndef CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ 13 #ifndef CONTENT_COMMON_COMMON_PARAM_TRAITS_H_
14 #define CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ 14 #define CONTENT_COMMON_COMMON_PARAM_TRAITS_H_
15 #pragma once 15 #pragma once
16 16
17 #include "base/ref_counted.h"
17 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
18 #include "ipc/ipc_message_utils.h" 19 #include "ipc/ipc_message_utils.h"
20 #include "net/url_request/url_request_status.h"
19 // !!! WARNING: DO NOT ADD NEW WEBKIT DEPENDENCIES !!! 21 // !!! WARNING: DO NOT ADD NEW WEBKIT DEPENDENCIES !!!
20 // 22 //
21 // 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
22 // '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
23 // content/common/ for a mini-library that doesn't depend on webkit. 25 // content/common/ for a mini-library that doesn't depend on webkit.
24 26
27 // TODO(erg): The following headers are historical and only work because
28 // their definitions are inlined, which also needs to be fixed.
29 #include "webkit/glue/resource_type.h"
30
25 // Forward declarations. 31 // Forward declarations.
26 class GURL; 32 class GURL;
27 33
34 namespace net {
35 class HttpResponseHeaders;
36 class HostPortPair;
37 class UploadData;
38 }
39
40 namespace webkit_glue {
41 struct ResourceDevToolsInfo;
42 struct ResourceLoadTimingInfo;
43 }
44
28 namespace IPC { 45 namespace IPC {
29 46
30 template <> 47 template <>
31 struct ParamTraits<GURL> { 48 struct ParamTraits<GURL> {
32 typedef GURL param_type; 49 typedef GURL param_type;
33 static void Write(Message* m, const param_type& p); 50 static void Write(Message* m, const param_type& p);
34 static bool Read(const Message* m, void** iter, param_type* p); 51 static bool Read(const Message* m, void** iter, param_type* p);
35 static void Log(const param_type& p, std::string* l); 52 static void Log(const param_type& p, std::string* l);
36 }; 53 };
37 54
55 template <>
56 struct ParamTraits<ResourceType::Type> {
57 typedef ResourceType::Type param_type;
58 static void Write(Message* m, const param_type& p);
59 static bool Read(const Message* m, void** iter, param_type* p);
60 static void Log(const param_type& p, std::string* l);
61 };
62
63 template <>
64 struct ParamTraits<net::URLRequestStatus> {
65 typedef net::URLRequestStatus param_type;
66 static void Write(Message* m, const param_type& p);
67 static bool Read(const Message* m, void** iter, param_type* r);
68 static void Log(const param_type& p, std::string* l);
69 };
70
71 template <>
72 struct ParamTraits<scoped_refptr<net::UploadData> > {
73 typedef scoped_refptr<net::UploadData> param_type;
74 static void Write(Message* m, const param_type& p);
75 static bool Read(const Message* m, void** iter, param_type* r);
76 static void Log(const param_type& p, std::string* l);
77 };
78
79 template<>
80 struct ParamTraits<net::HostPortPair> {
81 typedef net::HostPortPair param_type;
82 static void Write(Message* m, const param_type& p);
83 static bool Read(const Message* m, void** iter, param_type* r);
84 static void Log(const param_type& p, std::string* l);
85 };
86
87 template <>
88 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > {
89 typedef scoped_refptr<net::HttpResponseHeaders> param_type;
90 static void Write(Message* m, const param_type& p);
91 static bool Read(const Message* m, void** iter, param_type* r);
92 static void Log(const param_type& p, std::string* l);
93 };
94
95 template <>
96 struct ParamTraits<webkit_glue::ResourceLoadTimingInfo> {
97 typedef webkit_glue::ResourceLoadTimingInfo param_type;
98 static void Write(Message* m, const param_type& p);
99 static bool Read(const Message* m, void** iter, param_type* r);
100 static void Log(const param_type& p, std::string* l);
101 };
102
103 template <>
104 struct ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> > {
105 typedef scoped_refptr<webkit_glue::ResourceDevToolsInfo> param_type;
106 static void Write(Message* m, const param_type& p);
107 static bool Read(const Message* m, void** iter, param_type* r);
108 static void Log(const param_type& p, std::string* l);
109 };
110
38 } // namespace IPC 111 } // namespace IPC
39 112
40 #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ 113 #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_
OLDNEW
« no previous file with comments | « content/browser/worker_host/worker_process_host.cc ('k') | content/common/common_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698