OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_GFX_NATIVE_WIDGET_TYPES_H_ | 5 #ifndef UI_GFX_NATIVE_WIDGET_TYPES_H_ |
6 #define UI_GFX_NATIVE_WIDGET_TYPES_H_ | 6 #define UI_GFX_NATIVE_WIDGET_TYPES_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_ANDROID) | 10 #if defined(OS_ANDROID) |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // PluginWindowHandle is an abstraction wrapping "the types of windows | 203 // PluginWindowHandle is an abstraction wrapping "the types of windows |
204 // used by NPAPI plugins". On Windows it's an HWND, on X it's an X | 204 // used by NPAPI plugins". On Windows it's an HWND, on X it's an X |
205 // window id. | 205 // window id. |
206 #if defined(OS_WIN) | 206 #if defined(OS_WIN) |
207 typedef HWND PluginWindowHandle; | 207 typedef HWND PluginWindowHandle; |
208 const PluginWindowHandle kNullPluginWindow = NULL; | 208 const PluginWindowHandle kNullPluginWindow = NULL; |
209 #elif defined(USE_X11) | 209 #elif defined(USE_X11) |
210 typedef unsigned long PluginWindowHandle; | 210 typedef unsigned long PluginWindowHandle; |
211 const PluginWindowHandle kNullPluginWindow = 0; | 211 const PluginWindowHandle kNullPluginWindow = 0; |
212 #elif defined(OS_ANDROID) | 212 #elif defined(OS_ANDROID) |
213 typedef uint64 PluginWindowHandle; | 213 typedef uint32 PluginWindowHandle; |
214 const PluginWindowHandle kNullPluginWindow = 0; | 214 const PluginWindowHandle kNullPluginWindow = 0; |
215 #elif defined(USE_OZONE) | 215 #elif defined(USE_OZONE) |
216 typedef intptr_t PluginWindowHandle; | 216 typedef intptr_t PluginWindowHandle; |
217 const PluginWindowHandle kNullPluginWindow = 0; | 217 const PluginWindowHandle kNullPluginWindow = 0; |
218 #else | 218 #else |
219 // On Mac we don't have windowed plugins. We use a NULL/0 PluginWindowHandle | 219 typedef uint32 PluginWindowHandle; |
220 // in shared code to indicate there is no window present. | |
221 typedef bool PluginWindowHandle; | |
222 const PluginWindowHandle kNullPluginWindow = 0; | 220 const PluginWindowHandle kNullPluginWindow = 0; |
223 #endif | 221 #endif |
224 | 222 |
225 enum SurfaceType { | 223 enum SurfaceType { |
226 EMPTY, | 224 EMPTY, |
227 NATIVE_DIRECT, | 225 NATIVE_DIRECT, |
228 NULL_TRANSPORT, | 226 NULL_TRANSPORT, |
229 SURFACE_TYPE_LAST = NULL_TRANSPORT | 227 SURFACE_TYPE_LAST = NULL_TRANSPORT |
230 }; | 228 }; |
231 | 229 |
232 struct GLSurfaceHandle { | 230 struct GLSurfaceHandle { |
233 GLSurfaceHandle() | 231 GLSurfaceHandle() : handle(kNullPluginWindow), transport_type(EMPTY) {} |
234 : handle(kNullPluginWindow), | |
235 transport_type(EMPTY), | |
236 parent_client_id(0) { | |
237 } | |
238 GLSurfaceHandle(PluginWindowHandle handle_, SurfaceType transport_) | 232 GLSurfaceHandle(PluginWindowHandle handle_, SurfaceType transport_) |
239 : handle(handle_), | 233 : handle(handle_), transport_type(transport_) { |
240 transport_type(transport_), | |
241 parent_client_id(0) { | |
242 DCHECK(!is_null() || handle == kNullPluginWindow); | 234 DCHECK(!is_null() || handle == kNullPluginWindow); |
243 DCHECK(transport_type != NULL_TRANSPORT || | 235 DCHECK(transport_type != NULL_TRANSPORT || |
244 handle == kNullPluginWindow); | 236 handle == kNullPluginWindow); |
245 } | 237 } |
246 bool is_null() const { return transport_type == EMPTY; } | 238 bool is_null() const { return transport_type == EMPTY; } |
247 bool is_transport() const { | 239 bool is_transport() const { |
248 return transport_type == NULL_TRANSPORT; | 240 return transport_type == NULL_TRANSPORT; |
249 } | 241 } |
250 PluginWindowHandle handle; | 242 PluginWindowHandle handle; |
251 SurfaceType transport_type; | 243 SurfaceType transport_type; |
252 uint32 parent_client_id; | |
253 }; | 244 }; |
254 | 245 |
255 // AcceleratedWidget provides a surface to compositors to paint pixels. | 246 // AcceleratedWidget provides a surface to compositors to paint pixels. |
256 #if defined(OS_WIN) | 247 #if defined(OS_WIN) |
257 typedef HWND AcceleratedWidget; | 248 typedef HWND AcceleratedWidget; |
258 const AcceleratedWidget kNullAcceleratedWidget = NULL; | 249 const AcceleratedWidget kNullAcceleratedWidget = NULL; |
259 #elif defined(USE_X11) | 250 #elif defined(USE_X11) |
260 typedef unsigned long AcceleratedWidget; | 251 typedef unsigned long AcceleratedWidget; |
261 const AcceleratedWidget kNullAcceleratedWidget = 0; | 252 const AcceleratedWidget kNullAcceleratedWidget = 0; |
262 #elif defined(OS_IOS) | 253 #elif defined(OS_IOS) |
263 typedef UIView* AcceleratedWidget; | 254 typedef UIView* AcceleratedWidget; |
264 const AcceleratedWidget kNullAcceleratedWidget = 0; | 255 const AcceleratedWidget kNullAcceleratedWidget = 0; |
265 #elif defined(OS_MACOSX) | 256 #elif defined(OS_MACOSX) |
266 typedef NSView* AcceleratedWidget; | 257 typedef NSView* AcceleratedWidget; |
267 const AcceleratedWidget kNullAcceleratedWidget = 0; | 258 const AcceleratedWidget kNullAcceleratedWidget = 0; |
268 #elif defined(OS_ANDROID) | 259 #elif defined(OS_ANDROID) |
269 typedef ANativeWindow* AcceleratedWidget; | 260 typedef ANativeWindow* AcceleratedWidget; |
270 const AcceleratedWidget kNullAcceleratedWidget = 0; | 261 const AcceleratedWidget kNullAcceleratedWidget = 0; |
271 #elif defined(USE_OZONE) | 262 #elif defined(USE_OZONE) |
272 typedef intptr_t AcceleratedWidget; | 263 typedef intptr_t AcceleratedWidget; |
273 const AcceleratedWidget kNullAcceleratedWidget = 0; | 264 const AcceleratedWidget kNullAcceleratedWidget = 0; |
274 #else | 265 #else |
275 #error unknown platform | 266 #error unknown platform |
276 #endif | 267 #endif |
277 | 268 |
278 } // namespace gfx | 269 } // namespace gfx |
279 | 270 |
280 #endif // UI_GFX_NATIVE_WIDGET_TYPES_H_ | 271 #endif // UI_GFX_NATIVE_WIDGET_TYPES_H_ |
OLD | NEW |