1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/frame_host/render_widget_host_view_child_frame.h"
#include "content/browser/accessibility/browser_accessibility_manager.h"
#include "content/browser/frame_host/cross_process_frame_connector.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/common/view_messages.h"
#include "content/public/browser/render_process_host.h"
namespace content {
RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame(
RenderWidgetHost* widget_host)
: host_(RenderWidgetHostImpl::From(widget_host)),
frame_connector_(NULL) {
host_->SetView(this);
}
RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
}
void RenderWidgetHostViewChildFrame::InitAsChild(
gfx::NativeView parent_view) {
NOTREACHED();
}
RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const {
return host_;
}
void RenderWidgetHostViewChildFrame::SetSize(const gfx::Size& size) {
host_->WasResized();
}
void RenderWidgetHostViewChildFrame::SetBounds(const gfx::Rect& rect) {
SetSize(rect.size());
}
void RenderWidgetHostViewChildFrame::Focus() {
}
bool RenderWidgetHostViewChildFrame::HasFocus() const {
return false;
}
bool RenderWidgetHostViewChildFrame::IsSurfaceAvailableForCopy() const {
NOTIMPLEMENTED();
return false;
}
void RenderWidgetHostViewChildFrame::Show() {
WasShown();
}
void RenderWidgetHostViewChildFrame::Hide() {
WasHidden();
}
bool RenderWidgetHostViewChildFrame::IsShowing() {
return !host_->is_hidden();
}
gfx::Rect RenderWidgetHostViewChildFrame::GetViewBounds() const {
gfx::Rect rect;
if (frame_connector_)
rect = frame_connector_->ChildFrameRect();
return rect;
}
gfx::Vector2dF RenderWidgetHostViewChildFrame::GetLastScrollOffset() const {
return last_scroll_offset_;
}
gfx::NativeView RenderWidgetHostViewChildFrame::GetNativeView() const {
NOTREACHED();
return NULL;
}
gfx::NativeViewId RenderWidgetHostViewChildFrame::GetNativeViewId() const {
NOTREACHED();
return 0;
}
gfx::NativeViewAccessible
RenderWidgetHostViewChildFrame::GetNativeViewAccessible() {
NOTREACHED();
return NULL;
}
void RenderWidgetHostViewChildFrame::SetBackgroundColor(SkColor color) {
}
gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const {
gfx::Size size;
if (frame_connector_)
size = frame_connector_->ChildFrameRect().size();
return size;
}
void RenderWidgetHostViewChildFrame::InitAsPopup(
RenderWidgetHostView* parent_host_view,
const gfx::Rect& pos) {
NOTREACHED();
}
void RenderWidgetHostViewChildFrame::InitAsFullscreen(
RenderWidgetHostView* reference_host_view) {
NOTREACHED();
}
void RenderWidgetHostViewChildFrame::ImeCancelComposition() {
NOTREACHED();
}
void RenderWidgetHostViewChildFrame::ImeCompositionRangeChanged(
const gfx::Range& range,
const std::vector<gfx::Rect>& character_bounds) {
NOTREACHED();
}
void RenderWidgetHostViewChildFrame::WasShown() {
if (!host_->is_hidden())
return;
host_->WasShown(ui::LatencyInfo());
}
void RenderWidgetHostViewChildFrame::WasHidden() {
if (host_->is_hidden())
return;
host_->WasHidden();
}
void RenderWidgetHostViewChildFrame::MovePluginWindows(
const std::vector<WebPluginGeometry>& moves) {
}
void RenderWidgetHostViewChildFrame::Blur() {
}
void RenderWidgetHostViewChildFrame::UpdateCursor(const WebCursor& cursor) {
}
void RenderWidgetHostViewChildFrame::SetIsLoading(bool is_loading) {
NOTREACHED();
}
void RenderWidgetHostViewChildFrame::TextInputTypeChanged(
ui::TextInputType type,
ui::TextInputMode input_mode,
bool can_compose_inline,
int flags) {
NOTREACHED();
}
void RenderWidgetHostViewChildFrame::RenderProcessGone(
base::TerminationStatus status,
int error_code) {
if (frame_connector_)
frame_connector_->RenderProcessGone();
Destroy();
}
void RenderWidgetHostViewChildFrame::Destroy() {
if (frame_connector_) {
frame_connector_->set_view(NULL);
frame_connector_ = NULL;
}
host_->SetView(NULL);
host_ = NULL;
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
void RenderWidgetHostViewChildFrame::SetTooltipText(
const base::string16& tooltip_text) {
}
void RenderWidgetHostViewChildFrame::SelectionChanged(
const base::string16& text,
size_t offset,
const gfx::Range& range) {
}
void RenderWidgetHostViewChildFrame::SelectionBoundsChanged(
const ViewHostMsg_SelectionBounds_Params& params) {
}
#if defined(OS_ANDROID)
void RenderWidgetHostViewChildFrame::LockCompositingSurface() {
}
void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() {
}
#endif
void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame(
uint32 output_surface_id,
scoped_ptr<cc::CompositorFrame> frame) {
last_scroll_offset_ = frame->metadata.root_scroll_offset;
if (frame_connector_) {
frame_connector_->ChildFrameCompositorFrameSwapped(
output_surface_id,
host_->GetProcess()->GetID(),
host_->GetRoutingID(),
frame.Pass());
}
}
void RenderWidgetHostViewChildFrame::GetScreenInfo(
blink::WebScreenInfo* results) {
}
gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() {
// We do not have any root window specific parts in this view.
return GetViewBounds();
}
#if defined(USE_AURA)
void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent(
const TouchEventWithLatencyInfo& touch,
InputEventAckState ack_result) {
}
#endif // defined(USE_AURA)
bool RenderWidgetHostViewChildFrame::LockMouse() {
return false;
}
void RenderWidgetHostViewChildFrame::UnlockMouse() {
}
#if defined(OS_MACOSX)
void RenderWidgetHostViewChildFrame::SetActive(bool active) {
}
void RenderWidgetHostViewChildFrame::SetWindowVisibility(bool visible) {
}
void RenderWidgetHostViewChildFrame::WindowFrameChanged() {
}
void RenderWidgetHostViewChildFrame::ShowDefinitionForSelection() {
}
bool RenderWidgetHostViewChildFrame::SupportsSpeech() const {
return false;
}
void RenderWidgetHostViewChildFrame::SpeakSelection() {
}
bool RenderWidgetHostViewChildFrame::IsSpeaking() const {
return false;
}
void RenderWidgetHostViewChildFrame::StopSpeaking() {
}
bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme(
const NativeWebKeyboardEvent& event) {
return false;
}
#endif // defined(OS_MACOSX)
void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface(
const gfx::Rect& src_subrect,
const gfx::Size& /* dst_size */,
ReadbackRequestCallback& callback,
const SkColorType color_type) {
callback.Run(SkBitmap(), READBACK_NOT_SUPPORTED);
}
void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame(
const gfx::Rect& src_subrect,
const scoped_refptr<media::VideoFrame>& target,
const base::Callback<void(bool)>& callback) {
NOTIMPLEMENTED();
callback.Run(false);
}
bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const {
return false;
}
bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface(
const gfx::Size& desired_size) {
return false;
}
gfx::GLSurfaceHandle RenderWidgetHostViewChildFrame::GetCompositingSurface() {
return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NULL_TRANSPORT);
}
#if defined(OS_WIN)
void RenderWidgetHostViewChildFrame::SetParentNativeViewAccessible(
gfx::NativeViewAccessible accessible_parent) {
}
gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin()
const {
return NULL;
}
#endif // defined(OS_WIN)
SkColorType RenderWidgetHostViewChildFrame::PreferredReadbackFormat() {
return kN32_SkColorType;
}
BrowserAccessibilityManager*
RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager(
BrowserAccessibilityDelegate* delegate) {
return BrowserAccessibilityManager::Create(
BrowserAccessibilityManager::GetEmptyDocument(), delegate);
}
} // namespace content
|