OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_RENDER_MESSAGES_PARAMS_H_ | 5 #ifndef CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ |
6 #define CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ | 6 #define CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/values.h" | |
12 #include "chrome/common/extensions/extension.h" | |
13 #include "chrome/common/extensions/extension_extent.h" | |
14 #include "chrome/common/extensions/url_pattern.h" | |
15 #include "googleurl/src/gurl.h" | |
16 #include "ipc/ipc_param_traits.h" | 11 #include "ipc/ipc_param_traits.h" |
17 | 12 |
18 namespace net { | |
19 class UploadData; | |
20 } | |
21 | |
22 // The type of OSDD that the renderer is giving to the browser. | 13 // The type of OSDD that the renderer is giving to the browser. |
23 struct ViewHostMsg_PageHasOSDD_Type { | 14 struct ViewHostMsg_PageHasOSDD_Type { |
24 enum Type { | 15 enum Type { |
25 // The Open Search Description URL was detected automatically. | 16 // The Open Search Description URL was detected automatically. |
26 AUTODETECTED_PROVIDER, | 17 AUTODETECTED_PROVIDER, |
27 | 18 |
28 // The Open Search Description URL was given by Javascript. | 19 // The Open Search Description URL was given by Javascript. |
29 EXPLICIT_PROVIDER, | 20 EXPLICIT_PROVIDER, |
30 | 21 |
31 // The Open Search Description URL was given by Javascript to be the new | 22 // The Open Search Description URL was given by Javascript to be the new |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return ViewHostMsg_GetSearchProviderInstallState_Params( | 88 return ViewHostMsg_GetSearchProviderInstallState_Params( |
98 INSTALLED_BUT_NOT_DEFAULT); | 89 INSTALLED_BUT_NOT_DEFAULT); |
99 } | 90 } |
100 | 91 |
101 static ViewHostMsg_GetSearchProviderInstallState_Params InstalledAsDefault() { | 92 static ViewHostMsg_GetSearchProviderInstallState_Params InstalledAsDefault() { |
102 return ViewHostMsg_GetSearchProviderInstallState_Params( | 93 return ViewHostMsg_GetSearchProviderInstallState_Params( |
103 INSTALLED_AS_DEFAULT); | 94 INSTALLED_AS_DEFAULT); |
104 } | 95 } |
105 }; | 96 }; |
106 | 97 |
107 // Allows an extension to execute code in a tab. | |
108 struct ViewMsg_ExecuteCode_Params { | |
109 ViewMsg_ExecuteCode_Params(); | |
110 ViewMsg_ExecuteCode_Params(int request_id, const std::string& extension_id, | |
111 bool is_javascript, const std::string& code, | |
112 bool all_frames); | |
113 ~ViewMsg_ExecuteCode_Params(); | |
114 | |
115 // The extension API request id, for responding. | |
116 int request_id; | |
117 | |
118 // The ID of the requesting extension. To know which isolated world to | |
119 // execute the code inside of. | |
120 std::string extension_id; | |
121 | |
122 // Whether the code is JavaScript or CSS. | |
123 bool is_javascript; | |
124 | |
125 // String of code to execute. | |
126 std::string code; | |
127 | |
128 // Whether to inject into all frames, or only the root frame. | |
129 bool all_frames; | |
130 }; | |
131 | |
132 struct ViewMsg_ExtensionLoaded_Params { | |
133 ViewMsg_ExtensionLoaded_Params(); | |
134 ~ViewMsg_ExtensionLoaded_Params(); | |
135 explicit ViewMsg_ExtensionLoaded_Params(const Extension* extension); | |
136 | |
137 // A copy constructor is needed because this structure can end up getting | |
138 // copied inside the IPC machinery on gcc <= 4.2. | |
139 ViewMsg_ExtensionLoaded_Params( | |
140 const ViewMsg_ExtensionLoaded_Params& other); | |
141 | |
142 // Creates a new extension from the data in this object. | |
143 scoped_refptr<Extension> ConvertToExtension() const; | |
144 | |
145 // The subset of the extension manifest data we send to renderers. | |
146 scoped_ptr<DictionaryValue> manifest; | |
147 | |
148 // The location the extension was installed from. | |
149 Extension::Location location; | |
150 | |
151 // The path the extension was loaded from. This is used in the renderer only | |
152 // to generate the extension ID for extensions that are loaded unpacked. | |
153 FilePath path; | |
154 | |
155 // We keep this separate so that it can be used in logging. | |
156 std::string id; | |
157 }; | |
158 | |
159 // Parameters structure for ViewHostMsg_ExtensionRequest. | |
160 struct ViewHostMsg_DomMessage_Params { | |
161 ViewHostMsg_DomMessage_Params(); | |
162 ~ViewHostMsg_DomMessage_Params(); | |
163 | |
164 // Message name. | |
165 std::string name; | |
166 | |
167 // List of message arguments. | |
168 ListValue arguments; | |
169 | |
170 // URL of the frame request was sent from. | |
171 GURL source_url; | |
172 | |
173 // Unique request id to match requests and responses. | |
174 int request_id; | |
175 | |
176 // True if request has a callback specified. | |
177 bool has_callback; | |
178 | |
179 // True if request is executed in response to an explicit user gesture. | |
180 bool user_gesture; | |
181 }; | |
182 | |
183 namespace IPC { | 98 namespace IPC { |
184 | 99 |
185 class Message; | 100 class Message; |
186 | 101 |
187 template <> | 102 template <> |
188 struct ParamTraits<ViewHostMsg_PageHasOSDD_Type> { | 103 struct ParamTraits<ViewHostMsg_PageHasOSDD_Type> { |
189 typedef ViewHostMsg_PageHasOSDD_Type param_type; | 104 typedef ViewHostMsg_PageHasOSDD_Type param_type; |
190 static void Write(Message* m, const param_type& p); | 105 static void Write(Message* m, const param_type& p); |
191 static bool Read(const Message* m, void** iter, param_type* p); | 106 static bool Read(const Message* m, void** iter, param_type* p); |
192 static void Log(const param_type& p, std::string* l); | 107 static void Log(const param_type& p, std::string* l); |
193 }; | 108 }; |
194 | 109 |
195 template <> | 110 template <> |
196 struct ParamTraits<ViewHostMsg_GetSearchProviderInstallState_Params> { | 111 struct ParamTraits<ViewHostMsg_GetSearchProviderInstallState_Params> { |
197 typedef ViewHostMsg_GetSearchProviderInstallState_Params param_type; | 112 typedef ViewHostMsg_GetSearchProviderInstallState_Params param_type; |
198 static void Write(Message* m, const param_type& p); | 113 static void Write(Message* m, const param_type& p); |
199 static bool Read(const Message* m, void** iter, param_type* p); | 114 static bool Read(const Message* m, void** iter, param_type* p); |
200 static void Log(const param_type& p, std::string* l); | 115 static void Log(const param_type& p, std::string* l); |
201 }; | 116 }; |
202 | 117 |
203 template <> | |
204 struct ParamTraits<ViewMsg_ExecuteCode_Params> { | |
205 typedef ViewMsg_ExecuteCode_Params param_type; | |
206 static void Write(Message* m, const param_type& p); | |
207 static bool Read(const Message* m, void** iter, param_type* p); | |
208 static void Log(const param_type& p, std::string* l); | |
209 }; | |
210 | |
211 template <> | |
212 struct ParamTraits<ViewMsg_ExtensionLoaded_Params> { | |
213 typedef ViewMsg_ExtensionLoaded_Params param_type; | |
214 static void Write(Message* m, const param_type& p); | |
215 static bool Read(const Message* m, void** iter, param_type* p); | |
216 static void Log(const param_type& p, std::string* l); | |
217 }; | |
218 | |
219 template <> | |
220 struct ParamTraits<ViewHostMsg_DomMessage_Params> { | |
221 typedef ViewHostMsg_DomMessage_Params param_type; | |
222 static void Write(Message* m, const param_type& p); | |
223 static bool Read(const Message* m, void** iter, param_type* p); | |
224 static void Log(const param_type& p, std::string* l); | |
225 }; | |
226 | |
227 } // namespace IPC | 118 } // namespace IPC |
228 | 119 |
229 #endif // CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ | 120 #endif // CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ |
OLD | NEW |