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

Side by Side Diff: content/public/browser/render_widget_host_view.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/port/browser/render_widget_host_view_port.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_H_
6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_H_
7 #pragma once
8
9 #if defined(TOOLKIT_USES_GTK)
10 #include <gdk/gdk.h>
11 #endif
12
13 #include "content/common/content_export.h"
14 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
16 #include "ui/gfx/native_widget_types.h"
17
18 class BrowserAccessibilityManager;
19 class RenderWidgetHost;
20
21 namespace gfx {
22 class Rect;
23 class Size;
24 }
25
26 // RenderWidgetHostView is an interface implemented by an object that acts as
27 // the "View" portion of a RenderWidgetHost. The RenderWidgetHost and its
28 // associated RenderProcessHost own the "Model" in this case which is the
29 // child renderer process. The View is responsible for receiving events from
30 // the surrounding environment and passing them to the RenderWidgetHost, and
31 // for actually displaying the content of the RenderWidgetHost when it
32 // changes.
33 //
34 // TODO(joi): Move to content namespace.
35 class CONTENT_EXPORT RenderWidgetHostView {
36 public:
37 virtual ~RenderWidgetHostView() {}
38
39 // Platform-specific creator. Use this to construct new RenderWidgetHostViews
40 // rather than using RenderWidgetHostViewWin & friends.
41 //
42 // This function must NOT size it, because the RenderView in the renderer
43 // wouldn't have been created yet. The widget would set its "waiting for
44 // resize ack" flag, and the ack would never come becasue no RenderView
45 // received it.
46 //
47 // The RenderWidgetHost must already be created (because we can't know if it's
48 // going to be a regular RenderWidgetHost or a RenderViewHost (a subclass).
49 static RenderWidgetHostView* CreateViewForWidget(
50 RenderWidgetHost* widget);
51
52 // Initialize this object for use as a drawing area. |parent_view| may be
53 // left as NULL on platforms where a parent view is not required to initialize
54 // a child window.
55 virtual void InitAsChild(gfx::NativeView parent_view) = 0;
56
57 // Returns the associated RenderWidgetHost.
58 virtual RenderWidgetHost* GetRenderWidgetHost() const = 0;
59
60 // Tells the View to size itself to the specified size.
61 virtual void SetSize(const gfx::Size& size) = 0;
62
63 // Tells the View to size and move itself to the specified size and point in
64 // screen space.
65 virtual void SetBounds(const gfx::Rect& rect) = 0;
66
67 // Retrieves the native view used to contain plugins and identify the
68 // renderer in IPC messages.
69 virtual gfx::NativeView GetNativeView() const = 0;
70 virtual gfx::NativeViewId GetNativeViewId() const = 0;
71 virtual gfx::NativeViewAccessible GetNativeViewAccessible() = 0;
72
73 // Set focus to the associated View component.
74 virtual void Focus() = 0;
75 // Returns true if the View currently has the focus.
76 virtual bool HasFocus() const = 0;
77
78 // Shows/hides the view. These must always be called together in pairs.
79 // It is not legal to call Hide() multiple times in a row.
80 virtual void Show() = 0;
81 virtual void Hide() = 0;
82
83 // Whether the view is showing.
84 virtual bool IsShowing() = 0;
85
86 // Retrieve the bounds of the View, in screen coordinates.
87 virtual gfx::Rect GetViewBounds() const = 0;
88
89 // Returns true if the View's context menu is showing.
90 virtual bool IsShowingContextMenu() const = 0;
91
92 // Tells the View whether the context menu is showing.
93 virtual void SetShowingContextMenu(bool showing) = 0;
94
95 #if defined(OS_MACOSX)
96 // Set the view's active state (i.e., tint state of controls).
97 virtual void SetActive(bool active) = 0;
98
99 // Tells the view whether or not to accept first responder status. If |flag|
100 // is true, the view does not accept first responder status and instead
101 // manually becomes first responder when it receives a mouse down event. If
102 // |flag| is false, the view participates in the key-view chain as normal.
103 virtual void SetTakesFocusOnlyOnMouseDown(bool flag) = 0;
104
105 // Notifies the view that its enclosing window has changed visibility
106 // (minimized/unminimized, app hidden/unhidden, etc).
107 // TODO(stuartmorgan): This is a temporary plugin-specific workaround for
108 // <http://crbug.com/34266>. Once that is fixed, this (and the corresponding
109 // message and renderer-side handling) can be removed in favor of using
110 // WasHidden/DidBecomeSelected.
111 virtual void SetWindowVisibility(bool visible) = 0;
112
113 // Informs the view that its containing window's frame changed.
114 virtual void WindowFrameChanged() = 0;
115 #endif // defined(OS_MACOSX)
116
117 #if defined(TOOLKIT_USES_GTK)
118 // Gets the event for the last mouse down.
119 virtual GdkEventButton* GetLastMouseDown() = 0;
120 #if !defined(TOOLKIT_VIEWS)
121 // Builds a submenu containing all the gtk input method commands.
122 virtual gfx::NativeView BuildInputMethodsGtkMenu() = 0;
123 #endif // !defined(TOOLKIT_VIEWS)
124 #endif // defined(TOOLKIT_USES_GTK)
125
126 // TODO(joi): May be able to move into impl if RWHVMacDelegate stops
127 // being exposed to Chrome.
128 virtual void UnhandledWheelEvent(const WebKit::WebMouseWheelEvent& event) = 0;
129
130 // Subclasses should override this method to do what is appropriate to set
131 // the custom background for their platform.
132 virtual void SetBackground(const SkBitmap& background) = 0;
133 virtual const SkBitmap& GetBackground() = 0;
134
135 // TODO(joi): Remove this when we remove the dependency by chrome/
136 // on browser_accessibility* files in content.
137 virtual BrowserAccessibilityManager*
138 GetBrowserAccessibilityManager() const = 0;
139 };
140
141 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_H_
142
143
OLDNEW
« no previous file with comments | « content/port/browser/render_widget_host_view_port.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698