Fix broken path in extensions/common/PRESUBMIT.py
[chromium-blink-merge.git] / content / browser / frame_host / render_widget_host_view_child_frame.cc
blobc42a3f28ac7ec3c2abc51a56cca165b4409288da
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::UpdateCursor(const WebCursor& cursor) {
136 void RenderWidgetHostViewChildFrame::SetIsLoading(bool is_loading) {
137 NOTREACHED();
140 void RenderWidgetHostViewChildFrame::TextInputTypeChanged(
141 ui::TextInputType type,
142 ui::TextInputMode input_mode,
143 bool can_compose_inline,
144 int flags) {
145 // TODO(kenrb): Implement.
148 void RenderWidgetHostViewChildFrame::RenderProcessGone(
149 base::TerminationStatus status,
150 int error_code) {
151 if (frame_connector_)
152 frame_connector_->RenderProcessGone();
153 Destroy();
156 void RenderWidgetHostViewChildFrame::Destroy() {
157 if (frame_connector_) {
158 frame_connector_->set_view(NULL);
159 frame_connector_ = NULL;
162 host_->SetView(NULL);
163 host_ = NULL;
164 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
167 void RenderWidgetHostViewChildFrame::SetTooltipText(
168 const base::string16& tooltip_text) {
171 void RenderWidgetHostViewChildFrame::SelectionChanged(
172 const base::string16& text,
173 size_t offset,
174 const gfx::Range& range) {
177 void RenderWidgetHostViewChildFrame::SelectionBoundsChanged(
178 const ViewHostMsg_SelectionBounds_Params& params) {
181 #if defined(OS_ANDROID)
182 void RenderWidgetHostViewChildFrame::LockCompositingSurface() {
185 void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() {
187 #endif
189 void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame(
190 uint32 output_surface_id,
191 scoped_ptr<cc::CompositorFrame> frame) {
192 last_scroll_offset_ = frame->metadata.root_scroll_offset;
193 if (frame_connector_) {
194 frame_connector_->ChildFrameCompositorFrameSwapped(
195 output_surface_id,
196 host_->GetProcess()->GetID(),
197 host_->GetRoutingID(),
198 frame.Pass());
202 void RenderWidgetHostViewChildFrame::GetScreenInfo(
203 blink::WebScreenInfo* results) {
206 gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() {
207 // We do not have any root window specific parts in this view.
208 return GetViewBounds();
211 #if defined(USE_AURA)
212 void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent(
213 const TouchEventWithLatencyInfo& touch,
214 InputEventAckState ack_result) {
216 #endif // defined(USE_AURA)
218 bool RenderWidgetHostViewChildFrame::LockMouse() {
219 return false;
222 void RenderWidgetHostViewChildFrame::UnlockMouse() {
225 #if defined(OS_MACOSX)
226 void RenderWidgetHostViewChildFrame::SetActive(bool active) {
229 void RenderWidgetHostViewChildFrame::SetWindowVisibility(bool visible) {
232 void RenderWidgetHostViewChildFrame::WindowFrameChanged() {
235 void RenderWidgetHostViewChildFrame::ShowDefinitionForSelection() {
238 bool RenderWidgetHostViewChildFrame::SupportsSpeech() const {
239 return false;
242 void RenderWidgetHostViewChildFrame::SpeakSelection() {
245 bool RenderWidgetHostViewChildFrame::IsSpeaking() const {
246 return false;
249 void RenderWidgetHostViewChildFrame::StopSpeaking() {
252 bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme(
253 const NativeWebKeyboardEvent& event) {
254 return false;
256 #endif // defined(OS_MACOSX)
258 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface(
259 const gfx::Rect& src_subrect,
260 const gfx::Size& /* dst_size */,
261 ReadbackRequestCallback& callback,
262 const SkColorType preferred_color_type) {
263 callback.Run(SkBitmap(), READBACK_FAILED);
266 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame(
267 const gfx::Rect& src_subrect,
268 const scoped_refptr<media::VideoFrame>& target,
269 const base::Callback<void(bool)>& callback) {
270 NOTIMPLEMENTED();
271 callback.Run(false);
274 bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const {
275 return false;
278 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface(
279 const gfx::Size& desired_size) {
280 return false;
283 gfx::GLSurfaceHandle RenderWidgetHostViewChildFrame::GetCompositingSurface() {
284 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NULL_TRANSPORT);
287 #if defined(OS_WIN)
288 void RenderWidgetHostViewChildFrame::SetParentNativeViewAccessible(
289 gfx::NativeViewAccessible accessible_parent) {
292 gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin()
293 const {
294 return NULL;
296 #endif // defined(OS_WIN)
298 BrowserAccessibilityManager*
299 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager(
300 BrowserAccessibilityDelegate* delegate) {
301 return BrowserAccessibilityManager::Create(
302 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
305 } // namespace content