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

Unified Diff: base/gfx/native_widget_types.h

Issue 273017: Move native_widget_types and gtk_native_view_id_manager from base/gfx to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/gfx/gtk_native_view_id_manager.cc ('k') | base/gfx/native_widget_types_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/gfx/native_widget_types.h
===================================================================
--- base/gfx/native_widget_types.h (revision 28672)
+++ base/gfx/native_widget_types.h (working copy)
@@ -1,143 +0,0 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_GFX_NATIVE_WIDGET_TYPES_H_
-#define BASE_GFX_NATIVE_WIDGET_TYPES_H_
-
-#include "base/basictypes.h"
-#include "build/build_config.h"
-
-// This file provides cross platform typedefs for native widget types.
-// NativeWindow: this is a handle to a native, top-level window
-// NativeView: this is a handle to a native UI element. It may be the
-// 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.
-//
-// 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
-// direct operations on platform widgets from the renderer process.
-//
-// If you're in the browser, you're probably dealing with NativeViews,
-// unless you're in the IPC layer, which will be translating between
-// NativeViewIds from the renderer and NativeViews.
-//
-// NativeEditView: a handle to a native edit-box. The Mac folks wanted this
-// specific typedef.
-//
-// The name 'View' here meshes with OS X where the UI elements are called
-// 'views' and with our Chrome UI code where the elements are also called
-// 'views'.
-
-#if defined(OS_WIN)
-#include <windows.h>
-#elif defined(OS_MACOSX)
-struct CGContext;
-#ifdef __OBJC__
-@class NSView;
-@class NSWindow;
-@class NSTextField;
-#else
-class NSView;
-class NSWindow;
-class NSTextField;
-#endif // __OBJC__
-#elif defined(USE_X11)
-typedef struct _GdkCursor GdkCursor;
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
-typedef struct _cairo cairo_t;
-#endif
-
-namespace gfx {
-
-#if defined(OS_WIN)
-typedef HWND NativeView;
-typedef HWND NativeWindow;
-typedef HWND NativeEditView;
-typedef HDC NativeDrawingContext;
-typedef HCURSOR NativeCursor;
-typedef HMENU NativeMenu;
-#elif defined(OS_MACOSX)
-typedef NSView* NativeView;
-typedef NSWindow* NativeWindow;
-typedef NSTextField* NativeEditView;
-typedef CGContext* NativeDrawingContext;
-typedef void* NativeCursor;
-typedef void* NativeMenu;
-#elif defined(USE_X11)
-typedef GtkWidget* NativeView;
-typedef GtkWindow* NativeWindow;
-typedef GtkWidget* NativeEditView;
-typedef cairo_t* NativeDrawingContext;
-typedef GdkCursor* NativeCursor;
-typedef GtkWidget* NativeMenu;
-#endif
-
-// Note: for test_shell we're packing a pointer into the NativeViewId. So, if
-// you make it a type which is smaller than a pointer, you have to fix
-// test_shell.
-//
-// 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)
-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)
-
-// Convert a NativeView to a NativeViewId. See the comments above
-// NativeViewFromId.
-#if defined(OS_WIN) || defined(OS_MACOSX)
-static inline NativeViewId IdFromNativeView(NativeView view) {
- return reinterpret_cast<NativeViewId>(view);
-}
-#elif defined(USE_X11)
-// Not inlined because it involves pulling too many headers.
-NativeViewId IdFromNativeView(NativeView view);
-#endif // defined(USE_X11)
-
-
-// PluginWindowHandle is an abstraction wrapping "the types of windows
-// used by NPAPI plugins". On Windows it's an HWND, on X it's an X
-// window id.
-#if defined(OS_WIN)
- typedef HWND PluginWindowHandle;
-#elif defined(USE_X11)
- typedef unsigned long PluginWindowHandle;
-#else
- // On OS X we don't have windowed plugins.
- // We use a NULL/0 PluginWindowHandle in shared code to indicate there
- // is no window present, so mirror that behavior here.
- typedef bool PluginWindowHandle;
-#endif
-
-} // namespace gfx
-
-#endif // BASE_GFX_NATIVE_WIDGET_TYPES_H_
« no previous file with comments | « base/gfx/gtk_native_view_id_manager.cc ('k') | base/gfx/native_widget_types_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698