Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / browser / frame_host / render_widget_host_view_child_frame.h
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.
4
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_
7
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 "ui/gfx/native_widget_types.h"
12 #include "ui/gfx/rect.h"
13
14 namespace content {
15 class CrossProcessFrameConnector;
16 class RenderWidgetHost;
17 class RenderWidgetHostImpl;
18
19 // RenderWidgetHostViewChildFrame implements the view for a RenderWidgetHost
20 // associated with content being rendered in a separate process from
21 // content that is embedding it. This is not a platform-specific class; rather,
22 // the embedding renderer process implements the platform containing the
23 // widget, and the top-level frame's RenderWidgetHostView will ultimately
24 // manage all native widget interaction.
25 //
26 // See comments in render_widget_host_view.h about this class and its members.
27 class CONTENT_EXPORT RenderWidgetHostViewChildFrame
28     : public RenderWidgetHostViewBase {
29  public:
30   explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget);
31   virtual ~RenderWidgetHostViewChildFrame();
32
33   void set_cross_process_frame_connector(
34       CrossProcessFrameConnector* frame_connector) {
35     frame_connector_ = frame_connector;
36   }
37
38   // RenderWidgetHostView implementation.
39   virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE;
40   virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
41   virtual void SetSize(const gfx::Size& size) OVERRIDE;
42   virtual void SetBounds(const gfx::Rect& rect) OVERRIDE;
43   virtual void Focus() OVERRIDE;
44   virtual bool HasFocus() const OVERRIDE;
45   virtual bool IsSurfaceAvailableForCopy() const OVERRIDE;
46   virtual void Show() OVERRIDE;
47   virtual void Hide() OVERRIDE;
48   virtual bool IsShowing() OVERRIDE;
49   virtual gfx::Rect GetViewBounds() const OVERRIDE;
50   virtual gfx::NativeView GetNativeView() const OVERRIDE;
51   virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
52   virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
53   virtual void SetBackground(const SkBitmap& background) OVERRIDE;
54   virtual gfx::Size GetPhysicalBackingSize() const OVERRIDE;
55
56   // RenderWidgetHostViewPort implementation.
57   virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
58                            const gfx::Rect& pos) OVERRIDE;
59   virtual void InitAsFullscreen(
60       RenderWidgetHostView* reference_host_view) OVERRIDE;
61   virtual void WasShown() OVERRIDE;
62   virtual void WasHidden() OVERRIDE;
63   virtual void MovePluginWindows(
64       const gfx::Vector2d& scroll_offset,
65       const std::vector<WebPluginGeometry>& moves) OVERRIDE;
66   virtual void Blur() OVERRIDE;
67   virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE;
68   virtual void SetIsLoading(bool is_loading) OVERRIDE;
69   virtual void TextInputTypeChanged(ui::TextInputType type,
70                                     ui::TextInputMode input_mode,
71                                     bool can_compose_inline) OVERRIDE;
72   virtual void ImeCancelComposition() OVERRIDE;
73 #if defined(OS_MACOSX) || defined(OS_WIN) || 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 DidUpdateBackingStore(
79       const gfx::Rect& scroll_rect,
80       const gfx::Vector2d& scroll_delta,
81       const std::vector<gfx::Rect>& copy_rects,
82       const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE;
83   virtual void RenderProcessGone(base::TerminationStatus status,
84                                  int error_code) OVERRIDE;
85   virtual void Destroy() OVERRIDE;
86   virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE;
87   virtual void SelectionChanged(const base::string16& text,
88                                 size_t offset,
89                                 const gfx::Range& range) OVERRIDE;
90   virtual void SelectionBoundsChanged(
91       const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE;
92   virtual void ScrollOffsetChanged() OVERRIDE;
93   virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE;
94   virtual void CopyFromCompositingSurface(
95       const gfx::Rect& src_subrect,
96       const gfx::Size& dst_size,
97       const base::Callback<void(bool, const SkBitmap&)>& callback,
98       const SkBitmap::Config config) OVERRIDE;
99   virtual void CopyFromCompositingSurfaceToVideoFrame(
100       const gfx::Rect& src_subrect,
101       const scoped_refptr<media::VideoFrame>& target,
102       const base::Callback<void(bool)>& callback) OVERRIDE;
103   virtual bool CanCopyToVideoFrame() const OVERRIDE;
104   virtual void OnAcceleratedCompositingStateChange() OVERRIDE;
105   virtual void AcceleratedSurfaceInitialized(int host_id,
106                                              int route_id) OVERRIDE;
107   virtual void AcceleratedSurfaceBuffersSwapped(
108       const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
109       int gpu_host_id) OVERRIDE;
110   virtual void AcceleratedSurfacePostSubBuffer(
111       const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
112       int gpu_host_id) OVERRIDE;
113   virtual void AcceleratedSurfaceSuspend() OVERRIDE;
114   virtual void AcceleratedSurfaceRelease() OVERRIDE;
115   virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE;
116   virtual void OnSwapCompositorFrame(
117       uint32 output_surface_id,
118       scoped_ptr<cc::CompositorFrame> frame) OVERRIDE;
119   virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE;
120   virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE;
121   virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
122   virtual void SetHasHorizontalScrollbar(
123       bool has_horizontal_scrollbar) OVERRIDE;
124   virtual void SetScrollOffsetPinning(
125       bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
126 #if defined(OS_WIN) || defined(USE_AURA)
127   virtual void ProcessAckedTouchEvent(
128       const TouchEventWithLatencyInfo& touch,
129       InputEventAckState ack_result) OVERRIDE;
130 #endif  // defined(OS_WIN) || defined(USE_AURA)
131   virtual bool LockMouse() OVERRIDE;
132   virtual void UnlockMouse() OVERRIDE;
133
134 #if defined(OS_MACOSX)
135   // RenderWidgetHostView implementation.
136   virtual void SetActive(bool active) OVERRIDE;
137   virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE;
138   virtual void SetWindowVisibility(bool visible) OVERRIDE;
139   virtual void WindowFrameChanged() OVERRIDE;
140   virtual void ShowDefinitionForSelection() OVERRIDE;
141   virtual bool SupportsSpeech() const OVERRIDE;
142   virtual void SpeakSelection() OVERRIDE;
143   virtual bool IsSpeaking() const OVERRIDE;
144   virtual void StopSpeaking() OVERRIDE;
145
146   // RenderWidgetHostViewPort implementation.
147   virtual bool PostProcessEventForPluginIme(
148       const NativeWebKeyboardEvent& event) OVERRIDE;
149 #endif  // defined(OS_MACOSX)
150
151 #if defined(OS_ANDROID)
152   // RenderWidgetHostViewPort implementation.
153   virtual void ShowDisambiguationPopup(
154       const gfx::Rect& target_rect,
155       const SkBitmap& zoomed_bitmap) OVERRIDE;
156 #endif  // defined(OS_ANDROID)
157
158 #if defined(TOOLKIT_GTK)
159   virtual GdkEventButton* GetLastMouseDown() OVERRIDE;
160   virtual gfx::NativeView BuildInputMethodsGtkMenu() OVERRIDE;
161 #endif  // defined(TOOLKIT_GTK)
162
163 #if defined(OS_WIN)
164   virtual void SetParentNativeViewAccessible(
165       gfx::NativeViewAccessible accessible_parent) OVERRIDE;
166   virtual gfx::NativeViewId GetParentForWindowlessPlugin() const OVERRIDE;
167 #endif
168
169  protected:
170   friend class RenderWidgetHostView;
171
172   // Members will become private when RenderWidgetHostViewGuest is removed.
173   // The model object.
174   RenderWidgetHostImpl* host_;
175
176   // frame_connector_ provides a platform abstraction. Messages
177   // sent through it are routed to the embedding renderer process.
178   CrossProcessFrameConnector* frame_connector_;
179
180   gfx::Size size_;
181
182  private:
183   DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame);
184 };
185
186 }  // namespace content
187
188 #endif  // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_