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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
83 // test_shell. | 83 // test_shell. |
84 // | 84 // |
85 // See comment at the top of the file for usage. | 85 // See comment at the top of the file for usage. |
86 typedef intptr_t NativeViewId; | 86 typedef intptr_t NativeViewId; |
87 | 87 |
88 // Convert a NativeViewId to a NativeView. | 88 // Convert a NativeViewId to a NativeView. |
89 // On Windows, these are both HWNDS so it's just a cast. | 89 // On Windows, these are both HWNDS so it's just a cast. |
90 // On Mac, for now, we pass the NSView pointer into the renderer | 90 // On Mac, for now, we pass the NSView pointer into the renderer |
91 // On Linux we use an opaque id | 91 // On Linux we use an opaque id |
92 #if defined(OS_WIN) || defined(OS_MACOSX) | 92 #if defined(OS_WIN) |
93 static inline NativeView NativeViewFromId(NativeViewId id) { | 93 static inline NativeView NativeViewFromId(NativeViewId id) { |
94 return reinterpret_cast<NativeView>(id); | 94 return reinterpret_cast<NativeView>(id); |
95 } | 95 } |
| 96 #elif defined(OS_MACOSX) |
| 97 |
| 98 // A recent CL removed the need for Mac to actually convert |
| 99 // NativeViewId to NativeView. Until other platforms make changes, |
| 100 // the platform-independent code cannot be removed. The following is |
| 101 // to discourage new platform-independent uses. |
| 102 |
| 103 #define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILABLE_ON_MAC |
| 104 |
96 #elif defined(OS_LINUX) | 105 #elif defined(OS_LINUX) |
97 // 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 |
98 // 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 |
99 // 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 |
100 // 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. |
101 | 110 |
102 #define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILIBLE_ON_LINUX | 111 #define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILIBLE_ON_LINUX |
103 | 112 |
104 #endif // defined(OS_LINUX) | 113 #endif // defined(OS_LINUX) |
105 | 114 |
(...skipping 19 matching lines...) Expand all Loading... |
125 #else | 134 #else |
126 // On OS X we don't have windowed plugins. | 135 // On OS X we don't have windowed plugins. |
127 // 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 |
128 // is no window present, so mirror that behavior here. | 137 // is no window present, so mirror that behavior here. |
129 typedef bool PluginWindowHandle; | 138 typedef bool PluginWindowHandle; |
130 #endif | 139 #endif |
131 | 140 |
132 } // namespace gfx | 141 } // namespace gfx |
133 | 142 |
134 #endif // BASE_GFX_NATIVE_WIDGET_TYPES_H_ | 143 #endif // BASE_GFX_NATIVE_WIDGET_TYPES_H_ |
OLD | NEW |