render_widget_host_view_child_frame.h revision f8ee788a64d60abd8f2d742a5fdedde054ecd910
1c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// Copyright 2014 The Chromium Authors. All rights reserved.
2c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// Use of this source code is governed by a BSD-style license that can be
3c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// found in the LICENSE file.
4c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
5b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant#ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
6b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant#define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
7c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
8c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant#include "base/memory/scoped_ptr.h"
9c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant#include "content/browser/renderer_host/render_widget_host_view_base.h"
10c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant#include "content/common/content_export.h"
11c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant#include "ui/gfx/native_widget_types.h"
12c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant#include "ui/gfx/rect.h"
13
14struct ViewHostMsg_TextInputState_Params;
15
16namespace content {
17class CrossProcessFrameConnector;
18class RenderWidgetHost;
19class RenderWidgetHostImpl;
20
21// RenderWidgetHostViewChildFrame implements the view for a RenderWidgetHost
22// associated with content being rendered in a separate process from
23// content that is embedding it. This is not a platform-specific class; rather,
24// the embedding renderer process implements the platform containing the
25// widget, and the top-level frame's RenderWidgetHostView will ultimately
26// manage all native widget interaction.
27//
28// See comments in render_widget_host_view.h about this class and its members.
29class CONTENT_EXPORT RenderWidgetHostViewChildFrame
30    : public RenderWidgetHostViewBase {
31 public:
32  explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget);
33  virtual ~RenderWidgetHostViewChildFrame();
34
35  void set_cross_process_frame_connector(
36      CrossProcessFrameConnector* frame_connector) {
37    frame_connector_ = frame_connector;
38  }
39
40  // RenderWidgetHostView implementation.
41  virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE;
42  virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
43  virtual void SetSize(const gfx::Size& size) OVERRIDE;
44  virtual void SetBounds(const gfx::Rect& rect) OVERRIDE;
45  virtual void Focus() OVERRIDE;
46  virtual bool HasFocus() const OVERRIDE;
47  virtual bool IsSurfaceAvailableForCopy() const OVERRIDE;
48  virtual void Show() OVERRIDE;
49  virtual void Hide() OVERRIDE;
50  virtual bool IsShowing() OVERRIDE;
51  virtual gfx::Rect GetViewBounds() const OVERRIDE;
52  virtual gfx::NativeView GetNativeView() const OVERRIDE;
53  virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
54  virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
55  virtual void SetBackgroundOpaque(bool opaque) OVERRIDE;
56  virtual gfx::Size GetPhysicalBackingSize() const OVERRIDE;
57
58  // RenderWidgetHostViewBase implementation.
59  virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
60                           const gfx::Rect& pos) OVERRIDE;
61  virtual void InitAsFullscreen(
62      RenderWidgetHostView* reference_host_view) OVERRIDE;
63  virtual void WasShown() OVERRIDE;
64  virtual void WasHidden() OVERRIDE;
65  virtual void MovePluginWindows(
66      const std::vector<WebPluginGeometry>& moves) OVERRIDE;
67  virtual void Blur() OVERRIDE;
68  virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE;
69  virtual void SetIsLoading(bool is_loading) OVERRIDE;
70  virtual void TextInputStateChanged(
71      const ViewHostMsg_TextInputState_Params& params) OVERRIDE;
72  virtual void ImeCancelComposition() OVERRIDE;
73#if defined(OS_MACOSX) || defined(USE_AURA)
74  virtual void ImeCompositionRangeChanged(
75      const gfx::Range& range,
76      const std::vector<gfx::Rect>& character_bounds) OVERRIDE;
77#endif
78  virtual void RenderProcessGone(base::TerminationStatus status,
79                                 int error_code) OVERRIDE;
80  virtual void Destroy() OVERRIDE;
81  virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE;
82  virtual void SelectionChanged(const base::string16& text,
83                                size_t offset,
84                                const gfx::Range& range) OVERRIDE;
85  virtual void SelectionBoundsChanged(
86      const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE;
87  virtual void ScrollOffsetChanged() OVERRIDE;
88  virtual void CopyFromCompositingSurface(
89      const gfx::Rect& src_subrect,
90      const gfx::Size& dst_size,
91      const base::Callback<void(bool, const SkBitmap&)>& callback,
92      const SkBitmap::Config config) OVERRIDE;
93  virtual void CopyFromCompositingSurfaceToVideoFrame(
94      const gfx::Rect& src_subrect,
95      const scoped_refptr<media::VideoFrame>& target,
96      const base::Callback<void(bool)>& callback) OVERRIDE;
97  virtual bool CanCopyToVideoFrame() const OVERRIDE;
98  virtual void AcceleratedSurfaceInitialized(int host_id,
99                                             int route_id) OVERRIDE;
100  virtual void AcceleratedSurfaceBuffersSwapped(
101      const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
102      int gpu_host_id) OVERRIDE;
103  virtual void AcceleratedSurfacePostSubBuffer(
104      const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
105      int gpu_host_id) OVERRIDE;
106  virtual void AcceleratedSurfaceSuspend() OVERRIDE;
107  virtual void AcceleratedSurfaceRelease() OVERRIDE;
108  virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE;
109  virtual void OnSwapCompositorFrame(
110      uint32 output_surface_id,
111      scoped_ptr<cc::CompositorFrame> frame) OVERRIDE;
112  virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE;
113  virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE;
114  virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
115#if defined(USE_AURA)
116  virtual void ProcessAckedTouchEvent(
117      const TouchEventWithLatencyInfo& touch,
118      InputEventAckState ack_result) OVERRIDE;
119#endif  // defined(USE_AURA)
120  virtual bool LockMouse() OVERRIDE;
121  virtual void UnlockMouse() OVERRIDE;
122
123#if defined(OS_MACOSX)
124  // RenderWidgetHostView implementation.
125  virtual void SetActive(bool active) OVERRIDE;
126  virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE;
127  virtual void SetWindowVisibility(bool visible) OVERRIDE;
128  virtual void WindowFrameChanged() OVERRIDE;
129  virtual void ShowDefinitionForSelection() OVERRIDE;
130  virtual bool SupportsSpeech() const OVERRIDE;
131  virtual void SpeakSelection() OVERRIDE;
132  virtual bool IsSpeaking() const OVERRIDE;
133  virtual void StopSpeaking() OVERRIDE;
134
135  // RenderWidgetHostViewBase implementation.
136  virtual bool PostProcessEventForPluginIme(
137      const NativeWebKeyboardEvent& event) OVERRIDE;
138#endif  // defined(OS_MACOSX)
139
140#if defined(OS_ANDROID)
141  // RenderWidgetHostViewBase implementation.
142  virtual void ShowDisambiguationPopup(
143      const gfx::Rect& target_rect,
144      const SkBitmap& zoomed_bitmap) OVERRIDE;
145  virtual void LockCompositingSurface() OVERRIDE;
146  virtual void UnlockCompositingSurface() OVERRIDE;
147#endif  // defined(OS_ANDROID)
148
149#if defined(OS_WIN)
150  virtual void SetParentNativeViewAccessible(
151      gfx::NativeViewAccessible accessible_parent) OVERRIDE;
152  virtual gfx::NativeViewId GetParentForWindowlessPlugin() const OVERRIDE;
153#endif
154
155  virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE;
156
157 protected:
158  friend class RenderWidgetHostView;
159
160  // Members will become private when RenderWidgetHostViewGuest is removed.
161  // The model object.
162  RenderWidgetHostImpl* host_;
163
164  // frame_connector_ provides a platform abstraction. Messages
165  // sent through it are routed to the embedding renderer process.
166  CrossProcessFrameConnector* frame_connector_;
167
168 private:
169  DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame);
170};
171
172}  // namespace content
173
174#endif  // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
175