| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 BASE_GFX_NATIVE_WIDGET_TYPES_H_ | 5 #ifndef BASE_GFX_NATIVE_WIDGET_TYPES_H_ |
| 6 #define BASE_GFX_NATIVE_WIDGET_TYPES_H_ | 6 #define BASE_GFX_NATIVE_WIDGET_TYPES_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 struct CGContext; | 39 struct CGContext; |
| 40 #ifdef __OBJC__ | 40 #ifdef __OBJC__ |
| 41 @class NSView; | 41 @class NSView; |
| 42 @class NSWindow; | 42 @class NSWindow; |
| 43 @class NSTextField; | 43 @class NSTextField; |
| 44 #else | 44 #else |
| 45 class NSView; | 45 class NSView; |
| 46 class NSWindow; | 46 class NSWindow; |
| 47 class NSTextField; | 47 class NSTextField; |
| 48 #endif // __OBJC__ | 48 #endif // __OBJC__ |
| 49 #elif defined(OS_LINUX) | 49 #elif defined(USE_X11) |
| 50 typedef struct _GdkCursor GdkCursor; | 50 typedef struct _GdkCursor GdkCursor; |
| 51 typedef struct _GtkWidget GtkWidget; | 51 typedef struct _GtkWidget GtkWidget; |
| 52 typedef struct _GtkWindow GtkWindow; | 52 typedef struct _GtkWindow GtkWindow; |
| 53 typedef struct _cairo cairo_t; | 53 typedef struct _cairo cairo_t; |
| 54 #endif | 54 #endif |
| 55 | 55 |
| 56 namespace gfx { | 56 namespace gfx { |
| 57 | 57 |
| 58 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 59 typedef HWND NativeView; | 59 typedef HWND NativeView; |
| 60 typedef HWND NativeWindow; | 60 typedef HWND NativeWindow; |
| 61 typedef HWND NativeEditView; | 61 typedef HWND NativeEditView; |
| 62 typedef HDC NativeDrawingContext; | 62 typedef HDC NativeDrawingContext; |
| 63 typedef HCURSOR NativeCursor; | 63 typedef HCURSOR NativeCursor; |
| 64 typedef HMENU NativeMenu; | 64 typedef HMENU NativeMenu; |
| 65 #elif defined(OS_MACOSX) | 65 #elif defined(OS_MACOSX) |
| 66 typedef NSView* NativeView; | 66 typedef NSView* NativeView; |
| 67 typedef NSWindow* NativeWindow; | 67 typedef NSWindow* NativeWindow; |
| 68 typedef NSTextField* NativeEditView; | 68 typedef NSTextField* NativeEditView; |
| 69 typedef CGContext* NativeDrawingContext; | 69 typedef CGContext* NativeDrawingContext; |
| 70 typedef void* NativeCursor; | 70 typedef void* NativeCursor; |
| 71 typedef void* NativeMenu; | 71 typedef void* NativeMenu; |
| 72 #elif defined(OS_LINUX) | 72 #elif defined(USE_X11) |
| 73 typedef GtkWidget* NativeView; | 73 typedef GtkWidget* NativeView; |
| 74 typedef GtkWindow* NativeWindow; | 74 typedef GtkWindow* NativeWindow; |
| 75 typedef GtkWidget* NativeEditView; | 75 typedef GtkWidget* NativeEditView; |
| 76 typedef cairo_t* NativeDrawingContext; | 76 typedef cairo_t* NativeDrawingContext; |
| 77 typedef GdkCursor* NativeCursor; | 77 typedef GdkCursor* NativeCursor; |
| 78 typedef GtkWidget* NativeMenu; | 78 typedef GtkWidget* NativeMenu; |
| 79 #endif | 79 #endif |
| 80 | 80 |
| 81 // Note: for test_shell we're packing a pointer into the NativeViewId. So, if | 81 // Note: for test_shell we're packing a pointer into the NativeViewId. So, if |
| 82 // you make it a type which is smaller than a pointer, you have to fix | 82 // you make it a type which is smaller than a pointer, you have to fix |
| (...skipping 12 matching lines...) Expand all Loading... |
| 95 } | 95 } |
| 96 #elif defined(OS_MACOSX) | 96 #elif defined(OS_MACOSX) |
| 97 | 97 |
| 98 // A recent CL removed the need for Mac to actually convert | 98 // A recent CL removed the need for Mac to actually convert |
| 99 // NativeViewId to NativeView. Until other platforms make changes, | 99 // NativeViewId to NativeView. Until other platforms make changes, |
| 100 // the platform-independent code cannot be removed. The following is | 100 // the platform-independent code cannot be removed. The following is |
| 101 // to discourage new platform-independent uses. | 101 // to discourage new platform-independent uses. |
| 102 | 102 |
| 103 #define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILABLE_ON_MAC | 103 #define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILABLE_ON_MAC |
| 104 | 104 |
| 105 #elif defined(OS_LINUX) | 105 #elif defined(USE_X11) |
| 106 // A NativeView on Linux is a GtkWidget*. However, we can't go directly from an | 106 // A NativeView on Linux is a GtkWidget*. However, we can't go directly from an |
| 107 // X window ID to a GtkWidget. Thus, functions which handle NativeViewIds from | 107 // X window ID to a GtkWidget. Thus, functions which handle NativeViewIds from |
| 108 // the renderer have to use Xlib. This is fine since these functions are | 108 // the renderer have to use Xlib. This is fine since these functions are |
| 109 // generally performed on the BACKGROUND_X thread which can't use GTK anyway. | 109 // generally performed on the BACKGROUND_X thread which can't use GTK anyway. |
| 110 | 110 |
| 111 #define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILIBLE_ON_LINUX | 111 #define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILIBLE_ON_X11 |
| 112 | 112 |
| 113 #endif // defined(OS_LINUX) | 113 #endif // defined(USE_X11) |
| 114 | 114 |
| 115 // Convert a NativeView to a NativeViewId. See the comments above | 115 // Convert a NativeView to a NativeViewId. See the comments above |
| 116 // NativeViewFromId. | 116 // NativeViewFromId. |
| 117 #if defined(OS_WIN) || defined(OS_MACOSX) | 117 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 118 static inline NativeViewId IdFromNativeView(NativeView view) { | 118 static inline NativeViewId IdFromNativeView(NativeView view) { |
| 119 return reinterpret_cast<NativeViewId>(view); | 119 return reinterpret_cast<NativeViewId>(view); |
| 120 } | 120 } |
| 121 #elif defined(OS_LINUX) | 121 #elif defined(USE_X11) |
| 122 // Not inlined because it involves pulling too many headers. | 122 // Not inlined because it involves pulling too many headers. |
| 123 NativeViewId IdFromNativeView(NativeView view); | 123 NativeViewId IdFromNativeView(NativeView view); |
| 124 #endif // defined(OS_LINUX) | 124 #endif // defined(USE_X11) |
| 125 | 125 |
| 126 | 126 |
| 127 // PluginWindowHandle is an abstraction wrapping "the types of windows | 127 // PluginWindowHandle is an abstraction wrapping "the types of windows |
| 128 // used by NPAPI plugins". On Windows it's an HWND, on X it's an X | 128 // used by NPAPI plugins". On Windows it's an HWND, on X it's an X |
| 129 // window id. | 129 // window id. |
| 130 #if defined(OS_WIN) | 130 #if defined(OS_WIN) |
| 131 typedef HWND PluginWindowHandle; | 131 typedef HWND PluginWindowHandle; |
| 132 #elif defined(OS_LINUX) | 132 #elif defined(USE_X11) |
| 133 typedef unsigned long PluginWindowHandle; | 133 typedef unsigned long PluginWindowHandle; |
| 134 #else | 134 #else |
| 135 // On OS X we don't have windowed plugins. | 135 // On OS X we don't have windowed plugins. |
| 136 // We use a NULL/0 PluginWindowHandle in shared code to indicate there | 136 // We use a NULL/0 PluginWindowHandle in shared code to indicate there |
| 137 // is no window present, so mirror that behavior here. | 137 // is no window present, so mirror that behavior here. |
| 138 typedef bool PluginWindowHandle; | 138 typedef bool PluginWindowHandle; |
| 139 #endif | 139 #endif |
| 140 | 140 |
| 141 } // namespace gfx | 141 } // namespace gfx |
| 142 | 142 |
| 143 #endif // BASE_GFX_NATIVE_WIDGET_TYPES_H_ | 143 #endif // BASE_GFX_NATIVE_WIDGET_TYPES_H_ |
| OLD | NEW |