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

Unified Diff: content/port/browser/render_widget_host_view_port.h

Issue 9347042: Introduce content::RenderWidgetHostViewPort (in content/port/browser). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head. Created 8 years, 10 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 | « content/port/OWNERS ('k') | content/public/browser/render_widget_host_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/port/browser/render_widget_host_view_port.h
diff --git a/content/browser/renderer_host/render_widget_host_view.h b/content/port/browser/render_widget_host_view_port.h
similarity index 52%
copy from content/browser/renderer_host/render_widget_host_view.h
copy to content/port/browser/render_widget_host_view_port.h
index 99a7c91705f37f741b9e32e129f5dcaecc3b493f..3aeae2c66cc359145d973344880b7af4ac70e9a3 100644
--- a/content/browser/renderer_host/render_widget_host_view.h
+++ b/content/port/browser/render_widget_host_view_port.h
@@ -2,53 +2,27 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_
-#define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_
+#ifndef CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_PORT_H_
+#define CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_PORT_H_
#pragma once
-#if defined(OS_MACOSX)
-#include <OpenGL/OpenGL.h>
-#endif
-
-#if defined(TOOLKIT_USES_GTK)
-#include <gdk/gdk.h>
-#endif
-
-#include <string>
-#include <vector>
-
-#include "base/memory/scoped_ptr.h"
#include "base/process_util.h"
-#include "base/callback_forward.h"
+#include "base/string16.h"
#include "content/common/content_export.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
+#include "content/public/browser/render_widget_host_view.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h"
#include "ui/base/ime/text_input_type.h"
-#include "ui/base/range/range.h"
-#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/surface/transport_dib.h"
-
-struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params;
-struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params;
+#include "ui/base/range/range.h"
class BackingStore;
-class BrowserAccessibilityManager;
-class RenderWidgetHost;
class WebCursor;
+
struct AccessibilityHostMsg_NotificationParams;
+struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params;
+struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params;
struct NativeWebKeyboardEvent;
-namespace content {
-class RenderProcessHost;
-}
-
-namespace gfx {
-class Rect;
-class Size;
-}
-
namespace webkit {
namespace npapi {
struct WebPluginGeometry;
@@ -61,147 +35,19 @@ struct WebScreenInfo;
}
#endif
-// RenderWidgetHostView is an interface implemented by an object that acts as
-// the "View" portion of a RenderWidgetHost. The RenderWidgetHost and its
-// associated RenderProcessHost own the "Model" in this case which is the
-// child renderer process. The View is responsible for receiving events from
-// the surrounding environment and passing them to the RenderWidgetHost, and
-// for actually displaying the content of the RenderWidgetHost when it
-// changes.
-//
-// TODO(joi): Move this to content/public/browser
-class CONTENT_EXPORT RenderWidgetHostView {
- public:
- virtual ~RenderWidgetHostView();
-
- // Platform-specific creator. Use this to construct new RenderWidgetHostViews
- // rather than using RenderWidgetHostViewWin & friends.
- //
- // This function must NOT size it, because the RenderView in the renderer
- // wouldn't have been created yet. The widget would set its "waiting for
- // resize ack" flag, and the ack would never come becasue no RenderView
- // received it.
- //
- // The RenderWidgetHost must already be created (because we can't know if it's
- // going to be a regular RenderWidgetHost or a RenderViewHost (a subclass).
- static RenderWidgetHostView* CreateViewForWidget(
- RenderWidgetHost* widget);
-
- // Initialize this object for use as a drawing area. |parent_view| may be
- // left as NULL on platforms where a parent view is not required to initialize
- // a child window.
- virtual void InitAsChild(gfx::NativeView parent_view) = 0;
-
- // Returns the associated RenderWidgetHost.
- virtual RenderWidgetHost* GetRenderWidgetHost() const = 0;
-
- // Tells the View to size itself to the specified size.
- virtual void SetSize(const gfx::Size& size) = 0;
-
- // Tells the View to size and move itself to the specified size and point in
- // screen space.
- virtual void SetBounds(const gfx::Rect& rect) = 0;
-
- // Retrieves the native view used to contain plugins and identify the
- // renderer in IPC messages.
- virtual gfx::NativeView GetNativeView() const = 0;
- virtual gfx::NativeViewId GetNativeViewId() const = 0;
- virtual gfx::NativeViewAccessible GetNativeViewAccessible() = 0;
-
- // Set focus to the associated View component.
- virtual void Focus() = 0;
- // Returns true if the View currently has the focus.
- virtual bool HasFocus() const = 0;
-
- // Shows/hides the view. These must always be called together in pairs.
- // It is not legal to call Hide() multiple times in a row.
- virtual void Show() = 0;
- virtual void Hide() = 0;
-
- // Whether the view is showing.
- virtual bool IsShowing() = 0;
-
- // Retrieve the bounds of the View, in screen coordinates.
- virtual gfx::Rect GetViewBounds() const = 0;
-
- // Returns true if the View's context menu is showing.
- virtual bool IsShowingContextMenu() const = 0;
-
- // Tells the View whether the context menu is showing.
- virtual void SetShowingContextMenu(bool showing) = 0;
-
-#if defined(OS_MACOSX)
- // Set the view's active state (i.e., tint state of controls).
- virtual void SetActive(bool active) = 0;
-
- // Tells the view whether or not to accept first responder status. If |flag|
- // is true, the view does not accept first responder status and instead
- // manually becomes first responder when it receives a mouse down event. If
- // |flag| is false, the view participates in the key-view chain as normal.
- virtual void SetTakesFocusOnlyOnMouseDown(bool flag) = 0;
-
- // Notifies the view that its enclosing window has changed visibility
- // (minimized/unminimized, app hidden/unhidden, etc).
- // TODO(stuartmorgan): This is a temporary plugin-specific workaround for
- // <http://crbug.com/34266>. Once that is fixed, this (and the corresponding
- // message and renderer-side handling) can be removed in favor of using
- // WasHidden/DidBecomeSelected.
- virtual void SetWindowVisibility(bool visible) = 0;
-
- // Informs the view that its containing window's frame changed.
- virtual void WindowFrameChanged() = 0;
-#endif // defined(OS_MACOSX)
-
-#if defined(TOOLKIT_USES_GTK)
- // Gets the event for the last mouse down.
- virtual GdkEventButton* GetLastMouseDown() = 0;
-#if !defined(TOOLKIT_VIEWS)
- // Builds a submenu containing all the gtk input method commands.
- virtual gfx::NativeView BuildInputMethodsGtkMenu() = 0;
-#endif // !defined(TOOLKIT_VIEWS)
-#endif // defined(TOOLKIT_USES_GTK)
-
- // TODO(joi): May be able to move into impl if RWHVMacDelegate stops
- // being exposed to Chrome.
- virtual void UnhandledWheelEvent(const WebKit::WebMouseWheelEvent& event) = 0;
-
- // Subclasses should override this method to do what is appropriate to set
- // the custom background for their platform.
- virtual void SetBackground(const SkBitmap& background) = 0;
- virtual const SkBitmap& GetBackground() = 0;
-
- // TODO(joi): Remove this when we remove the dependency by chrome/
- // on browser_accessibility* files in content.
- virtual BrowserAccessibilityManager*
- GetBrowserAccessibilityManager() const = 0;
-
- protected:
- RenderWidgetHostView();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostView);
-};
+namespace content {
// This is the larger RenderWidgetHostView interface exposed only
-// within content/, plus some basic implementation.
-//
-// TODO(joi): Extract a pure virtual interface from these additional
-// methods (named RenderWidgetHostViewPort?), move it to content/port,
-// and have content/ use that interface everywhere except where it is
-// using concrete implementation classes. The RWHVBase class might
-// still exist for shared implementation between existing concrete
-// implementations.
-class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView {
+// within content/ and to embedders looking to port to new platforms.
+class CONTENT_EXPORT RenderWidgetHostViewPort : public RenderWidgetHostView {
public:
- virtual ~RenderWidgetHostViewBase();
+ virtual ~RenderWidgetHostViewPort() {}
// Does the cast for you.
- static RenderWidgetHostViewBase* FromRWHV(RenderWidgetHostView* rwhv);
+ static RenderWidgetHostViewPort* FromRWHV(RenderWidgetHostView* rwhv);
- // Convenience function instead of
- // RenderWidgetHostView::CreateViewForWidget if you want a
- // RenderWidgetHostViewBase.
- static RenderWidgetHostViewBase* CreateViewForWidget(
+ // Like RenderWidgetHostView::CreateViewForWidget, with cast.
+ static RenderWidgetHostViewPort* CreateViewForWidget(
RenderWidgetHost* widget);
// Perform all the initialization steps necessary for this object to represent
@@ -281,7 +127,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView {
// Notifies the View that the renderer text selection has changed.
virtual void SelectionChanged(const string16& text,
size_t offset,
- const ui::Range& range);
+ const ui::Range& range) = 0;
// Notifies the View that the renderer selection bounds has changed.
// |start_rect| and |end_rect| are the bounds end of the selection in the
@@ -389,66 +235,16 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView {
// Return value indicates whether the mouse is locked successfully or not.
virtual bool LockMouse() = 0;
virtual void UnlockMouse() = 0;
+ virtual bool IsMouseLocked() = 0;
+
+ virtual void SetPopupType(WebKit::WebPopupType popup_type) = 0;
+ virtual WebKit::WebPopupType GetPopupType() = 0;
virtual void OnAccessibilityNotifications(
const std::vector<AccessibilityHostMsg_NotificationParams>& params) {
}
-
- virtual void SetBackground(const SkBitmap& background) OVERRIDE;
- virtual const SkBitmap& GetBackground() OVERRIDE;
-
- virtual bool IsShowingContextMenu() const OVERRIDE;
- virtual void SetShowingContextMenu(bool) OVERRIDE;
-
- virtual BrowserAccessibilityManager*
- GetBrowserAccessibilityManager() const OVERRIDE;
-
- void set_popup_type(WebKit::WebPopupType popup_type) {
- popup_type_ = popup_type;
- }
- WebKit::WebPopupType popup_type() const { return popup_type_; }
-
- void SetBrowserAccessibilityManager(BrowserAccessibilityManager* manager);
-
- bool mouse_locked() const { return mouse_locked_; }
-
- protected:
- // Interface class only, do not construct.
- RenderWidgetHostViewBase();
-
- // Whether this view is a popup and what kind of popup it is (select,
- // autofill...).
- WebKit::WebPopupType popup_type_;
-
- // A custom background to paint behind the web content. This will be tiled
- // horizontally. Can be null, in which case we fall back to painting white.
- SkBitmap background_;
-
- // While the mouse is locked, the cursor is hidden from the user. Mouse events
- // are still generated. However, the position they report is the last known
- // mouse position just as mouse lock was entered; the movement they report
- // indicates what the change in position of the mouse would be had it not been
- // locked.
- bool mouse_locked_;
-
- // Whether we are showing a context menu.
- bool showing_context_menu_;
-
- // A buffer containing the text inside and around the current selection range.
- string16 selection_text_;
-
- // The offset of the text stored in |selection_text_| relative to the start of
- // the web page.
- size_t selection_text_offset_;
-
- // The current selection range relative to the start of the web page.
- ui::Range selection_range_;
-
- private:
- // Manager of the tree representation of the WebKit render tree.
- scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_;
-
- DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase);
};
-#endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_H_
+} // namespace content
+
+#endif // CONTENT_PORT_BROWSER_RENDER_WIDGET_HOST_VIEW_PORT_H_
« no previous file with comments | « content/port/OWNERS ('k') | content/public/browser/render_widget_host_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698