Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: ui/gfx/native_widget_types.h

Issue 1287103004: Sync ui/events to chromium @ https://codereview.chromium.org/1210203002 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/screen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 25 matching lines...) Expand all
36 // specific typedef. 36 // specific typedef.
37 // 37 //
38 // NativeImage: The platform-specific image type used for drawing UI elements 38 // NativeImage: The platform-specific image type used for drawing UI elements
39 // in the browser. 39 // in the browser.
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
46 namespace ui { 47 namespace ui {
48 class Cursor;
47 class Event; 49 class Event;
48 } 50 }
49 51
50 #if defined(OS_POSIX) 52 #if defined(OS_WIN)
51 typedef struct _PangoFontDescription PangoFontDescription; 53 #include <windows.h> // NOLINT
54 typedef struct HFONT__* HFONT;
55 struct IAccessible;
56 #elif defined(OS_IOS)
57 struct CGContext;
58 #ifdef __OBJC__
59 @class UIEvent;
60 @class UIFont;
61 @class UIImage;
62 @class UIView;
63 @class UIWindow;
64 @class UITextField;
65 #else
66 class UIEvent;
67 class UIFont;
68 class UIImage;
69 class UIView;
70 class UIWindow;
71 class UITextField;
72 #endif // __OBJC__
73 #elif defined(OS_MACOSX)
74 struct CGContext;
75 #ifdef __OBJC__
76 @class NSCursor;
77 @class NSEvent;
78 @class NSFont;
79 @class NSImage;
80 @class NSView;
81 @class NSWindow;
82 @class NSTextField;
83 #else
84 class NSCursor;
85 class NSEvent;
86 class NSFont;
87 class NSImage;
88 struct NSView;
89 class NSWindow;
90 class NSTextField;
91 #endif // __OBJC__
92 #elif defined(OS_POSIX)
52 typedef struct _cairo cairo_t; 93 typedef struct _cairo cairo_t;
53 #endif 94 #endif
54 95
55 #if defined(OS_ANDROID) 96 #if defined(OS_ANDROID)
56 struct ANativeWindow; 97 struct ANativeWindow;
57 namespace ui { 98 namespace ui {
58 class WindowAndroid; 99 class WindowAndroid;
59 class ViewAndroid; 100 class ViewAndroid;
60 } 101 }
61 #endif 102 #endif
62 class SkBitmap; 103 class SkBitmap;
63 104
105 #if defined(USE_X11) && !defined(OS_CHROMEOS)
106 extern "C" {
107 struct _AtkObject;
108 typedef struct _AtkObject AtkObject;
109 }
110 #endif
111
64 namespace gfx { 112 namespace gfx {
65 113
66 #if defined(OS_LINUX) 114 #if defined(OS_LINUX)
67 typedef SkRegion* NativeRegion; 115 typedef SkRegion* NativeRegion;
116 typedef ui::Cursor NativeCursor;
117 typedef void* NativeView;
118 typedef void* NativeWindow;
68 typedef ui::Event* NativeEvent; 119 typedef ui::Event* NativeEvent;
120 #elif defined(OS_IOS)
121 typedef void* NativeCursor;
122 typedef UIView* NativeView;
123 typedef UIWindow* NativeWindow;
124 typedef UIEvent* NativeEvent;
125 #elif defined(OS_MACOSX)
126 typedef NSCursor* NativeCursor;
127 typedef NSView* NativeView;
128 typedef NSWindow* NativeWindow;
129 typedef NSEvent* NativeEvent;
69 #elif defined(OS_ANDROID) 130 #elif defined(OS_ANDROID)
70 typedef void* NativeRegion; 131 typedef void* NativeRegion;
132 typedef void* NativeCursor;
133 typedef ui::ViewAndroid* NativeView;
134 typedef ui::WindowAndroid* NativeWindow;
71 typedef jobject NativeEvent; 135 typedef jobject NativeEvent;
136 #else
137 #error Unknown build environment.
72 #endif 138 #endif
73 139
140 #if defined(OS_WIN)
141 typedef HFONT NativeFont;
142 typedef HWND NativeEditView;
143 typedef HDC NativeDrawingContext;
144 typedef IAccessible* NativeViewAccessible;
145 #elif defined(OS_IOS)
146 typedef UIFont* NativeFont;
147 typedef UITextField* NativeEditView;
148 typedef CGContext* NativeDrawingContext;
149 #ifdef __OBJC__
150 typedef id NativeViewAccessible;
151 #else
152 typedef void* NativeViewAccessible;
153 #endif // __OBJC__
154 #elif defined(OS_MACOSX)
155 typedef NSFont* NativeFont;
156 typedef NSTextField* NativeEditView;
157 typedef CGContext* NativeDrawingContext;
158 #ifdef __OBJC__
159 typedef id NativeViewAccessible;
160 #else
161 typedef void* NativeViewAccessible;
162 #endif // __OBJC__
163 #else // Android, Linux, Chrome OS, etc.
164 // Linux doesn't have a native font type.
165 typedef void* NativeEditView;
74 #if defined(USE_CAIRO) 166 #if defined(USE_CAIRO)
75 typedef PangoFontDescription* NativeFont;
76 typedef void* NativeEditView;
77 typedef cairo_t* NativeDrawingContext; 167 typedef cairo_t* NativeDrawingContext;
168 #else
169 typedef void* NativeDrawingContext;
170 #endif // defined(USE_CAIRO)
171 #if defined(USE_X11) && !defined(OS_CHROMEOS)
172 typedef AtkObject* NativeViewAccessible;
173 #else
78 typedef void* NativeViewAccessible; 174 typedef void* NativeViewAccessible;
79 #else 175 #endif
80 typedef void* NativeFont;
81 typedef void* NativeEditView;
82 typedef void* NativeDrawingContext;
83 typedef void* NativeViewAccessible;
84 #endif 176 #endif
85 177
86 // A constant value to indicate that gfx::NativeCursor refers to no cursor. 178 // A constant value to indicate that gfx::NativeCursor refers to no cursor.
87 #if defined(OS_LINUX) 179 #if defined(OS_LINUX)
88 const int kNullCursor = 0; 180 const int kNullCursor = 0;
181 #else
182 const gfx::NativeCursor kNullCursor = static_cast<gfx::NativeCursor>(NULL);
89 #endif 183 #endif
90 184
185 #if defined(OS_IOS)
186 typedef UIImage NativeImageType;
187 #elif defined(OS_MACOSX)
188 typedef NSImage NativeImageType;
189 #else
91 typedef SkBitmap NativeImageType; 190 typedef SkBitmap NativeImageType;
191 #endif
92 typedef NativeImageType* NativeImage; 192 typedef NativeImageType* NativeImage;
93 193
94 // Note: for test_shell we're packing a pointer into the NativeViewId. So, if 194 // Note: for test_shell we're packing a pointer into the NativeViewId. So, if
95 // you make it a type which is smaller than a pointer, you have to fix 195 // you make it a type which is smaller than a pointer, you have to fix
96 // test_shell. 196 // test_shell.
97 // 197 //
98 // See comment at the top of the file for usage. 198 // See comment at the top of the file for usage.
99 typedef intptr_t NativeViewId; 199 typedef intptr_t NativeViewId;
100 200
101 // PluginWindowHandle is an abstraction wrapping "the types of windows 201 // PluginWindowHandle is an abstraction wrapping "the types of windows
102 // used by NPAPI plugins". On Windows it's an HWND, on X it's an X 202 // used by NPAPI plugins". On Windows it's an HWND, on X it's an X
103 // window id. 203 // window id.
104 #if defined(USE_X11) 204 #if defined(OS_WIN)
205 typedef HWND PluginWindowHandle;
206 const PluginWindowHandle kNullPluginWindow = NULL;
207 #elif defined(USE_X11)
105 typedef unsigned long PluginWindowHandle; 208 typedef unsigned long PluginWindowHandle;
106 const PluginWindowHandle kNullPluginWindow = 0; 209 const PluginWindowHandle kNullPluginWindow = 0;
107 #elif defined(OS_ANDROID) 210 #elif defined(OS_ANDROID)
108 typedef uint64 PluginWindowHandle; 211 typedef uint64 PluginWindowHandle;
109 const PluginWindowHandle kNullPluginWindow = 0; 212 const PluginWindowHandle kNullPluginWindow = 0;
110 #elif defined(USE_OZONE) 213 #elif defined(USE_OZONE)
111 typedef intptr_t PluginWindowHandle; 214 typedef intptr_t PluginWindowHandle;
112 const PluginWindowHandle kNullPluginWindow = 0; 215 const PluginWindowHandle kNullPluginWindow = 0;
113 #else 216 #else
114 // On Mac we don't have windowed plugins. We use a NULL/0 PluginWindowHandle 217 // On Mac we don't have windowed plugins. We use a NULL/0 PluginWindowHandle
(...skipping 26 matching lines...) Expand all
141 bool is_null() const { return transport_type == EMPTY; } 244 bool is_null() const { return transport_type == EMPTY; }
142 bool is_transport() const { 245 bool is_transport() const {
143 return transport_type == NULL_TRANSPORT; 246 return transport_type == NULL_TRANSPORT;
144 } 247 }
145 PluginWindowHandle handle; 248 PluginWindowHandle handle;
146 SurfaceType transport_type; 249 SurfaceType transport_type;
147 uint32 parent_client_id; 250 uint32 parent_client_id;
148 }; 251 };
149 252
150 // AcceleratedWidget provides a surface to compositors to paint pixels. 253 // AcceleratedWidget provides a surface to compositors to paint pixels.
151 #if defined(USE_X11) 254 #if defined(OS_WIN)
255 typedef HWND AcceleratedWidget;
256 const AcceleratedWidget kNullAcceleratedWidget = NULL;
257 #elif defined(USE_X11)
152 typedef unsigned long AcceleratedWidget; 258 typedef unsigned long AcceleratedWidget;
153 const AcceleratedWidget kNullAcceleratedWidget = 0; 259 const AcceleratedWidget kNullAcceleratedWidget = 0;
260 #elif defined(OS_IOS)
261 typedef UIView* AcceleratedWidget;
262 const AcceleratedWidget kNullAcceleratedWidget = 0;
263 #elif defined(OS_MACOSX)
264 typedef NSView* AcceleratedWidget;
265 const AcceleratedWidget kNullAcceleratedWidget = 0;
154 #elif defined(OS_ANDROID) 266 #elif defined(OS_ANDROID)
155 typedef ANativeWindow* AcceleratedWidget; 267 typedef ANativeWindow* AcceleratedWidget;
156 const AcceleratedWidget kNullAcceleratedWidget = 0; 268 const AcceleratedWidget kNullAcceleratedWidget = 0;
157 #elif defined(USE_OZONE) 269 #elif defined(USE_OZONE)
158 typedef intptr_t AcceleratedWidget; 270 typedef intptr_t AcceleratedWidget;
159 const AcceleratedWidget kNullAcceleratedWidget = 0; 271 const AcceleratedWidget kNullAcceleratedWidget = 0;
160 #elif defined(OS_IOS) 272 #elif defined(OS_IOS)
161 typedef uintptr_t AcceleratedWidget; 273 typedef uintptr_t AcceleratedWidget;
162 const AcceleratedWidget kNullAcceleratedWidget = 0; 274 const AcceleratedWidget kNullAcceleratedWidget = 0;
163 #elif defined(OS_MACOSX) 275 #elif defined(OS_MACOSX)
164 typedef uintptr_t AcceleratedWidget; 276 typedef uintptr_t AcceleratedWidget;
165 const AcceleratedWidget kNullAcceleratedWidget = 0; 277 const AcceleratedWidget kNullAcceleratedWidget = 0;
166 #else 278 #else
167 #error unknown platform 279 #error unknown platform
168 #endif 280 #endif
169 281
170 } // namespace gfx 282 } // namespace gfx
171 283
172 #endif // UI_GFX_NATIVE_WIDGET_TYPES_H_ 284 #endif // UI_GFX_NATIVE_WIDGET_TYPES_H_
OLDNEW
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/screen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698