summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/render_widget_host_view_guest.cc
blob: 9619730c971b090c9d909277401e5a639f42250f (plain)
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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
// Copyright (c) 2012 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 "base/bind_helpers.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_guest.h"
#include "content/common/browser_plugin_messages.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/common/view_messages.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
#include "webkit/plugins/npapi/webplugin.h"

namespace content {

RenderWidgetHostViewGuest::RenderWidgetHostViewGuest(
    RenderWidgetHost* widget_host,
    BrowserPluginGuest* guest)
    : host_(RenderWidgetHostImpl::From(widget_host)),
      is_hidden_(false),
      guest_(guest) {
  host_->SetView(this);
}

RenderWidgetHostViewGuest::~RenderWidgetHostViewGuest() {
}

RenderWidgetHost* RenderWidgetHostViewGuest::GetRenderWidgetHost() const {
  return host_;
}

void RenderWidgetHostViewGuest::WasShown() {
  if (!is_hidden_)
    return;

  is_hidden_ = false;
  host_->WasShown();
}

void RenderWidgetHostViewGuest::WasHidden() {
  if (is_hidden_)
    return;

  is_hidden_ = true;
  host_->WasHidden();
}

void RenderWidgetHostViewGuest::SetSize(const gfx::Size& size) {
  size_ = size;
  host_->WasResized();
}

gfx::Rect RenderWidgetHostViewGuest::GetBoundsInRootWindow() {
  return GetViewBounds();
}

gfx::GLSurfaceHandle RenderWidgetHostViewGuest::GetCompositingSurface() {
  return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, true);
}

void RenderWidgetHostViewGuest::Show() {
  WasShown();
}

void RenderWidgetHostViewGuest::Hide() {
  WasHidden();
}

bool RenderWidgetHostViewGuest::IsShowing() {
  return !is_hidden_;
}

gfx::Rect RenderWidgetHostViewGuest::GetViewBounds() const {
  return gfx::Rect(0, 0, size_.width(), size_.height());
}

void RenderWidgetHostViewGuest::RenderViewGone(base::TerminationStatus status,
                                               int error_code) {
  Destroy();
}

void RenderWidgetHostViewGuest::Destroy() {
  // The RenderWidgetHost's destruction led here, so don't call it.
  host_ = NULL;
  MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}

void RenderWidgetHostViewGuest::SetTooltipText(const string16& tooltip_text) {
}

void RenderWidgetHostViewGuest::AcceleratedSurfaceBuffersSwapped(
    const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
    int gpu_host_id) {
  guest_->SendMessageToEmbedder(
      new BrowserPluginMsg_BuffersSwapped(
          guest_->embedder_routing_id(),
          guest_->instance_id(),
          params.size,
          params.mailbox_name,
          params.route_id,
          gpu_host_id));
}

void RenderWidgetHostViewGuest::AcceleratedSurfacePostSubBuffer(
    const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
    int gpu_host_id) {
  guest_->SendMessageToEmbedder(
      new BrowserPluginMsg_BuffersSwapped(
          guest_->embedder_routing_id(),
          guest_->instance_id(),
          params.surface_size,
          params.mailbox_name,
          params.route_id,
          gpu_host_id));
}

void RenderWidgetHostViewGuest::SetBounds(const gfx::Rect& rect) {
  SetSize(rect.size());
}

