| 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 29 matching lines...) Expand all Loading... |
| 40 // | 40 // |
| 41 // The name 'View' here meshes with OS X where the UI elements are called | 41 // The name 'View' here meshes with OS X where the UI elements are called |
| 42 // 'views' and with our Chrome UI code where the elements are also called | 42 // 'views' and with our Chrome UI code where the elements are also called |
| 43 // 'views'. | 43 // 'views'. |
| 44 | 44 |
| 45 class SkRegion; | 45 class SkRegion; |
| 46 namespace ui { | 46 namespace ui { |
| 47 class Event; | 47 class Event; |
| 48 } | 48 } |
| 49 | 49 |
| 50 #if defined(OS_WIN) | 50 #if defined(OS_POSIX) |
| 51 #include <windows.h> // NOLINT | |
| 52 typedef struct HFONT__* HFONT; | |
| 53 struct IAccessible; | |
| 54 #elif defined(OS_IOS) | |
| 55 struct CGContext; | |
| 56 #ifdef __OBJC__ | |
| 57 @class UIEvent; | |
| 58 @class UIFont; | |
| 59 @class UIImage; | |
| 60 @class UIView; | |
| 61 @class UIWindow; | |
| 62 @class UITextField; | |
| 63 #else | |
| 64 class UIEvent; | |
| 65 class UIFont; | |
| 66 class UIImage; | |
| 67 class UIView; | |
| 68 class UIWindow; | |
| 69 class UITextField; | |
| 70 #endif // __OBJC__ | |
| 71 #elif defined(OS_MACOSX) | |
| 72 struct CGContext; | |
| 73 #ifdef __OBJC__ | |
| 74 @class NSCursor; | |
| 75 @class NSEvent; | |
| 76 @class NSFont; | |
| 77 @class NSImage; | |
| 78 @class NSView; | |
| 79 @class NSWindow; | |
| 80 @class NSTextField; | |
| 81 #else | |
| 82 class NSCursor; | |
| 83 class NSEvent; | |
| 84 class NSFont; | |
| 85 class NSImage; | |
| 86 struct NSView; | |
| 87 class NSWindow; | |
| 88 class NSTextField; | |
| 89 #endif // __OBJC__ | |
| 90 #elif defined(OS_POSIX) | |
| 91 typedef struct _PangoFontDescription PangoFontDescription; | 51 typedef struct _PangoFontDescription PangoFontDescription; |
| 92 typedef struct _cairo cairo_t; | 52 typedef struct _cairo cairo_t; |
| 93 #endif | 53 #endif |
| 94 | 54 |
| 95 #if defined(OS_ANDROID) | 55 #if defined(OS_ANDROID) |
| 96 struct ANativeWindow; | 56 struct ANativeWindow; |
| 97 namespace ui { | 57 namespace ui { |
| 98 class WindowAndroid; | 58 class WindowAndroid; |
| 99 class ViewAndroid; | 59 class ViewAndroid; |
| 100 } | 60 } |
| 101 #endif | 61 #endif |
| 102 class SkBitmap; | 62 class SkBitmap; |
| 103 | 63 |
| 104 namespace gfx { | 64 namespace gfx { |
| 105 | 65 |
| 106 #if defined(OS_LINUX) || defined(OS_WIN) | 66 #if defined(OS_LINUX) |
| 107 typedef SkRegion* NativeRegion; | 67 typedef SkRegion* NativeRegion; |
| 108 typedef ui::Event* NativeEvent; | 68 typedef ui::Event* NativeEvent; |
| 109 #elif defined(OS_IOS) | |
| 110 typedef UIEvent* NativeEvent; | |
| 111 #elif defined(OS_MACOSX) | |
| 112 typedef void* NativeRegion; | |
| 113 typedef NSEvent* NativeEvent; | |
| 114 #elif defined(OS_ANDROID) | 69 #elif defined(OS_ANDROID) |
| 115 typedef void* NativeRegion; | 70 typedef void* NativeRegion; |
| 116 typedef jobject NativeEvent; | 71 typedef jobject NativeEvent; |
| 117 #endif | 72 #endif |
| 118 | 73 |
| 119 #if defined(OS_WIN) | 74 #if defined(USE_CAIRO) |
| 120 typedef HFONT NativeFont; | |
| 121 typedef HWND NativeEditView; | |
| 122 typedef HDC NativeDrawingContext; | |
| 123 typedef IAccessible* NativeViewAccessible; | |
| 124 #elif defined(OS_IOS) | |
| 125 typedef UIFont* NativeFont; | |
| 126 typedef UITextField* NativeEditView; | |
| 127 typedef CGContext* NativeDrawingContext; | |
| 128 #ifdef __OBJC__ | |
| 129 typedef id NativeViewAccessible; | |
| 130 #else | |
| 131 typedef void* NativeViewAccessible; | |
| 132 #endif | |
| 133 #elif defined(OS_MACOSX) | |
| 134 typedef NSFont* NativeFont; | |
| 135 typedef NSTextField* NativeEditView; | |
| 136 typedef CGContext* NativeDrawingContext; | |
| 137 #ifdef __OBJC__ | |
| 138 typedef id NativeViewAccessible; | |
| 139 #else | |
| 140 typedef void* NativeViewAccessible; | |
| 141 #endif | |
| 142 #elif defined(USE_CAIRO) | |
| 143 typedef PangoFontDescription* NativeFont; | 75 typedef PangoFontDescription* NativeFont; |
| 144 typedef void* NativeEditView; | 76 typedef void* NativeEditView; |
| 145 typedef cairo_t* NativeDrawingContext; | 77 typedef cairo_t* NativeDrawingContext; |
| 146 typedef void* NativeViewAccessible; | 78 typedef void* NativeViewAccessible; |
| 147 #else | 79 #else |
| 148 typedef void* NativeFont; | 80 typedef void* NativeFont; |
| 149 typedef void* NativeEditView; | 81 typedef void* NativeEditView; |
| 150 typedef void* NativeDrawingContext; | 82 typedef void* NativeDrawingContext; |
| 151 typedef void* NativeViewAccessible; | 83 typedef void* NativeViewAccessible; |
| 152 #endif | 84 #endif |
| 153 | 85 |
| 154 // A constant value to indicate that gfx::NativeCursor refers to no cursor. | 86 // A constant value to indicate that gfx::NativeCursor refers to no cursor. |
| 155 #if defined(OS_LINUX) || defined(OS_WIN) | 87 #if defined(OS_LINUX) |
| 156 const int kNullCursor = 0; | 88 const int kNullCursor = 0; |
| 157 #endif | 89 #endif |
| 158 | 90 |
| 159 #if defined(OS_IOS) | |
| 160 typedef UIImage NativeImageType; | |
| 161 #elif defined(OS_MACOSX) | |
| 162 typedef NSImage NativeImageType; | |
| 163 #else | |
| 164 typedef SkBitmap NativeImageType; | 91 typedef SkBitmap NativeImageType; |
| 165 #endif | |
| 166 typedef NativeImageType* NativeImage; | 92 typedef NativeImageType* NativeImage; |
| 167 | 93 |
| 168 // Note: for test_shell we're packing a pointer into the NativeViewId. So, if | 94 // Note: for test_shell we're packing a pointer into the NativeViewId. So, if |
| 169 // you make it a type which is smaller than a pointer, you have to fix | 95 // you make it a type which is smaller than a pointer, you have to fix |
| 170 // test_shell. | 96 // test_shell. |
| 171 // | 97 // |
| 172 // See comment at the top of the file for usage. | 98 // See comment at the top of the file for usage. |
| 173 typedef intptr_t NativeViewId; | 99 typedef intptr_t NativeViewId; |
| 174 | 100 |
| 175 // PluginWindowHandle is an abstraction wrapping "the types of windows | 101 // PluginWindowHandle is an abstraction wrapping "the types of windows |
| 176 // used by NPAPI plugins". On Windows it's an HWND, on X it's an X | 102 // used by NPAPI plugins". On Windows it's an HWND, on X it's an X |
| 177 // window id. | 103 // window id. |
| 178 #if defined(OS_WIN) | 104 #if defined(USE_X11) |
| 179 typedef HWND PluginWindowHandle; | |
| 180 const PluginWindowHandle kNullPluginWindow = NULL; | |
| 181 #elif defined(USE_X11) | |
| 182 typedef unsigned long PluginWindowHandle; | 105 typedef unsigned long PluginWindowHandle; |
| 183 const PluginWindowHandle kNullPluginWindow = 0; | 106 const PluginWindowHandle kNullPluginWindow = 0; |
| 184 #elif defined(OS_ANDROID) | 107 #elif defined(OS_ANDROID) |
| 185 typedef uint64 PluginWindowHandle; | 108 typedef uint64 PluginWindowHandle; |
| 186 const PluginWindowHandle kNullPluginWindow = 0; | 109 const PluginWindowHandle kNullPluginWindow = 0; |
| 187 #elif defined(USE_OZONE) | 110 #elif defined(USE_OZONE) |
| 188 typedef intptr_t PluginWindowHandle; | 111 typedef intptr_t PluginWindowHandle; |
| 189 const PluginWindowHandle kNullPluginWindow = 0; | 112 const PluginWindowHandle kNullPluginWindow = 0; |
| 190 #else | 113 #else |
| 191 // On Mac we don't have windowed plugins. We use a NULL/0 PluginWindowHandle | 114 // On Mac we don't have windowed plugins. We use a NULL/0 PluginWindowHandle |
| (...skipping 26 matching lines...) Expand all Loading... |
| 218 bool is_null() const { return transport_type == EMPTY; } | 141 bool is_null() const { return transport_type == EMPTY; } |
| 219 bool is_transport() const { | 142 bool is_transport() const { |
| 220 return transport_type == NULL_TRANSPORT; | 143 return transport_type == NULL_TRANSPORT; |
| 221 } | 144 } |
| 222 PluginWindowHandle handle; | 145 PluginWindowHandle handle; |
| 223 SurfaceType transport_type; | 146 SurfaceType transport_type; |
| 224 uint32 parent_client_id; | 147 uint32 parent_client_id; |
| 225 }; | 148 }; |
| 226 | 149 |
| 227 // AcceleratedWidget provides a surface to compositors to paint pixels. | 150 // AcceleratedWidget provides a surface to compositors to paint pixels. |
| 228 #if defined(OS_WIN) | 151 #if defined(USE_X11) |
| 229 typedef HWND AcceleratedWidget; | |
| 230 const AcceleratedWidget kNullAcceleratedWidget = NULL; | |
| 231 #elif defined(USE_X11) | |
| 232 typedef unsigned long AcceleratedWidget; | 152 typedef unsigned long AcceleratedWidget; |
| 233 const AcceleratedWidget kNullAcceleratedWidget = 0; | 153 const AcceleratedWidget kNullAcceleratedWidget = 0; |
| 234 #elif defined(OS_IOS) | |
| 235 typedef UIView* AcceleratedWidget; | |
| 236 const AcceleratedWidget kNullAcceleratedWidget = 0; | |
| 237 #elif defined(OS_MACOSX) | |
| 238 typedef NSView* AcceleratedWidget; | |
| 239 const AcceleratedWidget kNullAcceleratedWidget = 0; | |
| 240 #elif defined(OS_ANDROID) | 154 #elif defined(OS_ANDROID) |
| 241 typedef ANativeWindow* AcceleratedWidget; | 155 typedef ANativeWindow* AcceleratedWidget; |
| 242 const AcceleratedWidget kNullAcceleratedWidget = 0; | 156 const AcceleratedWidget kNullAcceleratedWidget = 0; |
| 243 #elif defined(USE_OZONE) | 157 #elif defined(USE_OZONE) |
| 244 typedef intptr_t AcceleratedWidget; | 158 typedef intptr_t AcceleratedWidget; |
| 245 const AcceleratedWidget kNullAcceleratedWidget = 0; | 159 const AcceleratedWidget kNullAcceleratedWidget = 0; |
| 246 #else | 160 #else |
| 247 #error unknown platform | 161 #error unknown platform |
| 248 #endif | 162 #endif |
| 249 | 163 |
| 250 } // namespace gfx | 164 } // namespace gfx |
| 251 | 165 |
| 252 #endif // UI_GFX_NATIVE_WIDGET_TYPES_H_ | 166 #endif // UI_GFX_NATIVE_WIDGET_TYPES_H_ |
| OLD | NEW |