Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 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 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | |
| 6 | |
| 7 #include "content/browser/frame_host/cross_process_frame_connector.h" | |
| 8 #include "content/browser/renderer_host/render_widget_host_impl.h" | |
| 9 #include "content/common/gpu/gpu_messages.h" | |
| 10 #include "content/common/view_messages.h" | |
| 11 #include "content/public/browser/render_process_host.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( | |
| 16 RenderWidgetHost* widget_host) | |
| 17 : host_(RenderWidgetHostImpl::From(widget_host)), | |
| 18 frame_connector_(NULL) { | |
| 19 host_->SetView(this); | |
| 20 } | |
| 21 | |
| 22 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { | |
| 23 } | |
| 24 | |
| 25 void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector( | |
| 26 CrossProcessFrameConnector* frame_connector) { | |
| 27 frame_connector_ = frame_connector; | |
|
Charlie Reis
2013/12/17 01:09:31
Can be inlined in the .h file, unix_hacker_style.
awong
2013/12/17 02:45:27
Done.
| |
| 28 } | |
| 29 | |
| 30 void RenderWidgetHostViewChildFrame::InitAsChild( | |
| 31 gfx::NativeView parent_view) { | |
| 32 NOTREACHED(); | |
| 33 } | |
| 34 | |
| 35 RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const { | |
| 36 return host_; | |
| 37 } | |
| 38 | |
| 39 void RenderWidgetHostViewChildFrame::SetSize(const gfx::Size& size) { | |
| 40 size_ = size; | |
| 41 host_->WasResized(); | |
| 42 } | |
| 43 | |
| 44 void RenderWidgetHostViewChildFrame::SetBounds(const gfx::Rect& rect) { | |
| 45 SetSize(rect.size()); | |
| 46 } | |
| 47 | |
| 48 void RenderWidgetHostViewChildFrame::Focus() { | |
|
Charlie Reis
2013/12/17 01:09:31
Do we need this (and other empty methods) in the .
awong
2013/12/17 02:45:27
Went the other direction to match the other RWHVs
| |
| 49 } | |
| 50 | |
| 51 bool RenderWidgetHostViewChildFrame::HasFocus() const { | |
| 52 return false; | |
| 53 } | |
| 54 | |
| 55 bool RenderWidgetHostViewChildFrame::IsSurfaceAvailableForCopy() const { | |
| 56 NOTIMPLEMENTED(); | |
| 57 return false; | |
| 58 } | |
| 59 | |
| 60 void RenderWidgetHostViewChildFrame::Show() { | |
| 61 WasShown(); | |
| 62 } | |
| 63 | |
| 64 void RenderWidgetHostViewChildFrame::Hide() { | |
| 65 WasHidden(); | |
| 66 } | |
| 67 | |
| 68 bool RenderWidgetHostViewChildFrame::IsShowing() { | |
| 69 return !host_->is_hidden(); | |
| 70 } | |
| 71 | |
| 72 gfx::Rect RenderWidgetHostViewChildFrame::GetViewBounds() const { | |
| 73 gfx::Rect rect; | |
| 74 if (frame_connector_) | |
| 75 rect = frame_connector_->ChildFrameRect(); | |
| 76 rect.set_width(size_.width()); | |
| 77 rect.set_height(size_.height()); | |
| 78 return rect; | |
| 79 } | |
| 80 | |
| 81 gfx::NativeView RenderWidgetHostViewChildFrame::GetNativeView() const { | |
| 82 NOTREACHED(); | |
| 83 return 0; | |
|
Charlie Reis
2013/12/17 01:09:31
0 -> NULL?
(throughout the class)
awong
2013/12/17 02:45:27
Done.
| |
| 84 } | |
| 85 | |
| 86 gfx::NativeViewId RenderWidgetHostViewChildFrame::GetNativeViewId() const { | |
| 87 NOTREACHED(); | |
| 88 return 0; | |
| 89 } | |
| 90 | |
| 91 gfx::NativeViewAccessible | |
| 92 RenderWidgetHostViewChildFrame::GetNativeViewAccessible() { | |
| 93 NOTREACHED(); | |
| 94 return 0; | |
| 95 } | |
| 96 | |
| 97 gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const { | |
| 98 return size_; | |
| 99 } | |
| 100 | |
| 101 void RenderWidgetHostViewChildFrame::InitAsPopup( | |
| 102 RenderWidgetHostView* parent_host_view, | |
| 103 const gfx::Rect& pos) { | |
| 104 NOTREACHED(); | |
| 105 } | |
| 106 | |
| 107 void RenderWidgetHostViewChildFrame::InitAsFullscreen( | |
| 108 RenderWidgetHostView* reference_host_view) { | |
| 109 NOTREACHED(); | |
| 110 } | |
| 111 | |
| 112 void RenderWidgetHostViewChildFrame::ImeCancelComposition() { | |
| 113 NOTREACHED(); | |
| 114 } | |
| 115 | |
| 116 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) | |
| 117 void RenderWidgetHostViewChildFrame::ImeCompositionRangeChanged( | |
| 118 const gfx::Range& range, | |
| 119 const std::vector<gfx::Rect>& character_bounds) { | |
| 120 NOTREACHED(); | |
| 121 } | |
| 122 #endif | |
| 123 | |
| 124 void RenderWidgetHostViewChildFrame::DidUpdateBackingStore( | |
| 125 const gfx::Rect& scroll_rect, | |
| 126 const gfx::Vector2d& scroll_delta, | |
| 127 const std::vector<gfx::Rect>& copy_rects, | |
| 128 const ui::LatencyInfo& latency_info) { | |
| 129 NOTREACHED(); | |
| 130 } | |
| 131 | |
| 132 void RenderWidgetHostViewChildFrame::WasShown() { | |
| 133 if (!host_->is_hidden()) | |
| 134 return; | |
| 135 host_->WasShown(); | |
| 136 } | |
| 137 | |
| 138 void RenderWidgetHostViewChildFrame::WasHidden() { | |
| 139 if (host_->is_hidden()) | |
| 140 return; | |
| 141 host_->WasHidden(); | |
| 142 } | |
| 143 | |
| 144 void RenderWidgetHostViewChildFrame::Destroy() { | |
| 145 if (frame_connector_) { | |
| 146 frame_connector_->Destroy(); | |
| 147 frame_connector_ = NULL; | |
| 148 } | |
| 149 | |
| 150 host_->SetView(NULL); | |
| 151 host_ = NULL; | |
| 152 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | |
| 153 } | |
| 154 | |
| 155 void RenderWidgetHostViewChildFrame::OnAcceleratedCompositingStateChange() { | |
| 156 } | |
| 157 | |
| 158 void RenderWidgetHostViewChildFrame::AcceleratedSurfaceInitialized(int host_id, | |
| 159 int route_id) { | |
| 160 } | |
| 161 | |
| 162 void RenderWidgetHostViewChildFrame::AcceleratedSurfaceBuffersSwapped( | |
| 163 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | |
| 164 int gpu_host_id) { | |
| 165 if (frame_connector_) | |
| 166 frame_connector_->ChildFrameBuffersSwapped(params, gpu_host_id); | |
| 167 } | |
| 168 | |
| 169 void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( | |
| 170 uint32 output_surface_id, | |
| 171 scoped_ptr<cc::CompositorFrame> frame) { | |
| 172 if (frame_connector_) | |
| 173 frame_connector_->ChildFrameCompositorFrameSwapped( | |
| 174 output_surface_id, frame.Pass()); | |
| 175 } | |
| 176 | |
| 177 gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() { | |
| 178 // We do not have any root window specific parts in this view. | |
| 179 return GetViewBounds(); | |
| 180 } | |
| 181 | |
| 182 bool RenderWidgetHostViewChildFrame::LockMouse() { | |
| 183 return false; | |
| 184 } | |
| 185 | |
| 186 #if defined(OS_MACOSX) | |
| 187 bool RenderWidgetHostViewChildFrame::SupportsSpeech() const { | |
| 188 return false; | |
| 189 } | |
| 190 | |
| 191 bool RenderWidgetHostViewChildFrame::IsSpeaking() const { | |
| 192 return false; | |
| 193 } | |
| 194 | |
| 195 bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme( | |
| 196 const NativeWebKeyboardEvent& event) { | |
| 197 return false; | |
| 198 } | |
| 199 #endif // defined(OS_MACOSX) | |
| 200 | |
| 201 #if defined(TOOLKIT_GTK) | |
| 202 GdkEventButton* RenderWidgetHostViewChildFrame::GetLastMouseDown() { | |
| 203 return 0; | |
| 204 } | |
| 205 | |
| 206 gfx::NativeView RenderWidgetHostViewChildFrame::BuildInputMethodsGtkMenu() { | |
| 207 return 0; | |
| 208 } | |
| 209 #endif // defined(TOOLKIT_GTK) | |
| 210 | |
| 211 void RenderWidgetHostViewChildFrame::Blur() { | |
| 212 } | |
| 213 | |
| 214 void RenderWidgetHostViewChildFrame::SetIsLoading(bool is_loading) { | |
| 215 NOTREACHED(); | |
| 216 } | |
| 217 | |
| 218 void RenderWidgetHostViewChildFrame::TextInputTypeChanged( | |
| 219 ui::TextInputType type, | |
| 220 ui::TextInputMode input_mode, | |
| 221 bool can_compose_inline) { | |
| 222 NOTREACHED(); | |
| 223 } | |
| 224 | |
| 225 void RenderWidgetHostViewChildFrame::ScrollOffsetChanged() { | |
| 226 } | |
| 227 | |
| 228 BackingStore* RenderWidgetHostViewChildFrame::AllocBackingStore( | |
| 229 const gfx::Size& size) { | |
| 230 NOTREACHED(); | |
| 231 return NULL; | |
| 232 } | |
| 233 | |
| 234 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface( | |
| 235 const gfx::Rect& src_subrect, | |
| 236 const gfx::Size& /* dst_size */, | |
| 237 const base::Callback<void(bool, const SkBitmap&)>& callback) { | |
| 238 callback.Run(false, SkBitmap()); | |
| 239 } | |
| 240 | |
| 241 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame( | |
| 242 const gfx::Rect& src_subrect, | |
| 243 const scoped_refptr<media::VideoFrame>& target, | |
| 244 const base::Callback<void(bool)>& callback) { | |
| 245 NOTIMPLEMENTED(); | |
| 246 callback.Run(false); | |
| 247 } | |
| 248 | |
| 249 bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const { | |
| 250 return false; | |
| 251 } | |
| 252 | |
| 253 void RenderWidgetHostViewChildFrame::AcceleratedSurfaceSuspend() { | |
| 254 NOTREACHED(); | |
| 255 } | |
| 256 | |
| 257 void RenderWidgetHostViewChildFrame::AcceleratedSurfaceRelease() { | |
| 258 } | |
| 259 | |
| 260 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface( | |
| 261 const gfx::Size& desired_size) { | |
| 262 return false; | |
| 263 } | |
| 264 | |
| 265 #if defined(OS_WIN) && !defined(USE_AURA) | |
| 266 void RenderWidgetHostViewChildFrame::SetClickthroughRegion(SkRegion* region) { | |
| 267 } | |
| 268 #endif // defined(OS_WIN) && !defined(USE_AURA) | |
| 269 | |
| 270 gfx::GLSurfaceHandle RenderWidgetHostViewChildFrame::GetCompositingSurface() { | |
| 271 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); | |
| 272 } | |
| 273 | |
| 274 #if defined(OS_WIN) && defined(USE_AURA) | |
| 275 gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin() | |
| 276 const { | |
| 277 return 0; | |
| 278 } | |
| 279 #endif // defined(OS_WIN) && defined(USE_AURA) | |
| 280 | |
| 281 } // namespace content | |
| OLD | NEW |