| OLD | NEW |
| 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 #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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "ui/base/ui_export.h" | 10 #include "ui/base/ui_export.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 @class NSView; | 48 @class NSView; |
| 49 @class NSWindow; | 49 @class NSWindow; |
| 50 @class NSTextField; | 50 @class NSTextField; |
| 51 #else | 51 #else |
| 52 class NSFont; | 52 class NSFont; |
| 53 class NSImage; | 53 class NSImage; |
| 54 class NSView; | 54 class NSView; |
| 55 class NSWindow; | 55 class NSWindow; |
| 56 class NSTextField; | 56 class NSTextField; |
| 57 #endif // __OBJC__ | 57 #endif // __OBJC__ |
| 58 #elif defined(USE_WAYLAND) |
| 59 typedef struct _PangoFontDescription PangoFontDescription; |
| 60 typedef struct _cairo cairo_t; |
| 61 typedef struct _GdkPixbuf GdkPixbuf; |
| 62 struct wl_egl_window; |
| 63 |
| 64 namespace ui { |
| 65 class WaylandWindow; |
| 66 class WaylandCursor; |
| 67 } |
| 68 |
| 69 typedef struct _GdkRegion GdkRegion; |
| 58 #elif defined(TOOLKIT_USES_GTK) | 70 #elif defined(TOOLKIT_USES_GTK) |
| 59 typedef struct _PangoFontDescription PangoFontDescription; | 71 typedef struct _PangoFontDescription PangoFontDescription; |
| 60 typedef struct _GdkCursor GdkCursor; | 72 typedef struct _GdkCursor GdkCursor; |
| 61 typedef struct _GdkPixbuf GdkPixbuf; | 73 typedef struct _GdkPixbuf GdkPixbuf; |
| 62 typedef struct _GdkRegion GdkRegion; | 74 typedef struct _GdkRegion GdkRegion; |
| 63 typedef struct _GtkWidget GtkWidget; | 75 typedef struct _GtkWidget GtkWidget; |
| 64 typedef struct _GtkWindow GtkWindow; | 76 typedef struct _GtkWindow GtkWindow; |
| 65 typedef struct _cairo cairo_t; | 77 typedef struct _cairo cairo_t; |
| 66 #endif | 78 #endif |
| 67 class SkBitmap; | 79 class SkBitmap; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 80 typedef IAccessible* NativeViewAccessible; | 92 typedef IAccessible* NativeViewAccessible; |
| 81 #elif defined(OS_MACOSX) | 93 #elif defined(OS_MACOSX) |
| 82 typedef NSFont* NativeFont; | 94 typedef NSFont* NativeFont; |
| 83 typedef NSView* NativeView; | 95 typedef NSView* NativeView; |
| 84 typedef NSWindow* NativeWindow; | 96 typedef NSWindow* NativeWindow; |
| 85 typedef NSTextField* NativeEditView; | 97 typedef NSTextField* NativeEditView; |
| 86 typedef CGContext* NativeDrawingContext; | 98 typedef CGContext* NativeDrawingContext; |
| 87 typedef void* NativeCursor; | 99 typedef void* NativeCursor; |
| 88 typedef void* NativeMenu; | 100 typedef void* NativeMenu; |
| 89 typedef void* NativeViewAccessible; | 101 typedef void* NativeViewAccessible; |
| 102 #elif defined(USE_WAYLAND) |
| 103 typedef PangoFontDescription* NativeFont; |
| 104 typedef ui::WaylandWindow* NativeView; |
| 105 typedef ui::WaylandWindow* NativeWindow; |
| 106 typedef void* NativeEditView; |
| 107 typedef cairo_t* NativeDrawingContext; |
| 108 typedef void* NativeCursor; |
| 109 typedef void* NativeMenu; |
| 110 // TODO(dnicoara) This should be replaced with a cairo region or maybe |
| 111 // a Wayland specific region |
| 112 typedef GdkRegion* NativeRegion; |
| 113 typedef void* NativeViewAccessible; |
| 90 #elif defined(USE_X11) | 114 #elif defined(USE_X11) |
| 91 typedef PangoFontDescription* NativeFont; | 115 typedef PangoFontDescription* NativeFont; |
| 92 typedef GtkWidget* NativeView; | 116 typedef GtkWidget* NativeView; |
| 93 typedef GtkWindow* NativeWindow; | 117 typedef GtkWindow* NativeWindow; |
| 94 typedef GtkWidget* NativeEditView; | 118 typedef GtkWidget* NativeEditView; |
| 95 typedef cairo_t* NativeDrawingContext; | 119 typedef cairo_t* NativeDrawingContext; |
| 96 typedef GdkCursor* NativeCursor; | 120 typedef GdkCursor* NativeCursor; |
| 97 typedef GtkWidget* NativeMenu; | 121 typedef GtkWidget* NativeMenu; |
| 98 typedef GdkRegion* NativeRegion; | 122 typedef GdkRegion* NativeRegion; |
| 99 typedef void* NativeViewAccessible; | 123 typedef void* NativeViewAccessible; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 158 |
| 135 // Please do not call this from outside the browser. It won't work; the name | 159 // Please do not call this from outside the browser. It won't work; the name |
| 136 // should give you a subtle hint. | 160 // should give you a subtle hint. |
| 137 static inline NativeView NativeViewFromIdInBrowser(NativeViewId id) { | 161 static inline NativeView NativeViewFromIdInBrowser(NativeViewId id) { |
| 138 return reinterpret_cast<NativeView>(id); | 162 return reinterpret_cast<NativeView>(id); |
| 139 } | 163 } |
| 140 #endif // defined(OS_POSIX) | 164 #endif // defined(OS_POSIX) |
| 141 | 165 |
| 142 // Convert a NativeView to a NativeViewId. See the comments at the top of | 166 // Convert a NativeView to a NativeViewId. See the comments at the top of |
| 143 // this file. | 167 // this file. |
| 144 #if defined(OS_WIN) || defined(OS_MACOSX) | 168 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(USE_WAYLAND) |
| 145 static inline NativeViewId IdFromNativeView(NativeView view) { | 169 static inline NativeViewId IdFromNativeView(NativeView view) { |
| 146 return reinterpret_cast<NativeViewId>(view); | 170 return reinterpret_cast<NativeViewId>(view); |
| 147 } | 171 } |
| 148 #elif defined(USE_X11) | 172 #elif defined(USE_X11) |
| 149 // Not inlined because it involves pulling too many headers. | 173 // Not inlined because it involves pulling too many headers. |
| 150 UI_EXPORT NativeViewId IdFromNativeView(NativeView view); | 174 UI_EXPORT NativeViewId IdFromNativeView(NativeView view); |
| 151 #endif // defined(USE_X11) | 175 #endif // defined(USE_X11) |
| 152 | 176 |
| 153 | 177 |
| 154 // PluginWindowHandle is an abstraction wrapping "the types of windows | 178 // PluginWindowHandle is an abstraction wrapping "the types of windows |
| 155 // used by NPAPI plugins". On Windows it's an HWND, on X it's an X | 179 // used by NPAPI plugins". On Windows it's an HWND, on X it's an X |
| 156 // window id. | 180 // window id. |
| 157 #if defined(OS_WIN) | 181 #if defined(OS_WIN) |
| 158 typedef HWND PluginWindowHandle; | 182 typedef HWND PluginWindowHandle; |
| 159 const PluginWindowHandle kNullPluginWindow = NULL; | 183 const PluginWindowHandle kNullPluginWindow = NULL; |
| 184 #elif defined(USE_WAYLAND) |
| 185 typedef struct wl_egl_window* PluginWindowHandle; |
| 186 const PluginWindowHandle kNullPluginWindow = NULL; |
| 160 #elif defined(USE_X11) | 187 #elif defined(USE_X11) |
| 161 typedef unsigned long PluginWindowHandle; | 188 typedef unsigned long PluginWindowHandle; |
| 162 const PluginWindowHandle kNullPluginWindow = 0; | 189 const PluginWindowHandle kNullPluginWindow = 0; |
| 163 #else | 190 #else |
| 164 // On OS X we don't have windowed plugins. | 191 // On OS X we don't have windowed plugins. |
| 165 // We use a NULL/0 PluginWindowHandle in shared code to indicate there | 192 // We use a NULL/0 PluginWindowHandle in shared code to indicate there |
| 166 // is no window present, so mirror that behavior here. | 193 // is no window present, so mirror that behavior here. |
| 167 // | 194 // |
| 168 // The GPU plugin is currently an exception to this rule. As of this | 195 // The GPU plugin is currently an exception to this rule. As of this |
| 169 // writing it uses some NPAPI infrastructure, and minimally we need | 196 // writing it uses some NPAPI infrastructure, and minimally we need |
| 170 // to identify the plugin instance via this window handle. When the | 197 // to identify the plugin instance via this window handle. When the |
| 171 // GPU plugin becomes a full-on GPU process, this typedef can be | 198 // GPU plugin becomes a full-on GPU process, this typedef can be |
| 172 // returned to a bool. For now we use a type large enough to hold a | 199 // returned to a bool. For now we use a type large enough to hold a |
| 173 // pointer on 64-bit architectures in case we need this capability. | 200 // pointer on 64-bit architectures in case we need this capability. |
| 174 typedef uint64 PluginWindowHandle; | 201 typedef uint64 PluginWindowHandle; |
| 175 const PluginWindowHandle kNullPluginWindow = 0; | 202 const PluginWindowHandle kNullPluginWindow = 0; |
| 176 #endif | 203 #endif |
| 177 | 204 |
| 178 // AcceleratedWidget provides a surface to compositors to paint pixels. | 205 // AcceleratedWidget provides a surface to compositors to paint pixels. |
| 179 #if defined(OS_WIN) | 206 #if defined(OS_WIN) |
| 180 typedef HWND AcceleratedWidget; | 207 typedef HWND AcceleratedWidget; |
| 181 const AcceleratedWidget kNullAcceleratedWidget = NULL; | 208 const AcceleratedWidget kNullAcceleratedWidget = NULL; |
| 209 #elif defined(USE_WAYLAND) |
| 210 typedef struct wl_egl_window* AcceleratedWidget; |
| 211 const AcceleratedWidget kNullAcceleratedWidget = NULL; |
| 182 #elif defined(USE_X11) | 212 #elif defined(USE_X11) |
| 183 typedef unsigned long AcceleratedWidget; | 213 typedef unsigned long AcceleratedWidget; |
| 184 const AcceleratedWidget kNullAcceleratedWidget = 0; | 214 const AcceleratedWidget kNullAcceleratedWidget = 0; |
| 185 #else | 215 #else |
| 186 typedef void* AcceleratedWidget; | 216 typedef void* AcceleratedWidget; |
| 187 const AcceleratedWidget kNullAcceleratedWidget = NULL; | 217 const AcceleratedWidget kNullAcceleratedWidget = NULL; |
| 188 #endif | 218 #endif |
| 189 | 219 |
| 190 } // namespace gfx | 220 } // namespace gfx |
| 191 | 221 |
| 192 #endif // UI_GFX_NATIVE_WIDGET_TYPES_H_ | 222 #endif // UI_GFX_NATIVE_WIDGET_TYPES_H_ |
| OLD | NEW |