diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-06 21:33:05 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-06 21:33:05 +0000 |
commit | bb1c813bc9bc3e56500a3703e977442e22f41d6f (patch) | |
tree | 18215faedefa41f6016b756a7fc49d208be8f6da /gfx | |
parent | b552ca1fcf241f8f4dcbde8e0e9440aa661fa853 (diff) | |
download | chromium_src-bb1c813bc9bc3e56500a3703e977442e22f41d6f.zip chromium_src-bb1c813bc9bc3e56500a3703e977442e22f41d6f.tar.gz chromium_src-bb1c813bc9bc3e56500a3703e977442e22f41d6f.tar.bz2 |
Clean up NativeViewId bits.
(Prompted by Stuart's recent work on cleaning up NPAPI bits.)
Review URL: http://codereview.chromium.org/1997005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46628 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/native_widget_types.h | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/gfx/native_widget_types.h b/gfx/native_widget_types.h index b3eb0e0..b45c3b6 100644 --- a/gfx/native_widget_types.h +++ b/gfx/native_widget_types.h @@ -14,9 +14,8 @@ // same type as a NativeWindow on some platforms. // NativeViewId: Often, in our cross process model, we need to pass around a // reference to a "window". This reference will, say, be echoed back from a -// renderer to the browser when it wishes to query it's size. On Windows, a -// HWND can be used for this. On other platforms, we may wish to pass -// around X window ids, or maybe abstract identifiers. +// renderer to the browser when it wishes to query its size. On Windows we +// use an HWND for this. // // As a rule of thumb - if you're in the renderer, you should be dealing // with NativeViewIds. This should remind you that you shouldn't be doing @@ -46,7 +45,7 @@ class NSView; class NSWindow; class NSTextField; #endif // __OBJC__ -#elif defined(USE_X11) +#elif defined(TOOLKIT_USES_GTK) typedef struct _GdkCursor GdkCursor; typedef struct _GdkRegion GdkRegion; typedef struct _GtkWidget GtkWidget; @@ -88,35 +87,18 @@ typedef GdkRegion* NativeRegion; // See comment at the top of the file for usage. typedef intptr_t NativeViewId; -// Convert a NativeViewId to a NativeView. -// On Windows, these are both HWNDS so it's just a cast. -// On Mac, for now, we pass the NSView pointer into the renderer -// On Linux we use an opaque id #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. static inline NativeView NativeViewFromId(NativeViewId id) { return reinterpret_cast<NativeView>(id); } -#elif defined(OS_MACOSX) - -// A recent CL removed the need for Mac to actually convert -// NativeViewId to NativeView. Until other platforms make changes, -// the platform-independent code cannot be removed. The following is -// to discourage new platform-independent uses. - -#define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILABLE_ON_MAC - -#elif defined(USE_X11) -// A NativeView on Linux is a GtkWidget*. However, we can't go directly from an -// X window ID to a GtkWidget. Thus, functions which handle NativeViewIds from -// the renderer have to use Xlib. This is fine since these functions are -// generally performed on the BACKGROUND_X thread which can't use GTK anyway. - -#define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILIBLE_ON_X11 - -#endif // defined(USE_X11) +#endif -// Convert a NativeView to a NativeViewId. See the comments above -// NativeViewFromId. +// Convert a NativeView to a NativeViewId. See the comments at the top of +// this file. #if defined(OS_WIN) || defined(OS_MACOSX) static inline NativeViewId IdFromNativeView(NativeView view) { return reinterpret_cast<NativeViewId>(view); |