| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 GFX_NATIVE_WIDGET_TYPES_H_ | 5 #ifndef GFX_NATIVE_WIDGET_TYPES_H_ |
| 6 #define GFX_NATIVE_WIDGET_TYPES_H_ | 6 #define 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 "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // specific typedef. | 30 // specific typedef. |
| 31 // | 31 // |
| 32 // NativeImage: The platform-specific image type used for drawing UI elements | 32 // NativeImage: The platform-specific image type used for drawing UI elements |
| 33 // in the browser. | 33 // in the browser. |
| 34 // | 34 // |
| 35 // The name 'View' here meshes with OS X where the UI elements are called | 35 // The name 'View' here meshes with OS X where the UI elements are called |
| 36 // 'views' and with our Chrome UI code where the elements are also called | 36 // 'views' and with our Chrome UI code where the elements are also called |
| 37 // 'views'. | 37 // 'views'. |
| 38 | 38 |
| 39 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
| 40 #include <windows.h> | 40 #include <windows.h> // NOLINT |
| 41 typedef struct HFONT__* HFONT; | 41 typedef struct HFONT__* HFONT; |
| 42 #elif defined(OS_MACOSX) | 42 #elif defined(OS_MACOSX) |
| 43 struct CGContext; | 43 struct CGContext; |
| 44 #ifdef __OBJC__ | 44 #ifdef __OBJC__ |
| 45 @class NSFont; | 45 @class NSFont; |
| 46 @class NSImage; | 46 @class NSImage; |
| 47 @class NSView; | 47 @class NSView; |
| 48 @class NSWindow; | 48 @class NSWindow; |
| 49 @class NSTextField; | 49 @class NSTextField; |
| 50 #else | 50 #else |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 #if defined(OS_WIN) | 114 #if defined(OS_WIN) |
| 115 // Convert a NativeViewId to a NativeView. | 115 // Convert a NativeViewId to a NativeView. |
| 116 // | 116 // |
| 117 // On Windows, we pass an HWND into the renderer. As stated above, the renderer | 117 // On Windows, we pass an HWND into the renderer. As stated above, the renderer |
| 118 // should not be performing operations on the view. | 118 // should not be performing operations on the view. |
| 119 static inline NativeView NativeViewFromId(NativeViewId id) { | 119 static inline NativeView NativeViewFromId(NativeViewId id) { |
| 120 return reinterpret_cast<NativeView>(id); | 120 return reinterpret_cast<NativeView>(id); |
| 121 } | 121 } |
| 122 #define NativeViewFromIdInBrowser(x) NativeViewFromId(x) | 122 #define NativeViewFromIdInBrowser(x) NativeViewFromId(x) |
| 123 #elif defined(OS_MACOSX) || defined(USE_X11) | 123 #elif defined(OS_POSIX) |
| 124 // On Mac and Linux, a NativeView is a pointer to an object, and is useless | 124 // On Mac and Linux, a NativeView is a pointer to an object, and is useless |
| 125 // outside the process in which it was created. NativeViewFromId should only be | 125 // outside the process in which it was created. NativeViewFromId should only be |
| 126 // used inside the appropriate platform ifdef outside of the browser. | 126 // used inside the appropriate platform ifdef outside of the browser. |
| 127 // (NativeViewFromIdInBrowser can be used everywhere in the browser.) If your | 127 // (NativeViewFromIdInBrowser can be used everywhere in the browser.) If your |
| 128 // cross-platform design involves a call to NativeViewFromId from outside the | 128 // cross-platform design involves a call to NativeViewFromId from outside the |
| 129 // browser it will never work on Mac or Linux and is fundamentally broken. | 129 // browser it will never work on Mac or Linux and is fundamentally broken. |
| 130 | 130 |
| 131 // Please do not call this from outside the browser. It won't work; the name | 131 // Please do not call this from outside the browser. It won't work; the name |
| 132 // should give you a subtle hint. | 132 // should give you a subtle hint. |
| 133 static inline NativeView NativeViewFromIdInBrowser(NativeViewId id) { | 133 static inline NativeView NativeViewFromIdInBrowser(NativeViewId id) { |
| 134 return reinterpret_cast<NativeView>(id); | 134 return reinterpret_cast<NativeView>(id); |
| 135 } | 135 } |
| 136 #endif // defined(OS_MACOSX) || defined(USE_X11) | 136 #endif // defined(OS_POSIX) |
| 137 | 137 |
| 138 // Convert a NativeView to a NativeViewId. See the comments at the top of | 138 // Convert a NativeView to a NativeViewId. See the comments at the top of |
| 139 // this file. | 139 // this file. |
| 140 #if defined(OS_WIN) || defined(OS_MACOSX) | 140 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 141 static inline NativeViewId IdFromNativeView(NativeView view) { | 141 static inline NativeViewId IdFromNativeView(NativeView view) { |
| 142 return reinterpret_cast<NativeViewId>(view); | 142 return reinterpret_cast<NativeViewId>(view); |
| 143 } | 143 } |
| 144 #elif defined(USE_X11) | 144 #elif defined(USE_X11) |
| 145 // Not inlined because it involves pulling too many headers. | 145 // Not inlined because it involves pulling too many headers. |
| 146 NativeViewId IdFromNativeView(NativeView view); | 146 NativeViewId IdFromNativeView(NativeView view); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 167 // GPU plugin becomes a full-on GPU process, this typedef can be | 167 // GPU plugin becomes a full-on GPU process, this typedef can be |
| 168 // returned to a bool. For now we use a type large enough to hold a | 168 // returned to a bool. For now we use a type large enough to hold a |
| 169 // pointer on 64-bit architectures in case we need this capability. | 169 // pointer on 64-bit architectures in case we need this capability. |
| 170 typedef uint64 PluginWindowHandle; | 170 typedef uint64 PluginWindowHandle; |
| 171 const PluginWindowHandle kNullPluginWindow = 0; | 171 const PluginWindowHandle kNullPluginWindow = 0; |
| 172 #endif | 172 #endif |
| 173 | 173 |
| 174 } // namespace gfx | 174 } // namespace gfx |
| 175 | 175 |
| 176 #endif // GFX_NATIVE_WIDGET_TYPES_H_ | 176 #endif // GFX_NATIVE_WIDGET_TYPES_H_ |
| OLD | NEW |