Chromium Code Reviews| Index: gfx/native_widget_types.h |
| =================================================================== |
| --- gfx/native_widget_types.h (revision 47035) |
| +++ gfx/native_widget_types.h (working copy) |
| @@ -89,12 +89,28 @@ |
| #if defined(OS_WIN) |
| // Convert a NativeViewId to a NativeView. |
| -// This is only used on Windows, where we pass an HWND into the renderer and |
| -// let the renderer operate on it. On other platforms, the renderer doesn't |
| -// have access to native platform widgets. |
| +// |
| +// On Windows, we pass an HWND into the renderer. As stated above, the renderer |
| +// should not be performing operations on the view. |
| static inline NativeView NativeViewFromId(NativeViewId id) { |
| return reinterpret_cast<NativeView>(id); |
| } |
| +#define NativeViewFromIdInBrowser(x) NativeViewFromId(x) |
| +#elif defined(OS_MACOSX) |
| +// On the Mac, a NativeView is a pointer to an object, and is useless outside |
| +// the process in which it was created. This is a little reminder that |
| +// NativeViewFromId should only be used inside the appropriate platform ifdef |
| +// outside of the browser. (NativeViewFromIdInBrowser can be used everywhere in |
| +// the browser.) If your cross-platform design involves a call to |
| +// NativeViewFromId from outside the browser it will never work on the Mac and |
| +// is fundamentally broken. |
| +#define NativeViewFromId \ |
| + NATIVE_VIEW_FROM_ID_NOT_AVAILABLE_OUTSIDE_BROWSER_ON_MAC |
|
stuartmorgan
2010/05/12 18:54:43
Is this line really necessary? Not having a defini
|
| +// Please do not call this from outside the browser. It won't work; the name |
| +// should give you a subtle hint. |
| +static inline NativeView NativeViewFromIdInBrowser(NativeViewId id) { |
| + return reinterpret_cast<NativeView>(id); |
| +} |
| #endif |
| // Convert a NativeView to a NativeViewId. See the comments at the top of |