void RenderWidgetHostViewGuest::InitAsChild(
    gfx::NativeView parent_view) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::InitAsPopup(
    RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::InitAsFullscreen(
    RenderWidgetHostView* reference_host_view) {
  NOTIMPLEMENTED();
}

gfx::NativeView RenderWidgetHostViewGuest::GetNativeView() const {
  NOTIMPLEMENTED();
  return NULL;
}

gfx::NativeViewId RenderWidgetHostViewGuest::GetNativeViewId() const {
  NOTIMPLEMENTED();
  return static_cast<gfx::NativeViewId>(NULL);
}

gfx::NativeViewAccessible RenderWidgetHostViewGuest::GetNativeViewAccessible() {
  NOTIMPLEMENTED();
  return NULL;
}

void RenderWidgetHostViewGuest::MovePluginWindows(
    const gfx::Vector2d& scroll_offset,
    const std::vector<webkit::npapi::WebPluginGeometry>& moves) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::Focus() {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::Blur() {
  NOTIMPLEMENTED();
}

bool RenderWidgetHostViewGuest::HasFocus() const {
  NOTIMPLEMENTED();
  return false;
}

bool RenderWidgetHostViewGuest::IsSurfaceAvailableForCopy() const {
  NOTIMPLEMENTED();
  return true;
}

void RenderWidgetHostViewGuest::UpdateCursor(const WebCursor& cursor) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::SetIsLoading(bool is_loading) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::TextInputStateChanged(
    const ViewHostMsg_TextInputState_Params& params) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::ImeCancelComposition() {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::DidUpdateBackingStore(
    const gfx::Rect& scroll_rect,
    const gfx::Vector2d& scroll_delta,
    const std::vector<gfx::Rect>& copy_rects) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::SelectionBoundsChanged(
    const gfx::Rect& start_rect,
    WebKit::WebTextDirection start_direction,
    const gfx::Rect& end_rect,
    WebKit::WebTextDirection end_direction) {
  NOTIMPLEMENTED();
}

BackingStore* RenderWidgetHostViewGuest::AllocBackingStore(
    const gfx::Size& size) {
  NOTIMPLEMENTED();
  return NULL;
}

void RenderWidgetHostViewGuest::CopyFromCompositingSurface(
    const gfx::Rect& src_subrect,
    const gfx::Size& /* dst_size */,
    const base::Callback<void(bool)>& callback,
    skia::PlatformBitmap* output) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::AcceleratedSurfaceSuspend() {
  NOTIMPLEMENTED();
}

bool RenderWidgetHostViewGuest::HasAcceleratedSurface(
      const gfx::Size& desired_size) {
  NOTIMPLEMENTED();
  return false;
}

void RenderWidgetHostViewGuest::SetBackground(const SkBitmap& background) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::SetHasHorizontalScrollbar(
    bool has_horizontal_scrollbar) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::SetScrollOffsetPinning(
    bool is_pinned_to_left, bool is_pinned_to_right) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::OnAcceleratedCompositingStateChange() {
  NOTIMPLEMENTED();
}

bool RenderWidgetHostViewGuest::LockMouse() {
  NOTIMPLEMENTED();
  return false;
}

void RenderWidgetHostViewGuest::UnlockMouse() {
  NOTIMPLEMENTED();
}

#if defined(OS_MACOSX)
void RenderWidgetHostViewGuest::SetActive(bool active) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::SetTakesFocusOnlyOnMouseDown(bool flag) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::SetWindowVisibility(bool visible) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::WindowFrameChanged() {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::ShowDefinitionForSelection() {
  NOTIMPLEMENTED();
}

bool RenderWidgetHostViewGuest::SupportsSpeech() const {
  NOTIMPLEMENTED();
  return false;
}

void RenderWidgetHostViewGuest::SpeakSelection() {
  NOTIMPLEMENTED();
}

bool RenderWidgetHostViewGuest::IsSpeaking() const {
  NOTIMPLEMENTED();
  return false;
}

void RenderWidgetHostViewGuest::StopSpeaking() {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::AboutToWaitForBackingStoreMsg() {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::PluginFocusChanged(bool focused,
                                                   int plugin_id) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::StartPluginIme() {
  NOTIMPLEMENTED();
}

bool RenderWidgetHostViewGuest::PostProcessEventForPluginIme(
    const NativeWebKeyboardEvent& event) {
  NOTIMPLEMENTED();
  return false;
}

gfx::PluginWindowHandle
RenderWidgetHostViewGuest::AllocateFakePluginWindowHandle(
    bool opaque, bool root) {
  NOTIMPLEMENTED();
  return 0;
}

void RenderWidgetHostViewGuest::DestroyFakePluginWindowHandle(
    gfx::PluginWindowHandle window) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::AcceleratedSurfaceSetIOSurface(
    gfx::PluginWindowHandle window,
    int32 width,
    int32 height,
    uint64 io_surface_identifier) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::AcceleratedSurfaceSetTransportDIB(
    gfx::PluginWindowHandle window,
    int32 width,
    int32 height,
    TransportDIB::Handle transport_dib) {
  NOTIMPLEMENTED();
}
#endif  // defined(OS_MACOSX)

#if defined(OS_ANDROID)
void RenderWidgetHostViewGuest::StartContentIntent(const GURL& content_url) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::SetCachedBackgroundColor(SkColor color) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::ShowDisambiguationPopup(
    const gfx::Rect& target_rect,
    const SkBitmap& zoomed_bitmap) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::SetCachedPageScaleFactorLimits(
    float minimum_scale,
    float maximum_scale) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::UpdateFrameInfo(
    const gfx::Vector2d& scroll_offset,
    float page_scale_factor,
    float min_page_scale_factor,
    float max_page_scale_factor,
    const gfx::Size& content_size) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::HasTouchEventHandlers(bool need_touch_events) {
  NOTIMPLEMENTED();
}
#endif  // defined(OS_ANDROID)

#if defined(TOOLKIT_GTK)
GdkEventButton* RenderWidgetHostViewGuest::GetLastMouseDown() {
  NOTIMPLEMENTED();
  return NULL;
}

gfx::NativeView RenderWidgetHostViewGuest::BuildInputMethodsGtkMenu() {
  NOTIMPLEMENTED();
  return gfx::NativeView();
}

void RenderWidgetHostViewGuest::CreatePluginContainer(
    gfx::PluginWindowHandle id) {
  NOTIMPLEMENTED();
}

void RenderWidgetHostViewGuest::DestroyPluginContainer(
    gfx::PluginWindowHandle id) {
  NOTIMPLEMENTED();
}
#endif  // defined(TOOLKIT_GTK)

#if defined(OS_WIN) && !defined(USE_AURA)
void RenderWidgetHostViewGuest::WillWmDestroy() {
  NOTIMPLEMENTED();
}
#endif

#if defined(OS_POSIX) || defined(USE_AURA)
void RenderWidgetHostViewGuest::GetScreenInfo(WebKit::WebScreenInfo* results) {
  NOTIMPLEMENTED();
}
#endif  // defined(OS_POSIX) || defined(USE_AURA)

}  // namespace content