Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / frame_host / render_widget_host_view_child_frame.h
blob84835a871a541955369761f7c33cc71b44416f43
1 // Copyright 2014 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.
5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/renderer_host/render_widget_host_view_base.h"
10 #include "content/common/content_export.h"
11 #include "content/public/browser/readback_types.h"
12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/native_widget_types.h"
15 namespace content {
16 class CrossProcessFrameConnector;
17 class RenderWidgetHost;
18 class RenderWidgetHostImpl;
20 // RenderWidgetHostViewChildFrame implements the view for a RenderWidgetHost
21 // associated with content being rendered in a separate process from
22 // content that is embedding it. This is not a platform-specific class; rather,
23 // the embedding renderer process implements the platform containing the
24 // widget, and the top-level frame's RenderWidgetHostView will ultimately
25 // manage all native widget interaction.
27 // See comments in render_widget_host_view.h about this class and its members.
28 class CONTENT_EXPORT RenderWidgetHostViewChildFrame
29 : public RenderWidgetHostViewBase {
30 public:
31 explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget);
32 ~RenderWidgetHostViewChildFrame() override;
34 void set_cross_process_frame_connector(
35 CrossProcessFrameConnector* frame_connector) {
36 frame_connector_ = frame_connector;
39 // RenderWidgetHostView implementation.
40 void InitAsChild(gfx::NativeView parent_view) override;
41 RenderWidgetHost* GetRenderWidgetHost() const override;
42 void SetSize(const gfx::Size& size) override;
43 void SetBounds(const gfx::Rect& rect) override;
44 void Focus() override;
45 bool HasFocus() const override;
46 bool IsSurfaceAvailableForCopy() const override;
47 void Show() override;
48 void Hide() override;
49 bool IsShowing() override;
50 gfx::Rect GetViewBounds() const override;
51 gfx::Vector2dF GetLastScrollOffset() const override;
52 gfx::NativeView GetNativeView() const override;
53 gfx::NativeViewId GetNativeViewId() const override;
54 gfx::NativeViewAccessible GetNativeViewAccessible() override;
55 void SetBackgroundColor(SkColor color) override;
56 gfx::Size GetPhysicalBackingSize() const override;
58 // RenderWidgetHostViewBase implementation.
59 void InitAsPopup(RenderWidgetHostView* parent_host_view,
60 const gfx::Rect& bounds) override;
61 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override;
62 void MovePluginWindows(const std::vector<WebPluginGeometry>& moves) override;
63 void Blur() override;
64 void UpdateCursor(const WebCursor& cursor) override;
65 void SetIsLoading(bool is_loading) override;
66 void TextInputTypeChanged(ui::TextInputType type,
67 ui::TextInputMode input_mode,
68 bool can_compose_inline,
69 int flags) override;
70 void ImeCancelComposition() override;
71 void ImeCompositionRangeChanged(
72 const gfx::Range& range,
73 const std::vector<gfx::Rect>& character_bounds) override;
74 void RenderProcessGone(base::TerminationStatus status,
75 int error_code) override;
76 void Destroy() override;
77 void SetTooltipText(const base::string16& tooltip_text) override;
78 void SelectionChanged(const base::string16& text,
79 size_t offset,
80 const gfx::Range& range) override;
81 void SelectionBoundsChanged(
82 const ViewHostMsg_SelectionBounds_Params& params) override;
83 void CopyFromCompositingSurface(const gfx::Rect& src_subrect,
84 const gfx::Size& dst_size,
85 ReadbackRequestCallback& callback,
86 const SkColorType color_type) override;
87 void CopyFromCompositingSurfaceToVideoFrame(
88 const gfx::Rect& src_subrect,
89 const scoped_refptr<media::VideoFrame>& target,
90 const base::Callback<void(bool)>& callback) override;
91 bool CanCopyToVideoFrame() const override;
92 bool HasAcceleratedSurface(const gfx::Size& desired_size) override;
93 void OnSwapCompositorFrame(uint32 output_surface_id,
94 scoped_ptr<cc::CompositorFrame> frame) override;
95 void GetScreenInfo(blink::WebScreenInfo* results) override;
96 gfx::Rect GetBoundsInRootWindow() override;
97 gfx::GLSurfaceHandle GetCompositingSurface() override;
98 #if defined(USE_AURA)
99 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch,
100 InputEventAckState ack_result) override;
101 #endif // defined(USE_AURA)
102 bool LockMouse() override;
103 void UnlockMouse() override;
105 #if defined(OS_MACOSX)
106 // RenderWidgetHostView implementation.
107 void SetActive(bool active) override;
108 void SetWindowVisibility(bool visible) override;
109 void WindowFrameChanged() override;
110 void ShowDefinitionForSelection() override;
111 bool SupportsSpeech() const override;
112 void SpeakSelection() override;
113 bool IsSpeaking() const override;
114 void StopSpeaking() override;
116 // RenderWidgetHostViewBase implementation.
117 bool PostProcessEventForPluginIme(
118 const NativeWebKeyboardEvent& event) override;
119 #endif // defined(OS_MACOSX)
121 // RenderWidgetHostViewBase implementation.
122 #if defined(OS_ANDROID)
123 void LockCompositingSurface() override;
124 void UnlockCompositingSurface() override;
125 #endif // defined(OS_ANDROID)
127 #if defined(OS_WIN)
128 virtual void SetParentNativeViewAccessible(
129 gfx::NativeViewAccessible accessible_parent) override;
130 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const override;
131 #endif
132 BrowserAccessibilityManager* CreateBrowserAccessibilityManager(
133 BrowserAccessibilityDelegate* delegate) override;
135 SkColorType PreferredReadbackFormat() override;
137 protected:
138 friend class RenderWidgetHostView;
140 // The last scroll offset of the view.
141 gfx::Vector2dF last_scroll_offset_;
143 // Members will become private when RenderWidgetHostViewGuest is removed.
144 // The model object.
145 RenderWidgetHostImpl* host_;
147 // frame_connector_ provides a platform abstraction. Messages
148 // sent through it are routed to the embedding renderer process.
149 CrossProcessFrameConnector* frame_connector_;
151 private:
152 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame);
155 } // namespace content
157 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_