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_H_ | 5 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_ |
6 #define CHROME_COMMON_RENDER_MESSAGES_H_ | 6 #define CHROME_COMMON_RENDER_MESSAGES_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 enum Action { | 140 enum Action { |
141 kClearSelection, | 141 kClearSelection, |
142 kKeepSelection, | 142 kKeepSelection, |
143 kActivateSelection | 143 kActivateSelection |
144 }; | 144 }; |
145 | 145 |
146 // The action that should be taken when the find is completed. | 146 // The action that should be taken when the find is completed. |
147 Action action; | 147 Action action; |
148 }; | 148 }; |
149 | 149 |
150 // The install state of the search provider (not installed, installed, default). | |
151 struct ViewHostMsg_GetSearchProviderInstallState_Params { | |
152 enum State { | |
153 // Equates to an access denied error. | |
154 DENIED = -1, | |
155 | |
156 // DON'T CHANGE THE VALUES BELOW. | |
157 // All of the following values are manidated by the | |
158 // spec for window.external.IsSearchProviderInstalled. | |
159 | |
160 // The search provider is not installed. | |
161 NOT_INSTALLED = 0, | |
162 | |
163 // The search provider is in the user's set but is not | |
164 INSTALLED_BUT_NOT_DEFAULT = 1, | |
165 | |
166 // The search provider is set as the user's default. | |
167 INSTALLED_AS_DEFAULT = 2 | |
168 }; | |
169 State state; | |
170 | |
171 ViewHostMsg_GetSearchProviderInstallState_Params() | |
172 : state(DENIED) { | |
sky
2010/07/15 23:24:49
indent 4
| |
173 } | |
174 | |
175 explicit ViewHostMsg_GetSearchProviderInstallState_Params(State s) | |
176 : state(s) { | |
sky
2010/07/15 23:24:49
indent 4
| |
177 } | |
178 | |
179 static ViewHostMsg_GetSearchProviderInstallState_Params Denied() { | |
180 return ViewHostMsg_GetSearchProviderInstallState_Params(DENIED); | |
181 } | |
182 | |
183 static ViewHostMsg_GetSearchProviderInstallState_Params NotInstalled() { | |
184 return ViewHostMsg_GetSearchProviderInstallState_Params(NOT_INSTALLED); | |
185 } | |
186 | |
187 static ViewHostMsg_GetSearchProviderInstallState_Params | |
188 InstallButNotDefault() { | |
189 return ViewHostMsg_GetSearchProviderInstallState_Params( | |
190 INSTALLED_BUT_NOT_DEFAULT); | |
191 } | |
192 | |
193 static ViewHostMsg_GetSearchProviderInstallState_Params InstalledAsDefault() { | |
194 return ViewHostMsg_GetSearchProviderInstallState_Params( | |
195 INSTALLED_AS_DEFAULT); | |
196 } | |
197 }; | |
198 | |
199 | |
150 // Parameters structure for ViewHostMsg_FrameNavigate, which has too many data | 200 // Parameters structure for ViewHostMsg_FrameNavigate, which has too many data |
151 // parameters to be reasonably put in a predefined IPC message. | 201 // parameters to be reasonably put in a predefined IPC message. |
152 struct ViewHostMsg_FrameNavigate_Params { | 202 struct ViewHostMsg_FrameNavigate_Params { |
153 // Page ID of this navigation. The renderer creates a new unique page ID | 203 // Page ID of this navigation. The renderer creates a new unique page ID |
154 // anytime a new session history entry is created. This means you'll get new | 204 // anytime a new session history entry is created. This means you'll get new |
155 // page IDs for user actions, and the old page IDs will be reloaded when | 205 // page IDs for user actions, and the old page IDs will be reloaded when |
156 // iframes are loaded automatically. | 206 // iframes are loaded automatically. |
157 int32 page_id; | 207 int32 page_id; |
158 | 208 |
159 // URL of the page being loaded. | 209 // URL of the page being loaded. |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
942 static bool Read(const Message* m, void** iter, param_type* p) { | 992 static bool Read(const Message* m, void** iter, param_type* p) { |
943 return( | 993 return( |
944 ReadParam(m, iter, &p->font_name) && | 994 ReadParam(m, iter, &p->font_name) && |
945 ReadParam(m, iter, &p->font_point_size)); | 995 ReadParam(m, iter, &p->font_point_size)); |
946 } | 996 } |
947 static void Log(const param_type& p, std::wstring* l) { | 997 static void Log(const param_type& p, std::wstring* l) { |
948 l->append(L"<FontDescriptor>"); | 998 l->append(L"<FontDescriptor>"); |
949 } | 999 } |
950 }; | 1000 }; |
951 | 1001 |
1002 // Traits for ViewHostMsg_GetSearchProviderInstallState_Params structure to | |
1003 // pack/unpack. | |
1004 template <> | |
1005 struct ParamTraits<ViewHostMsg_GetSearchProviderInstallState_Params> { | |
1006 typedef ViewHostMsg_GetSearchProviderInstallState_Params param_type; | |
1007 static void Write(Message* m, const param_type& p) { | |
1008 m->WriteInt(p.state); | |
1009 } | |
1010 static bool Read(const Message* m, void** iter, param_type* p) { | |
1011 int type; | |
1012 if (!m->ReadInt(iter, &type)) | |
1013 return false; | |
1014 p->state = static_cast<param_type::State>(type); | |
1015 return true; | |
1016 } | |
1017 static void Log(const param_type& p, std::wstring* l) { | |
1018 std::wstring state; | |
1019 switch (p.state) { | |
1020 case ViewHostMsg_GetSearchProviderInstallState_Params::DENIED: | |
1021 state = L"ViewHostMsg_GetSearchProviderInstallState_Params::DENIED"; | |
1022 break; | |
1023 case ViewHostMsg_GetSearchProviderInstallState_Params::NOT_INSTALLED: | |
1024 state = | |
1025 L"ViewHostMsg_GetSearchProviderInstallState_Params::NOT_INSTALLED"; | |
1026 break; | |
1027 case ViewHostMsg_GetSearchProviderInstallState_Params:: | |
1028 INSTALLED_BUT_NOT_DEFAULT: | |
1029 state = L"ViewHostMsg_GetSearchProviderInstallState_Params::" | |
1030 L"INSTALLED_BUT_NOT_DEFAULT"; | |
1031 break; | |
1032 case ViewHostMsg_GetSearchProviderInstallState_Params:: | |
1033 INSTALLED_AS_DEFAULT: | |
1034 state = L"ViewHostMsg_GetSearchProviderInstallState_Params::" | |
1035 L"INSTALLED_AS_DEFAULT"; | |
1036 break; | |
1037 default: | |
1038 state = L"UNKNOWN"; | |
1039 break; | |
1040 } | |
1041 LogParam(state, l); | |
1042 } | |
1043 }; | |
1044 | |
952 // Traits for ViewHostMsg_FrameNavigate_Params structure to pack/unpack. | 1045 // Traits for ViewHostMsg_FrameNavigate_Params structure to pack/unpack. |
953 template <> | 1046 template <> |
954 struct ParamTraits<ViewHostMsg_FrameNavigate_Params> { | 1047 struct ParamTraits<ViewHostMsg_FrameNavigate_Params> { |
955 typedef ViewHostMsg_FrameNavigate_Params param_type; | 1048 typedef ViewHostMsg_FrameNavigate_Params param_type; |
956 static void Write(Message* m, const param_type& p) { | 1049 static void Write(Message* m, const param_type& p) { |
957 WriteParam(m, p.page_id); | 1050 WriteParam(m, p.page_id); |
958 WriteParam(m, p.url); | 1051 WriteParam(m, p.url); |
959 WriteParam(m, p.referrer); | 1052 WriteParam(m, p.referrer); |
960 WriteParam(m, p.transition); | 1053 WriteParam(m, p.transition); |
961 WriteParam(m, p.redirects); | 1054 WriteParam(m, p.redirects); |
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3093 l->append(L")"); | 3186 l->append(L")"); |
3094 } | 3187 } |
3095 }; | 3188 }; |
3096 | 3189 |
3097 } // namespace IPC | 3190 } // namespace IPC |
3098 | 3191 |
3099 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" | 3192 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" |
3100 #include "ipc/ipc_message_macros.h" | 3193 #include "ipc/ipc_message_macros.h" |
3101 | 3194 |
3102 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ | 3195 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ |
OLD | NEW |