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 // On Mac we don't have windowed plugins. We use a NULL/0 PluginWindowHandle |
220 // in shared code to indicate there is no window present. | 220 // in shared code to indicate there is no window present. |
221 typedef bool PluginWindowHandle; | 221 typedef bool PluginWindowHandle; |
222 const PluginWindowHandle kNullPluginWindow = 0; | 222 const PluginWindowHandle kNullPluginWindow = 0; |
223 #endif | 223 #endif |
224 | 224 |
225 enum SurfaceType { | 225 enum SurfaceType { |
226 EMPTY, | 226 EMPTY, |
227 NATIVE_DIRECT, | 227 NATIVE_DIRECT, |
228 NULL_TRANSPORT, | 228 NULL_TRANSPORT, |
229 SURFACE_TYPE_LAST = NULL_TRANSPORT | 229 SURFACE_TYPE_LAST = NULL_TRANSPORT |
230 }; | 230 }; |
231 | 231 |
232 struct GLSurfaceHandle { | 232 struct GLSurfaceHandle { |
233 GLSurfaceHandle() | 233 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_) | 234 GLSurfaceHandle(PluginWindowHandle handle_, SurfaceType transport_) |
239 : handle(handle_), | 235 : handle(handle_), transport_type(transport_) { |
240 transport_type(transport_), | |
241 parent_client_id(0) { | |
242 DCHECK(!is_null() || handle == kNullPluginWindow); | 236 DCHECK(!is_null() || handle == kNullPluginWindow); |
243 DCHECK(transport_type != NULL_TRANSPORT || | 237 DCHECK(transport_type != NULL_TRANSPORT || |
244 handle == kNullPluginWindow); | 238 handle == kNullPluginWindow); |
245 } | 239 } |
246 bool is_null() const { return transport_type == EMPTY; } | 240 bool is_null() const { return transport_type == EMPTY; } |
247 bool is_transport() const { | 241 bool is_transport() const { |
248 return transport_type == NULL_TRANSPORT; | 242 return transport_type == NULL_TRANSPORT; |
249 } | 243 } |
250 PluginWindowHandle handle; | 244 PluginWindowHandle handle; |
251 SurfaceType transport_type; | 245 SurfaceType transport_type; |
252 uint32 parent_client_id; | |
253 }; | 246 }; |
254 | 247 |
255 // AcceleratedWidget provides a surface to compositors to paint pixels. | 248 // AcceleratedWidget provides a surface to compositors to paint pixels. |
256 #if defined(OS_WIN) | 249 #if defined(OS_WIN) |
257 typedef HWND AcceleratedWidget; | 250 typedef HWND AcceleratedWidget; |
258 const AcceleratedWidget kNullAcceleratedWidget = NULL; | 251 const AcceleratedWidget kNullAcceleratedWidget = NULL; |
259 #elif defined(USE_X11) | 252 #elif defined(USE_X11) |
260 typedef unsigned long AcceleratedWidget; | 253 typedef unsigned long AcceleratedWidget; |
261 const AcceleratedWidget kNullAcceleratedWidget = 0; | 254 const AcceleratedWidget kNullAcceleratedWidget = 0; |
262 #elif defined(OS_IOS) | 255 #elif defined(OS_IOS) |
263 typedef UIView* AcceleratedWidget; | 256 typedef UIView* AcceleratedWidget; |
264 const AcceleratedWidget kNullAcceleratedWidget = 0; | 257 const AcceleratedWidget kNullAcceleratedWidget = 0; |
265 #elif defined(OS_MACOSX) | 258 #elif defined(OS_MACOSX) |
266 typedef NSView* AcceleratedWidget; | 259 typedef NSView* AcceleratedWidget; |
267 const AcceleratedWidget kNullAcceleratedWidget = 0; | 260 const AcceleratedWidget kNullAcceleratedWidget = 0; |
268 #elif defined(OS_ANDROID) | 261 #elif defined(OS_ANDROID) |
269 typedef ANativeWindow* AcceleratedWidget; | 262 typedef ANativeWindow* AcceleratedWidget; |
270 const AcceleratedWidget kNullAcceleratedWidget = 0; | 263 const AcceleratedWidget kNullAcceleratedWidget = 0; |
271 #elif defined(USE_OZONE) | 264 #elif defined(USE_OZONE) |
272 typedef intptr_t AcceleratedWidget; | 265 typedef intptr_t AcceleratedWidget; |
273 const AcceleratedWidget kNullAcceleratedWidget = 0; | 266 const AcceleratedWidget kNullAcceleratedWidget = 0; |
274 #else | 267 #else |
275 #error unknown platform | 268 #error unknown platform |
276 #endif | 269 #endif |
277 | 270 |
278 } // namespace gfx | 271 } // namespace gfx |
279 | 272 |
280 #endif // UI_GFX_NATIVE_WIDGET_TYPES_H_ | 273 #endif // UI_GFX_NATIVE_WIDGET_TYPES_H_ |
OLD | NEW |