[Session restore] Rename group name Enabled to Restore.
[chromium-blink-merge.git] / content / browser / frame_host / render_widget_host_view_child_frame.cc
blobebbea17c2a927c70d7ad24f782b1946d61e31fdc
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 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
7 #include "content/browser/accessibility/browser_accessibility_manager.h"
8 #include "content/browser/frame_host/cross_process_frame_connector.h"
9 #include "content/browser/renderer_host/render_widget_host_impl.h"
10 #include "content/common/gpu/gpu_messages.h"
11 #include "content/common/view_messages.h"
12 #include "content/public/browser/render_process_host.h"
14 namespace content {
16 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame(
17 RenderWidgetHost* widget_host)
18 : host_(RenderWidgetHostImpl::From(widget_host)),
19 frame_connector_(NULL) {
20 host_->SetView(this);
23 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
26 void RenderWidgetHostViewChildFrame::InitAsChild(
27 gfx::NativeView parent_view) {
28 NOTREACHED();
31 RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const {
32 return host_;
35 void RenderWidgetHostViewChildFrame::SetSize(const gfx::Size& size) {
36 host_->WasResized();
39 void RenderWidgetHostViewChildFrame::SetBounds(const gfx::Rect& rect) {
40 SetSize(rect.size());
43 void RenderWidgetHostViewChildFrame::Focus() {
46 bool RenderWidgetHostViewChildFrame::HasFocus() const {
47 return false;
50 bool RenderWidgetHostViewChildFrame::IsSurfaceAvailableForCopy() const {
51 NOTIMPLEMENTED();
52 return false;
55 void RenderWidgetHostViewChildFrame::Show() {
56 if (!host_->is_hidden())
57 return;
58 host_->WasShown(ui::LatencyInfo());
61 void RenderWidgetHostViewChildFrame::Hide() {
62 if (host_->is_hidden())
63 return;
64 host_->WasHidden();
67 bool RenderWidgetHostViewChildFrame::IsShowing() {
68 return !host_->is_hidden();
71 gfx::Rect RenderWidgetHostViewChildFrame::GetViewBounds() const {
72 gfx::Rect rect;
73 if (frame_connector_)
74 rect = frame_connector_->ChildFrameRect();
75 return rect;
78 gfx::Vector2dF RenderWidgetHostViewChildFrame::GetLastScrollOffset() const {
79 return last_scroll_offset_;
82 gfx::NativeView RenderWidgetHostViewChildFrame::GetNativeView() const {
83 NOTREACHED();
84 return NULL;
87 gfx::NativeViewId RenderWidgetHostViewChildFrame::GetNativeViewId() const {
88 NOTREACHED();
89 return 0;
92 gfx::NativeViewAccessible
93 RenderWidgetHostViewChildFrame::GetNativeViewAccessible() {
94 NOTREACHED();
95 return NULL;
98 void RenderWidgetHostViewChildFrame::SetBackgroundColor(SkColor color) {
101 gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const {
102 gfx::Size size;
103 if (frame_connector_)
104 size = frame_connector_->ChildFrameRect().size();
105 return size;
108 void RenderWidgetHostViewChildFrame::InitAsPopup(
109 RenderWidgetHostView* parent_host_view,
110 const gfx::Rect& bounds) {
111 NOTREACHED();
114 void RenderWidgetHostViewChildFrame::InitAsFullscreen(
115 RenderWidgetHostView* reference_host_view) {
116 NOTREACHED();
119 void RenderWidgetHostViewChildFrame::ImeCancelComposition() {
120 NOTREACHED();
123 void RenderWidgetHostViewChildFrame::ImeCompositionRangeChanged(
124 const gfx::Range& range,
125 const std::vector<gfx::Rect>& character_bounds) {
126 NOTREACHED();
129 void RenderWidgetHostViewChildFrame::MovePluginWindows(
130 const std::vector<WebPluginGeometry>& moves) {
133 void RenderWidgetHostViewChildFrame::Blur() {
136 void RenderWidgetHostViewChildFrame::UpdateCursor(const WebCursor& cursor) {
139 void RenderWidgetHostViewChildFrame::SetIsLoading(bool is_loading) {
140 NOTREACHED();
143 void RenderWidgetHostViewChildFrame::TextInputTypeChanged(
144 ui::TextInputType type,
145 ui::TextInputMode input_mode,
146 bool can_compose_inline,
147 int flags) {
148 // TODO(kenrb): Implement.
151 void RenderWidgetHostViewChildFrame::RenderProcessGone(
152 base::TerminationStatus status,
153 int error_code) {
154 if (frame_connector_)
155 frame_connector_->RenderProcessGone();
156 Destroy();
159 void RenderWidgetHostViewChildFrame::Destroy() {
160 if (frame_connector_) {
161 frame_connector_->set_view(NULL);
162 frame_connector_ = NULL;
165 host_->SetView(NULL);
166 host_ = NULL;
167 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
170 void RenderWidgetHostViewChildFrame::SetTooltipText(
171 const base::string16& tooltip_text) {
174 void RenderWidgetHostViewChildFrame::SelectionChanged(
175 const base::string16& text,
176 size_t offset,
177 const gfx::Range& range) {
180 void RenderWidgetHostViewChildFrame::SelectionBoundsChanged(
181 const ViewHostMsg_SelectionBounds_Params& params) {
184 #if defined(OS_ANDROID)
185 void RenderWidgetHostViewChildFrame::LockCompositingSurface() {
188 void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() {
190 #endif
192 void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame(
193 uint32 output_surface_id,
194 scoped_ptr<cc::CompositorFrame> frame) {
195 last_scroll_offset_ = frame->metadata.root_scroll_offset;
196 if (frame_connector_) {
197 frame_connector_->ChildFrameCompositorFrameSwapped(
198 output_surface_id,
199 host_->GetProcess()->GetID(),
200 host_->GetRoutingID(),
201 frame.Pass());
205 void RenderWidgetHostViewChildFrame::GetScreenInfo(
206 blink::WebScreenInfo* results) {
209 gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() {
210 // We do not have any root window specific parts in this view.
211 return GetViewBounds();
214 #if defined(USE_AURA)
215 void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent(
216 const TouchEventWithLatencyInfo& touch,
217 InputEventAckState ack_result) {
219 #endif // defined(USE_AURA)
221 bool RenderWidgetHostViewChildFrame::LockMouse() {
222 return false;
225 void RenderWidgetHostViewChildFrame::UnlockMouse() {
228 #if defined(OS_MACOSX)
229 void RenderWidgetHostViewChildFrame::SetActive(bool active) {
232 void RenderWidgetHostViewChildFrame::SetWindowVisibility(bool visible) {
235 void RenderWidgetHostViewChildFrame::WindowFrameChanged() {
238 void RenderWidgetHostViewChildFrame::ShowDefinitionForSelection() {
241 bool RenderWidgetHostViewChildFrame::SupportsSpeech() const {
242 return false;
245 void RenderWidgetHostViewChildFrame::SpeakSelection() {
248 bool RenderWidgetHostViewChildFrame::IsSpeaking() const {
249 return false;
252 void RenderWidgetHostViewChildFrame::StopSpeaking() {
255 bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme(
256 const NativeWebKeyboardEvent& event) {
257 return false;
259 #endif // defined(OS_MACOSX)
261 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface(
262 const gfx::Rect& src_subrect,
263 const gfx::Size& /* dst_size */,
264 ReadbackRequestCallback& callback,
265 const SkColorType color_type) {
266 callback.Run(SkBitmap(), READBACK_NOT_SUPPORTED);
269 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame(
270 const gfx::Rect& src_subrect,
271 const scoped_refptr<media::VideoFrame>& target,
272 const base::Callback<void(bool)>& callback) {
273 NOTIMPLEMENTED();
274 callback.Run(false);
277 bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const {
278 return false;
281 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface(
282 const gfx::Size& desired_size) {
283 return false;
286 gfx::GLSurfaceHandle RenderWidgetHostViewChildFrame::GetCompositingSurface() {
287 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NULL_TRANSPORT);
290 #if defined(OS_WIN)
291 void RenderWidgetHostViewChildFrame::SetParentNativeViewAccessible(
292 gfx::NativeViewAccessible accessible_parent) {
295 gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin()
296 const {
297 return NULL;
299 #endif // defined(OS_WIN)
301 SkColorType RenderWidgetHostViewChildFrame::PreferredReadbackFormat() {
302 return kN32_SkColorType;
305 BrowserAccessibilityManager*
306 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager(
307 BrowserAccessibilityDelegate* delegate) {
308 return BrowserAccessibilityManager::Create(
309 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
312 } // namespace content