Chromium Code Reviews| 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/ui_api.h" | 10 #include "ui/ui_api.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 class WaylandWindow; | |
| 64 class WaylandCursor; | |
| 65 typedef struct _GdkRegion GdkRegion; | |
| 58 #elif defined(TOOLKIT_USES_GTK) | 66 #elif defined(TOOLKIT_USES_GTK) |
| 59 typedef struct _PangoFontDescription PangoFontDescription; | 67 typedef struct _PangoFontDescription PangoFontDescription; |
| 60 typedef struct _GdkCursor GdkCursor; | 68 typedef struct _GdkCursor GdkCursor; |
| 61 typedef struct _GdkPixbuf GdkPixbuf; | 69 typedef struct _GdkPixbuf GdkPixbuf; |
| 62 typedef struct _GdkRegion GdkRegion; | 70 typedef struct _GdkRegion GdkRegion; |
| 63 typedef struct _GtkWidget GtkWidget; | 71 typedef struct _GtkWidget GtkWidget; |
| 64 typedef struct _GtkWindow GtkWindow; | 72 typedef struct _GtkWindow GtkWindow; |
| 65 typedef struct _cairo cairo_t; | 73 typedef struct _cairo cairo_t; |
| 66 #endif | 74 #endif |
| 67 class SkBitmap; | 75 class SkBitmap; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 80 typedef IAccessible* NativeViewAccessible; | 88 typedef IAccessible* NativeViewAccessible; |
| 81 #elif defined(OS_MACOSX) | 89 #elif defined(OS_MACOSX) |
| 82 typedef NSFont* NativeFont; | 90 typedef NSFont* NativeFont; |
| 83 typedef NSView* NativeView; | 91 typedef NSView* NativeView; |
| 84 typedef NSWindow* NativeWindow; | 92 typedef NSWindow* NativeWindow; |
| 85 typedef NSTextField* NativeEditView; | 93 typedef NSTextField* NativeEditView; |
| 86 typedef CGContext* NativeDrawingContext; | 94 typedef CGContext* NativeDrawingContext; |
| 87 typedef void* NativeCursor; | 95 typedef void* NativeCursor; |
| 88 typedef void* NativeMenu; | 96 typedef void* NativeMenu; |
| 89 typedef void* NativeViewAccessible; | 97 typedef void* NativeViewAccessible; |
| 98 #elif defined(USE_WAYLAND) | |
| 99 typedef PangoFontDescription* NativeFont; | |
| 100 typedef WaylandWindow* NativeView; | |
| 101 typedef WaylandWindow* NativeWindow; | |
| 102 typedef void* NativeEditView; | |
| 103 typedef cairo_t* NativeDrawingContext; | |
| 104 typedef void* NativeCursor; | |
| 105 typedef void* NativeMenu; | |
| 106 // TODO This should be replaced with a cairo region or maybe | |
|
jonathan.backer
2011/07/26 14:56:27
TODO almost always has an LDAP (e.g. TODO(dnicoara
| |
| 107 // a Wayland specific region | |
| 108 typedef GdkRegion* NativeRegion; | |
| 109 typedef void* NativeViewAccessible; | |
| 90 #elif defined(USE_X11) | 110 #elif defined(USE_X11) |
| 91 typedef PangoFontDescription* NativeFont; | 111 typedef PangoFontDescription* NativeFont; |
| 92 typedef GtkWidget* NativeView; | 112 typedef GtkWidget* NativeView; |
| 93 typedef GtkWindow* NativeWindow; | 113 typedef GtkWindow* NativeWindow; |
| 94 typedef GtkWidget* NativeEditView; | 114 typedef GtkWidget* NativeEditView; |
| 95 typedef cairo_t* NativeDrawingContext; | 115 typedef cairo_t* NativeDrawingContext; |
| 96 typedef GdkCursor* NativeCursor; | 116 typedef GdkCursor* NativeCursor; |
| 97 typedef GtkWidget* NativeMenu; | 117 typedef GtkWidget* NativeMenu; |
| 98 typedef GdkRegion* NativeRegion; | 118 typedef GdkRegion* NativeRegion; |
| 99 typedef void* NativeViewAccessible; | 119 typedef void* NativeViewAccessible; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 return reinterpret_cast<NativeView>(id); | 158 return reinterpret_cast<NativeView>(id); |
| 139 } | 159 } |
| 140 #endif // defined(OS_POSIX) | 160 #endif // defined(OS_POSIX) |
| 141 | 161 |
| 142 // Convert a NativeView to a NativeViewId. See the comments at the top of | 162 // Convert a NativeView to a NativeViewId. See the comments at the top of |
| 143 // this file. | 163 // this file. |
| 144 #if defined(OS_WIN) || defined(OS_MACOSX) | 164 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 145 static inline NativeViewId IdFromNativeView(NativeView view) { | 165 static inline NativeViewId IdFromNativeView(NativeView view) { |
| 146 return reinterpret_cast<NativeViewId>(view); | 166 return reinterpret_cast<NativeViewId>(view); |
| 147 } | 167 } |
| 168 #elif defined(USE_WAYLAND) | |
|
jonathan.backer
2011/07/26 14:56:27
Isn't this exactly the same as above? (e.g. roll i
| |
| 169 static inline NativeViewId IdFromNativeView(NativeView view) { | |
| 170 return reinterpret_cast<NativeViewId>(view); | |
| 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_API NativeViewId IdFromNativeView(NativeView view); | 174 UI_API 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 |