OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/utf_offset_string_conversions.h" | 13 #include "base/utf_offset_string_conversions.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "ppapi/c/dev/ppb_console_dev.h" | 15 #include "ppapi/c/dev/ppb_console_dev.h" |
16 #include "ppapi/c/dev/ppb_find_dev.h" | 16 #include "ppapi/c/dev/ppb_find_dev.h" |
17 #include "ppapi/c/dev/ppb_zoom_dev.h" | 17 #include "ppapi/c/dev/ppb_zoom_dev.h" |
18 #include "ppapi/c/dev/ppp_find_dev.h" | 18 #include "ppapi/c/dev/ppp_find_dev.h" |
19 #include "ppapi/c/dev/ppp_selection_dev.h" | 19 #include "ppapi/c/dev/ppp_selection_dev.h" |
20 #include "ppapi/c/dev/ppp_zoom_dev.h" | 20 #include "ppapi/c/dev/ppp_zoom_dev.h" |
21 #include "ppapi/c/pp_rect.h" | 21 #include "ppapi/c/pp_rect.h" |
22 #include "ppapi/c/ppb_core.h" | 22 #include "ppapi/c/ppb_core.h" |
23 #include "ppapi/c/ppp_input_event.h" | 23 #include "ppapi/c/ppp_input_event.h" |
24 #include "ppapi/c/ppp_instance.h" | 24 #include "ppapi/c/ppp_instance.h" |
25 #include "ppapi/c/ppp_messaging.h" | 25 #include "ppapi/c/ppp_messaging.h" |
26 #include "ppapi/c/ppp_mouse_lock.h" | 26 #include "ppapi/c/ppp_mouse_lock.h" |
27 #include "ppapi/c/private/ppp_instance_private.h" | 27 #include "ppapi/c/private/ppp_instance_private.h" |
28 #include "ppapi/shared_impl/ppb_input_event_shared.h" | 28 #include "ppapi/shared_impl/ppb_input_event_shared.h" |
29 #include "ppapi/shared_impl/ppb_url_util_shared.h" | 29 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
| 30 #include "ppapi/shared_impl/ppb_view_shared.h" |
30 #include "ppapi/shared_impl/ppp_instance_combined.h" | 31 #include "ppapi/shared_impl/ppp_instance_combined.h" |
| 32 #include "ppapi/shared_impl/resource.h" |
| 33 #include "ppapi/shared_impl/scoped_pp_resource.h" |
31 #include "ppapi/shared_impl/time_conversion.h" | 34 #include "ppapi/shared_impl/time_conversion.h" |
32 #include "ppapi/shared_impl/var.h" | 35 #include "ppapi/shared_impl/var.h" |
33 #include "ppapi/thunk/enter.h" | 36 #include "ppapi/thunk/enter.h" |
34 #include "ppapi/thunk/ppb_buffer_api.h" | 37 #include "ppapi/thunk/ppb_buffer_api.h" |
35 #include "printing/units.h" | 38 #include "printing/units.h" |
36 #include "third_party/skia/include/core/SkCanvas.h" | 39 #include "third_party/skia/include/core/SkCanvas.h" |
37 #include "third_party/skia/include/core/SkRect.h" | 40 #include "third_party/skia/include/core/SkRect.h" |
38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
48 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 51 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
49 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 52 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
50 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 53 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
52 #include "webkit/plugins/ppapi/common.h" | 55 #include "webkit/plugins/ppapi/common.h" |
53 #include "webkit/plugins/ppapi/event_conversion.h" | 56 #include "webkit/plugins/ppapi/event_conversion.h" |
54 #include "webkit/plugins/ppapi/fullscreen_container.h" | 57 #include "webkit/plugins/ppapi/fullscreen_container.h" |
| 58 #include "webkit/plugins/ppapi/gfx_conversion.h" |
55 #include "webkit/plugins/ppapi/host_globals.h" | 59 #include "webkit/plugins/ppapi/host_globals.h" |
56 #include "webkit/plugins/ppapi/message_channel.h" | 60 #include "webkit/plugins/ppapi/message_channel.h" |
57 #include "webkit/plugins/ppapi/npapi_glue.h" | 61 #include "webkit/plugins/ppapi/npapi_glue.h" |
58 #include "webkit/plugins/ppapi/plugin_module.h" | 62 #include "webkit/plugins/ppapi/plugin_module.h" |
59 #include "webkit/plugins/ppapi/plugin_object.h" | 63 #include "webkit/plugins/ppapi/plugin_object.h" |
60 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" | 64 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" |
61 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 65 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
62 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" | 66 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" |
63 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 67 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
64 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" | 68 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" |
(...skipping 19 matching lines...) Expand all Loading... |
84 #include "base/metrics/histogram.h" | 88 #include "base/metrics/histogram.h" |
85 #include "skia/ext/platform_canvas.h" | 89 #include "skia/ext/platform_canvas.h" |
86 #include "ui/gfx/codec/jpeg_codec.h" | 90 #include "ui/gfx/codec/jpeg_codec.h" |
87 #include "ui/gfx/gdi_util.h" | 91 #include "ui/gfx/gdi_util.h" |
88 #endif | 92 #endif |
89 | 93 |
90 using base::StringPrintf; | 94 using base::StringPrintf; |
91 using ppapi::InputEventData; | 95 using ppapi::InputEventData; |
92 using ppapi::PPB_InputEvent_Shared; | 96 using ppapi::PPB_InputEvent_Shared; |
93 using ppapi::PpapiGlobals; | 97 using ppapi::PpapiGlobals; |
| 98 using ppapi::PPB_View_Shared; |
| 99 using ppapi::ScopedPPResource; |
94 using ppapi::StringVar; | 100 using ppapi::StringVar; |
95 using ppapi::thunk::EnterResourceNoLock; | 101 using ppapi::thunk::EnterResourceNoLock; |
96 using ppapi::thunk::PPB_Buffer_API; | 102 using ppapi::thunk::PPB_Buffer_API; |
97 using ppapi::thunk::PPB_Graphics2D_API; | 103 using ppapi::thunk::PPB_Graphics2D_API; |
98 using ppapi::thunk::PPB_Graphics3D_API; | 104 using ppapi::thunk::PPB_Graphics3D_API; |
99 using ppapi::thunk::PPB_ImageData_API; | 105 using ppapi::thunk::PPB_ImageData_API; |
100 using ppapi::thunk::PPB_Instance_FunctionAPI; | 106 using ppapi::thunk::PPB_Instance_FunctionAPI; |
101 using ppapi::Var; | 107 using ppapi::Var; |
| 108 using ppapi::ViewData; |
102 using WebKit::WebBindings; | 109 using WebKit::WebBindings; |
103 using WebKit::WebCanvas; | 110 using WebKit::WebCanvas; |
104 using WebKit::WebConsoleMessage; | 111 using WebKit::WebConsoleMessage; |
105 using WebKit::WebCursorInfo; | 112 using WebKit::WebCursorInfo; |
106 using WebKit::WebDocument; | 113 using WebKit::WebDocument; |
107 using WebKit::WebElement; | 114 using WebKit::WebElement; |
108 using WebKit::WebFrame; | 115 using WebKit::WebFrame; |
109 using WebKit::WebInputEvent; | 116 using WebKit::WebInputEvent; |
110 using WebKit::WebPluginContainer; | 117 using WebKit::WebPluginContainer; |
111 using WebKit::WebString; | 118 using WebKit::WebString; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 COMPILE_ASSERT_MATCHING_ENUM(TypeCopy, PP_CURSORTYPE_COPY); | 219 COMPILE_ASSERT_MATCHING_ENUM(TypeCopy, PP_CURSORTYPE_COPY); |
213 COMPILE_ASSERT_MATCHING_ENUM(TypeNone, PP_CURSORTYPE_NONE); | 220 COMPILE_ASSERT_MATCHING_ENUM(TypeNone, PP_CURSORTYPE_NONE); |
214 COMPILE_ASSERT_MATCHING_ENUM(TypeNotAllowed, PP_CURSORTYPE_NOTALLOWED); | 221 COMPILE_ASSERT_MATCHING_ENUM(TypeNotAllowed, PP_CURSORTYPE_NOTALLOWED); |
215 COMPILE_ASSERT_MATCHING_ENUM(TypeZoomIn, PP_CURSORTYPE_ZOOMIN); | 222 COMPILE_ASSERT_MATCHING_ENUM(TypeZoomIn, PP_CURSORTYPE_ZOOMIN); |
216 COMPILE_ASSERT_MATCHING_ENUM(TypeZoomOut, PP_CURSORTYPE_ZOOMOUT); | 223 COMPILE_ASSERT_MATCHING_ENUM(TypeZoomOut, PP_CURSORTYPE_ZOOMOUT); |
217 COMPILE_ASSERT_MATCHING_ENUM(TypeGrab, PP_CURSORTYPE_GRAB); | 224 COMPILE_ASSERT_MATCHING_ENUM(TypeGrab, PP_CURSORTYPE_GRAB); |
218 COMPILE_ASSERT_MATCHING_ENUM(TypeGrabbing, PP_CURSORTYPE_GRABBING); | 225 COMPILE_ASSERT_MATCHING_ENUM(TypeGrabbing, PP_CURSORTYPE_GRABBING); |
219 // Do not assert WebCursorInfo::TypeCustom == PP_CURSORTYPE_CUSTOM; | 226 // Do not assert WebCursorInfo::TypeCustom == PP_CURSORTYPE_CUSTOM; |
220 // PP_CURSORTYPE_CUSTOM is pinned to allow new cursor types. | 227 // PP_CURSORTYPE_CUSTOM is pinned to allow new cursor types. |
221 | 228 |
222 void RectToPPRect(const gfx::Rect& input, PP_Rect* output) { | |
223 *output = PP_MakeRectFromXYWH(input.x(), input.y(), | |
224 input.width(), input.height()); | |
225 } | |
226 | |
227 // Sets |*security_origin| to be the WebKit security origin associated with the | 229 // Sets |*security_origin| to be the WebKit security origin associated with the |
228 // document containing the given plugin instance. On success, returns true. If | 230 // document containing the given plugin instance. On success, returns true. If |
229 // the instance is invalid, returns false and |*security_origin| will be | 231 // the instance is invalid, returns false and |*security_origin| will be |
230 // unchanged. | 232 // unchanged. |
231 bool SecurityOriginForInstance(PP_Instance instance_id, | 233 bool SecurityOriginForInstance(PP_Instance instance_id, |
232 WebKit::WebSecurityOrigin* security_origin) { | 234 WebKit::WebSecurityOrigin* security_origin) { |
233 PluginInstance* instance = HostGlobals::Get()->GetInstance(instance_id); | 235 PluginInstance* instance = HostGlobals::Get()->GetInstance(instance_id); |
234 if (!instance) | 236 if (!instance) |
235 return false; | 237 return false; |
236 | 238 |
237 WebElement plugin_element = instance->container()->element(); | 239 WebElement plugin_element = instance->container()->element(); |
238 *security_origin = plugin_element.document().securityOrigin(); | 240 *security_origin = plugin_element.document().securityOrigin(); |
239 return true; | 241 return true; |
240 } | 242 } |
241 | 243 |
242 } // namespace | 244 } // namespace |
243 | 245 |
244 // static | 246 // static |
245 PluginInstance* PluginInstance::Create1_0(PluginDelegate* delegate, | 247 PluginInstance* PluginInstance::Create1_0(PluginDelegate* delegate, |
246 PluginModule* module, | 248 PluginModule* module, |
247 const void* ppp_instance_if_1_0) { | 249 const void* ppp_instance_if_1_0) { |
248 const PPP_Instance_1_0* instance = | 250 const PPP_Instance_1_0* instance = |
249 static_cast<const PPP_Instance_1_0*>(ppp_instance_if_1_0); | 251 static_cast<const PPP_Instance_1_0*>(ppp_instance_if_1_0); |
250 return new PluginInstance( | 252 return new PluginInstance( |
251 delegate, | 253 delegate, |
252 module, | 254 module, |
253 new ::ppapi::PPP_Instance_Combined(*instance)); | 255 new ::ppapi::PPP_Instance_Combined(*instance)); |
254 } | 256 } |
255 | 257 |
| 258 // static |
| 259 PluginInstance* PluginInstance::Create1_1(PluginDelegate* delegate, |
| 260 PluginModule* module, |
| 261 const void* ppp_instance_if_1_1) { |
| 262 const PPP_Instance_1_1* instance = |
| 263 static_cast<const PPP_Instance_1_1*>(ppp_instance_if_1_1); |
| 264 return new PluginInstance( |
| 265 delegate, |
| 266 module, |
| 267 new ::ppapi::PPP_Instance_Combined(*instance)); |
| 268 } |
| 269 |
256 PluginInstance::PluginInstance( | 270 PluginInstance::PluginInstance( |
257 PluginDelegate* delegate, | 271 PluginDelegate* delegate, |
258 PluginModule* module, | 272 PluginModule* module, |
259 ::ppapi::PPP_Instance_Combined* instance_interface) | 273 ::ppapi::PPP_Instance_Combined* instance_interface) |
260 : delegate_(delegate), | 274 : delegate_(delegate), |
261 module_(module), | 275 module_(module), |
262 instance_interface_(instance_interface), | 276 instance_interface_(instance_interface), |
263 pp_instance_(0), | 277 pp_instance_(0), |
264 container_(NULL), | 278 container_(NULL), |
265 full_frame_(false), | 279 full_frame_(false), |
266 sent_did_change_view_(false), | 280 sent_initial_did_change_view_(false), |
| 281 suppress_did_change_view_(false), |
267 has_webkit_focus_(false), | 282 has_webkit_focus_(false), |
268 has_content_area_focus_(false), | 283 has_content_area_focus_(false), |
269 find_identifier_(-1), | 284 find_identifier_(-1), |
270 plugin_find_interface_(NULL), | 285 plugin_find_interface_(NULL), |
271 plugin_messaging_interface_(NULL), | 286 plugin_messaging_interface_(NULL), |
272 plugin_mouse_lock_interface_(NULL), | 287 plugin_mouse_lock_interface_(NULL), |
273 plugin_input_event_interface_(NULL), | 288 plugin_input_event_interface_(NULL), |
274 plugin_private_interface_(NULL), | 289 plugin_private_interface_(NULL), |
275 plugin_pdf_interface_(NULL), | 290 plugin_pdf_interface_(NULL), |
276 plugin_selection_interface_(NULL), | 291 plugin_selection_interface_(NULL), |
277 plugin_zoom_interface_(NULL), | 292 plugin_zoom_interface_(NULL), |
278 checked_for_plugin_input_event_interface_(false), | 293 checked_for_plugin_input_event_interface_(false), |
279 checked_for_plugin_messaging_interface_(false), | 294 checked_for_plugin_messaging_interface_(false), |
280 plugin_print_interface_(NULL), | 295 plugin_print_interface_(NULL), |
281 plugin_graphics_3d_interface_(NULL), | 296 plugin_graphics_3d_interface_(NULL), |
282 always_on_top_(false), | 297 always_on_top_(false), |
283 fullscreen_container_(NULL), | 298 fullscreen_container_(NULL), |
284 flash_fullscreen_(false), | 299 flash_fullscreen_(false), |
285 desired_fullscreen_state_(false), | 300 desired_fullscreen_state_(false), |
286 fullscreen_(false), | |
287 message_channel_(NULL), | 301 message_channel_(NULL), |
288 sad_plugin_(NULL), | 302 sad_plugin_(NULL), |
289 input_event_mask_(0), | 303 input_event_mask_(0), |
290 filtered_input_event_mask_(0), | 304 filtered_input_event_mask_(0), |
291 text_input_type_(kPluginDefaultTextInputType), | 305 text_input_type_(kPluginDefaultTextInputType), |
292 text_input_caret_(0, 0, 0, 0), | 306 text_input_caret_(0, 0, 0, 0), |
293 text_input_caret_bounds_(0, 0, 0, 0), | 307 text_input_caret_bounds_(0, 0, 0, 0), |
294 text_input_caret_set_(false), | 308 text_input_caret_set_(false), |
295 lock_mouse_callback_(PP_BlockUntilComplete()) { | 309 lock_mouse_callback_(PP_BlockUntilComplete()) { |
296 pp_instance_ = HostGlobals::Get()->AddInstance(this); | 310 pp_instance_ = HostGlobals::Get()->AddInstance(this); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 bound_graphics_2d->Paint(canvas, plugin_rect, paint_rect); | 375 bound_graphics_2d->Paint(canvas, plugin_rect, paint_rect); |
362 } | 376 } |
363 | 377 |
364 void PluginInstance::InvalidateRect(const gfx::Rect& rect) { | 378 void PluginInstance::InvalidateRect(const gfx::Rect& rect) { |
365 if (fullscreen_container_) { | 379 if (fullscreen_container_) { |
366 if (rect.IsEmpty()) | 380 if (rect.IsEmpty()) |
367 fullscreen_container_->Invalidate(); | 381 fullscreen_container_->Invalidate(); |
368 else | 382 else |
369 fullscreen_container_->InvalidateRect(rect); | 383 fullscreen_container_->InvalidateRect(rect); |
370 } else { | 384 } else { |
371 if (!container_ || position_.IsEmpty()) | 385 if (!container_ || |
| 386 view_data_.rect.size.width == 0 || view_data_.rect.size.height == 0) |
372 return; // Nothing to do. | 387 return; // Nothing to do. |
373 if (rect.IsEmpty()) | 388 if (rect.IsEmpty()) |
374 container_->invalidate(); | 389 container_->invalidate(); |
375 else | 390 else |
376 container_->invalidateRect(rect); | 391 container_->invalidateRect(rect); |
377 } | 392 } |
378 } | 393 } |
379 | 394 |
380 void PluginInstance::ScrollRect(int dx, int dy, const gfx::Rect& rect) { | 395 void PluginInstance::ScrollRect(int dx, int dy, const gfx::Rect& rect) { |
381 if (fullscreen_container_) { | 396 if (fullscreen_container_) { |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 } | 638 } |
624 | 639 |
625 bool PluginInstance::IsPluginAcceptingCompositionEvents() const { | 640 bool PluginInstance::IsPluginAcceptingCompositionEvents() const { |
626 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_IME) || | 641 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_IME) || |
627 (input_event_mask_ & PP_INPUTEVENT_CLASS_IME); | 642 (input_event_mask_ & PP_INPUTEVENT_CLASS_IME); |
628 } | 643 } |
629 | 644 |
630 gfx::Rect PluginInstance::GetCaretBounds() const { | 645 gfx::Rect PluginInstance::GetCaretBounds() const { |
631 if (!text_input_caret_set_) { | 646 if (!text_input_caret_set_) { |
632 // If it is never set by the plugin, use the bottom left corner. | 647 // If it is never set by the plugin, use the bottom left corner. |
633 return gfx::Rect(position().x(), position().y()+position().height(), 0, 0); | 648 return gfx::Rect(view_data_.rect.point.x, |
| 649 view_data_.rect.point.y + view_data_.rect.size.height, |
| 650 0, 0); |
634 } | 651 } |
635 | 652 |
636 // TODO(kinaba) Take CSS transformation into accont. | 653 // TODO(kinaba) Take CSS transformation into accont. |
637 // TODO(kinaba) Take bounding_box into account. On some platforms, an | 654 // TODO(kinaba) Take bounding_box into account. On some platforms, an |
638 // "exclude rectangle" where candidate window must avoid the region can be | 655 // "exclude rectangle" where candidate window must avoid the region can be |
639 // passed to IME. Currently, we pass only the caret rectangle because | 656 // passed to IME. Currently, we pass only the caret rectangle because |
640 // it is the only information supported uniformly in Chromium. | 657 // it is the only information supported uniformly in Chromium. |
641 gfx::Rect caret(text_input_caret_); | 658 gfx::Rect caret(text_input_caret_); |
642 caret.Offset(position().origin()); | 659 caret.Offset(view_data_.rect.point.x, view_data_.rect.point.y); |
643 return caret; | 660 return caret; |
644 } | 661 } |
645 | 662 |
646 bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event, | 663 bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event, |
647 WebCursorInfo* cursor_info) { | 664 WebCursorInfo* cursor_info) { |
648 TRACE_EVENT0("ppapi", "PluginInstance::HandleInputEvent"); | 665 TRACE_EVENT0("ppapi", "PluginInstance::HandleInputEvent"); |
649 | 666 |
650 if (WebInputEvent::isMouseEventType(event.type)) | 667 if (WebInputEvent::isMouseEventType(event.type)) |
651 delegate()->DidReceiveMouseEvent(this); | 668 delegate()->DidReceiveMouseEvent(this); |
652 | 669 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 void PluginInstance::ViewChanged(const gfx::Rect& position, | 730 void PluginInstance::ViewChanged(const gfx::Rect& position, |
714 const gfx::Rect& clip) { | 731 const gfx::Rect& clip) { |
715 // WebKit can give weird (x,y) positions for empty clip rects (since the | 732 // WebKit can give weird (x,y) positions for empty clip rects (since the |
716 // position technically doesn't matter). But we want to make these | 733 // position technically doesn't matter). But we want to make these |
717 // consistent since this is given to the plugin, so force everything to 0 | 734 // consistent since this is given to the plugin, so force everything to 0 |
718 // in the "everything is clipped" case. | 735 // in the "everything is clipped" case. |
719 gfx::Rect new_clip; | 736 gfx::Rect new_clip; |
720 if (!clip.IsEmpty()) | 737 if (!clip.IsEmpty()) |
721 new_clip = clip; | 738 new_clip = clip; |
722 | 739 |
723 // Don't notify the plugin if we've already sent these same params before. | 740 ViewData previous_view = view_data_; |
724 if (sent_did_change_view_ && position == position_ && new_clip == clip_) | |
725 return; | |
726 | 741 |
727 if (desired_fullscreen_state_ || fullscreen_) { | 742 view_data_.rect = PP_FromGfxRect(position); |
| 743 view_data_.clip_rect = PP_FromGfxRect(clip); |
| 744 |
| 745 if (desired_fullscreen_state_ || view_data_.is_fullscreen) { |
728 WebElement element = container_->element(); | 746 WebElement element = container_->element(); |
729 WebDocument document = element.document(); | 747 WebDocument document = element.document(); |
730 bool is_fullscreen_element = (element == document.fullScreenElement()); | 748 bool is_fullscreen_element = (element == document.fullScreenElement()); |
731 if (!fullscreen_ && desired_fullscreen_state_ && | 749 if (!view_data_.is_fullscreen && desired_fullscreen_state_ && |
732 delegate()->IsInFullscreenMode() && is_fullscreen_element) { | 750 delegate()->IsInFullscreenMode() && is_fullscreen_element) { |
733 // Entered fullscreen. Only possible via SetFullscreen(). | 751 // Entered fullscreen. Only possible via SetFullscreen(). |
734 fullscreen_ = true; | 752 view_data_.is_fullscreen = true; |
735 } else if (fullscreen_ && !is_fullscreen_element) { | 753 } else if (view_data_.is_fullscreen && !is_fullscreen_element) { |
736 // Exited fullscreen. Possible via SetFullscreen() or F11/link, | 754 // Exited fullscreen. Possible via SetFullscreen() or F11/link, |
737 // so desired_fullscreen_state might be out-of-date. | 755 // so desired_fullscreen_state might be out-of-date. |
738 desired_fullscreen_state_ = false; | 756 desired_fullscreen_state_ = false; |
739 fullscreen_ = false; | 757 view_data_.is_fullscreen = false; |
| 758 |
| 759 // This operation will cause the plugin to re-layout which will send more |
| 760 // DidChangeView updates. Schedule an asynchronous update and suppress |
| 761 // notifications until that completes to avoid sending intermediate sizes |
| 762 // to the plugins. |
| 763 ScheduleAsyncDidChangeView(previous_view); |
| 764 |
740 // Reset the size attributes that we hacked to fill in the screen and | 765 // Reset the size attributes that we hacked to fill in the screen and |
741 // retrigger ViewChanged. Make sure we don't forward duplicates of | 766 // retrigger ViewChanged. Make sure we don't forward duplicates of |
742 // this view to the plugin. | 767 // this view to the plugin. |
743 ResetSizeAttributesAfterFullscreen(); | 768 ResetSizeAttributesAfterFullscreen(); |
744 SetSentDidChangeView(position, new_clip); | |
745 MessageLoop::current()->PostTask( | |
746 FROM_HERE, base::Bind(&PluginInstance::ReportGeometry, this)); | |
747 return; | 769 return; |
748 } | 770 } |
749 } | 771 } |
750 | 772 |
751 SetSentDidChangeView(position, new_clip); | |
752 flash_fullscreen_ = (fullscreen_container_ != NULL); | 773 flash_fullscreen_ = (fullscreen_container_ != NULL); |
753 | 774 SendDidChangeView(previous_view); |
754 PP_Rect pp_position, pp_clip; | |
755 RectToPPRect(position_, &pp_position); | |
756 RectToPPRect(clip_, &pp_clip); | |
757 instance_interface_->DidChangeView(pp_instance(), &pp_position, &pp_clip); | |
758 } | 775 } |
759 | 776 |
760 void PluginInstance::SetWebKitFocus(bool has_focus) { | 777 void PluginInstance::SetWebKitFocus(bool has_focus) { |
761 if (has_webkit_focus_ == has_focus) | 778 if (has_webkit_focus_ == has_focus) |
762 return; | 779 return; |
763 | 780 |
764 bool old_plugin_focus = PluginHasFocus(); | 781 bool old_plugin_focus = PluginHasFocus(); |
765 has_webkit_focus_ = has_focus; | 782 has_webkit_focus_ = has_focus; |
766 if (PluginHasFocus() != old_plugin_focus) { | 783 if (PluginHasFocus() != old_plugin_focus) { |
767 delegate()->PluginFocusChanged(this, PluginHasFocus()); | 784 delegate()->PluginFocusChanged(this, PluginHasFocus()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 gfx::Rect* clip) { | 822 gfx::Rect* clip) { |
806 if (!always_on_top_) | 823 if (!always_on_top_) |
807 return false; | 824 return false; |
808 if (!GetBoundGraphics2D() || !GetBoundGraphics2D()->is_always_opaque()) | 825 if (!GetBoundGraphics2D() || !GetBoundGraphics2D()->is_always_opaque()) |
809 return false; | 826 return false; |
810 | 827 |
811 // We specifically want to compare against the area covered by the backing | 828 // We specifically want to compare against the area covered by the backing |
812 // store when seeing if we cover the given paint bounds, since the backing | 829 // store when seeing if we cover the given paint bounds, since the backing |
813 // store could be smaller than the declared plugin area. | 830 // store could be smaller than the declared plugin area. |
814 PPB_ImageData_Impl* image_data = GetBoundGraphics2D()->image_data(); | 831 PPB_ImageData_Impl* image_data = GetBoundGraphics2D()->image_data(); |
815 gfx::Rect plugin_backing_store_rect(position_.origin(), | 832 gfx::Rect plugin_backing_store_rect( |
816 gfx::Size(image_data->width(), | 833 PP_ToGfxPoint(view_data_.rect.point), |
817 image_data->height())); | 834 gfx::Size(image_data->width(), image_data->height())); |
818 gfx::Rect clip_page(clip_); | 835 |
819 clip_page.Offset(position_.origin()); | 836 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); |
| 837 clip_page.Offset(PP_ToGfxPoint(view_data_.rect.point)); |
820 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); | 838 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); |
821 if (!plugin_paint_rect.Contains(paint_bounds)) | 839 if (!plugin_paint_rect.Contains(paint_bounds)) |
822 return false; | 840 return false; |
823 | 841 |
824 *dib = image_data->platform_image()->GetTransportDIB(); | 842 *dib = image_data->platform_image()->GetTransportDIB(); |
825 *location = plugin_backing_store_rect; | 843 *location = plugin_backing_store_rect; |
826 *clip = clip_page; | 844 *clip = clip_page; |
827 return true; | 845 return true; |
828 } | 846 } |
829 | 847 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 PPP_ZOOM_DEV_INTERFACE)); | 1004 PPP_ZOOM_DEV_INTERFACE)); |
987 } | 1005 } |
988 | 1006 |
989 return !!plugin_zoom_interface_; | 1007 return !!plugin_zoom_interface_; |
990 } | 1008 } |
991 | 1009 |
992 bool PluginInstance::PluginHasFocus() const { | 1010 bool PluginInstance::PluginHasFocus() const { |
993 return has_webkit_focus_ && has_content_area_focus_; | 1011 return has_webkit_focus_ && has_content_area_focus_; |
994 } | 1012 } |
995 | 1013 |
| 1014 void PluginInstance::ScheduleAsyncDidChangeView( |
| 1015 const ::ppapi::ViewData& previous_view) { |
| 1016 if (suppress_did_change_view_) |
| 1017 return; // Already scheduled. |
| 1018 suppress_did_change_view_ = true; |
| 1019 MessageLoop::current()->PostTask( |
| 1020 FROM_HERE, base::Bind(&PluginInstance::SendAsyncDidChangeView, |
| 1021 this, previous_view)); |
| 1022 } |
| 1023 |
| 1024 void PluginInstance::SendAsyncDidChangeView(const ViewData& previous_view) { |
| 1025 DCHECK(suppress_did_change_view_); |
| 1026 suppress_did_change_view_ = false; |
| 1027 SendDidChangeView(previous_view); |
| 1028 } |
| 1029 |
| 1030 void PluginInstance::SendDidChangeView(const ViewData& previous_view) { |
| 1031 if (suppress_did_change_view_ || |
| 1032 (sent_initial_did_change_view_ && previous_view.Equals(view_data_))) |
| 1033 return; // Nothing to update. |
| 1034 |
| 1035 sent_initial_did_change_view_ = true; |
| 1036 ScopedPPResource resource( |
| 1037 ScopedPPResource::PassRef(), |
| 1038 (new PPB_View_Shared(PPB_View_Shared::InitAsImpl(), |
| 1039 pp_instance(), view_data_))->GetReference()); |
| 1040 |
| 1041 instance_interface_->DidChangeView(pp_instance(), resource, |
| 1042 &view_data_.rect, |
| 1043 &view_data_.clip_rect); |
| 1044 } |
| 1045 |
996 void PluginInstance::ReportGeometry() { | 1046 void PluginInstance::ReportGeometry() { |
997 // If this call was delayed, we may have transitioned back to fullscreen in | 1047 // If this call was delayed, we may have transitioned back to fullscreen in |
998 // the mean time, so only report the geometry if we are actually in normal | 1048 // the mean time, so only report the geometry if we are actually in normal |
999 // mode. | 1049 // mode. |
1000 if (container_ && !fullscreen_container_ && !flash_fullscreen_) | 1050 if (container_ && !fullscreen_container_ && !flash_fullscreen_) |
1001 container_->reportGeometry(); | 1051 container_->reportGeometry(); |
1002 } | 1052 } |
1003 | 1053 |
1004 bool PluginInstance::GetPreferredPrintOutputFormat( | 1054 bool PluginInstance::GetPreferredPrintOutputFormat( |
1005 PP_PrintOutputFormat_Dev* format) { | 1055 PP_PrintOutputFormat_Dev* format) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 PP_PrintOutputFormat_Dev format; | 1088 PP_PrintOutputFormat_Dev format; |
1039 if (!GetPreferredPrintOutputFormat(&format)) { | 1089 if (!GetPreferredPrintOutputFormat(&format)) { |
1040 // PrintBegin should not have been called since SupportsPrintInterface | 1090 // PrintBegin should not have been called since SupportsPrintInterface |
1041 // would have returned false; | 1091 // would have returned false; |
1042 NOTREACHED(); | 1092 NOTREACHED(); |
1043 return 0; | 1093 return 0; |
1044 } | 1094 } |
1045 | 1095 |
1046 int num_pages = 0; | 1096 int num_pages = 0; |
1047 PP_PrintSettings_Dev print_settings; | 1097 PP_PrintSettings_Dev print_settings; |
1048 RectToPPRect(printable_area, &print_settings.printable_area); | 1098 print_settings.printable_area = PP_FromGfxRect(printable_area); |
1049 print_settings.dpi = printer_dpi; | 1099 print_settings.dpi = printer_dpi; |
1050 print_settings.orientation = PP_PRINTORIENTATION_NORMAL; | 1100 print_settings.orientation = PP_PRINTORIENTATION_NORMAL; |
1051 print_settings.grayscale = PP_FALSE; | 1101 print_settings.grayscale = PP_FALSE; |
1052 print_settings.format = format; | 1102 print_settings.format = format; |
1053 num_pages = plugin_print_interface_->Begin(pp_instance(), | 1103 num_pages = plugin_print_interface_->Begin(pp_instance(), |
1054 &print_settings); | 1104 &print_settings); |
1055 if (!num_pages) | 1105 if (!num_pages) |
1056 return 0; | 1106 return 0; |
1057 current_print_settings_ = print_settings; | 1107 current_print_settings_ = print_settings; |
1058 #if defined(USE_SKIA) | 1108 #if defined(USE_SKIA) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 | 1194 |
1145 // Check whether we are trying to switch to the state we're already going | 1195 // Check whether we are trying to switch to the state we're already going |
1146 // to (i.e. if we're already switching to fullscreen but the fullscreen | 1196 // to (i.e. if we're already switching to fullscreen but the fullscreen |
1147 // container isn't ready yet, don't do anything more). | 1197 // container isn't ready yet, don't do anything more). |
1148 if (fullscreen == IsFullscreenOrPending()) | 1198 if (fullscreen == IsFullscreenOrPending()) |
1149 return false; | 1199 return false; |
1150 | 1200 |
1151 // Check whether we are trying to switch while the state is in transition. | 1201 // Check whether we are trying to switch while the state is in transition. |
1152 // The 2nd request gets dropped while messing up the internal state, so | 1202 // The 2nd request gets dropped while messing up the internal state, so |
1153 // disallow this. | 1203 // disallow this. |
1154 if (fullscreen_ != desired_fullscreen_state_) | 1204 if (view_data_.is_fullscreen != desired_fullscreen_state_) |
1155 return false; | 1205 return false; |
1156 | 1206 |
1157 // The browser will allow us to go into fullscreen mode only when processing | 1207 // The browser will allow us to go into fullscreen mode only when processing |
1158 // a user gesture. This is guaranteed to work with in-process plugins and | 1208 // a user gesture. This is guaranteed to work with in-process plugins and |
1159 // out-of-process syncronous proxies, but might be an issue with Flash when | 1209 // out-of-process syncronous proxies, but might be an issue with Flash when |
1160 // it switches over from PPB_FlashFullscreen. | 1210 // it switches over from PPB_FlashFullscreen. |
1161 // TODO(polina, bbudge): make this work with asynchronous proxies. | 1211 // TODO(polina, bbudge): make this work with asynchronous proxies. |
1162 WebFrame* frame = container_->element().document().frame(); | 1212 WebFrame* frame = container_->element().document().frame(); |
1163 if (fullscreen && !frame->isProcessingUserGesture()) | 1213 if (fullscreen && !frame->isProcessingUserGesture()) |
1164 return false; | 1214 return false; |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 void PluginInstance::SimulateInputEvent(const InputEventData& input_event) { | 1625 void PluginInstance::SimulateInputEvent(const InputEventData& input_event) { |
1576 WebView* web_view = container()->element().document().frame()->view(); | 1626 WebView* web_view = container()->element().document().frame()->view(); |
1577 if (!web_view) { | 1627 if (!web_view) { |
1578 NOTREACHED(); | 1628 NOTREACHED(); |
1579 return; | 1629 return; |
1580 } | 1630 } |
1581 | 1631 |
1582 std::vector<linked_ptr<WebInputEvent> > events = | 1632 std::vector<linked_ptr<WebInputEvent> > events = |
1583 CreateSimulatedWebInputEvents( | 1633 CreateSimulatedWebInputEvents( |
1584 input_event, | 1634 input_event, |
1585 position().x() + position().width() / 2, | 1635 view_data_.rect.point.x + view_data_.rect.size.width / 2, |
1586 position().y() + position().height() / 2); | 1636 view_data_.rect.point.y + view_data_.rect.size.height / 2); |
1587 for (std::vector<linked_ptr<WebInputEvent> >::iterator it = events.begin(); | 1637 for (std::vector<linked_ptr<WebInputEvent> >::iterator it = events.begin(); |
1588 it != events.end(); ++it) { | 1638 it != events.end(); ++it) { |
1589 web_view->handleInputEvent(*it->get()); | 1639 web_view->handleInputEvent(*it->get()); |
1590 } | 1640 } |
1591 } | 1641 } |
1592 | 1642 |
1593 PPB_Instance_FunctionAPI* PluginInstance::AsPPB_Instance_FunctionAPI() { | 1643 PPB_Instance_FunctionAPI* PluginInstance::AsPPB_Instance_FunctionAPI() { |
1594 return this; | 1644 return this; |
1595 } | 1645 } |
1596 | 1646 |
(...skipping 11 matching lines...) Expand all Loading... |
1608 // Special-case clearing the current device. | 1658 // Special-case clearing the current device. |
1609 if (!device) { | 1659 if (!device) { |
1610 setBackingTextureId(0); | 1660 setBackingTextureId(0); |
1611 InvalidateRect(gfx::Rect()); | 1661 InvalidateRect(gfx::Rect()); |
1612 return PP_TRUE; | 1662 return PP_TRUE; |
1613 } | 1663 } |
1614 | 1664 |
1615 // Refuse to bind if in transition to fullscreen with PPB_FlashFullscreen or | 1665 // Refuse to bind if in transition to fullscreen with PPB_FlashFullscreen or |
1616 // to/from fullscreen with PPB_Fullscreen. | 1666 // to/from fullscreen with PPB_Fullscreen. |
1617 if ((fullscreen_container_ && !flash_fullscreen_) || | 1667 if ((fullscreen_container_ && !flash_fullscreen_) || |
1618 desired_fullscreen_state_ != fullscreen_) | 1668 desired_fullscreen_state_ != view_data_.is_fullscreen) |
1619 return PP_FALSE; | 1669 return PP_FALSE; |
1620 | 1670 |
1621 EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false); | 1671 EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false); |
1622 PPB_Graphics2D_Impl* graphics_2d = enter_2d.succeeded() ? | 1672 PPB_Graphics2D_Impl* graphics_2d = enter_2d.succeeded() ? |
1623 static_cast<PPB_Graphics2D_Impl*>(enter_2d.object()) : NULL; | 1673 static_cast<PPB_Graphics2D_Impl*>(enter_2d.object()) : NULL; |
1624 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); | 1674 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); |
1625 PPB_Graphics3D_Impl* graphics_3d = enter_3d.succeeded() ? | 1675 PPB_Graphics3D_Impl* graphics_3d = enter_3d.succeeded() ? |
1626 static_cast<PPB_Graphics3D_Impl*>(enter_3d.object()) : NULL; | 1676 static_cast<PPB_Graphics3D_Impl*>(enter_3d.object()) : NULL; |
1627 | 1677 |
1628 if (graphics_2d) { | 1678 if (graphics_2d) { |
(...skipping 20 matching lines...) Expand all Loading... |
1649 return PP_FALSE; | 1699 return PP_FALSE; |
1650 } | 1700 } |
1651 | 1701 |
1652 return PP_TRUE; | 1702 return PP_TRUE; |
1653 } | 1703 } |
1654 | 1704 |
1655 PP_Bool PluginInstance::IsFullFrame(PP_Instance instance) { | 1705 PP_Bool PluginInstance::IsFullFrame(PP_Instance instance) { |
1656 return PP_FromBool(full_frame()); | 1706 return PP_FromBool(full_frame()); |
1657 } | 1707 } |
1658 | 1708 |
| 1709 const ViewData* PluginInstance::GetViewData(PP_Instance instance) { |
| 1710 return &view_data_; |
| 1711 } |
| 1712 |
1659 PP_Var PluginInstance::GetWindowObject(PP_Instance instance) { | 1713 PP_Var PluginInstance::GetWindowObject(PP_Instance instance) { |
1660 if (!container_) | 1714 if (!container_) |
1661 return PP_MakeUndefined(); | 1715 return PP_MakeUndefined(); |
1662 | 1716 |
1663 WebFrame* frame = container_->element().document().frame(); | 1717 WebFrame* frame = container_->element().document().frame(); |
1664 if (!frame) | 1718 if (!frame) |
1665 return PP_MakeUndefined(); | 1719 return PP_MakeUndefined(); |
1666 | 1720 |
1667 return NPObjectToPPVar(this, frame->windowObject()); | 1721 return NPObjectToPPVar(this, frame->windowObject()); |
1668 } | 1722 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 delegate_->NumberOfFindResultsChanged(find_identifier_, total, | 1826 delegate_->NumberOfFindResultsChanged(find_identifier_, total, |
1773 PP_ToBool(final_result)); | 1827 PP_ToBool(final_result)); |
1774 } | 1828 } |
1775 | 1829 |
1776 void PluginInstance::SelectedFindResultChanged(PP_Instance instance, | 1830 void PluginInstance::SelectedFindResultChanged(PP_Instance instance, |
1777 int32_t index) { | 1831 int32_t index) { |
1778 DCHECK_NE(find_identifier_, -1); | 1832 DCHECK_NE(find_identifier_, -1); |
1779 delegate_->SelectedFindResultChanged(find_identifier_, index); | 1833 delegate_->SelectedFindResultChanged(find_identifier_, index); |
1780 } | 1834 } |
1781 | 1835 |
1782 PP_Bool PluginInstance::IsFullscreen(PP_Instance instance) { | |
1783 return PP_FromBool(fullscreen_); | |
1784 } | |
1785 | |
1786 PP_Bool PluginInstance::FlashIsFullscreen(PP_Instance instance) { | 1836 PP_Bool PluginInstance::FlashIsFullscreen(PP_Instance instance) { |
1787 return PP_FromBool(flash_fullscreen_); | 1837 return PP_FromBool(flash_fullscreen_); |
1788 } | 1838 } |
1789 | 1839 |
1790 PP_Bool PluginInstance::SetFullscreen(PP_Instance instance, | 1840 PP_Bool PluginInstance::SetFullscreen(PP_Instance instance, |
1791 PP_Bool fullscreen) { | 1841 PP_Bool fullscreen) { |
1792 return PP_FromBool(SetFullscreen(PP_ToBool(fullscreen))); | 1842 return PP_FromBool(SetFullscreen(PP_ToBool(fullscreen))); |
1793 } | 1843 } |
1794 | 1844 |
1795 PP_Bool PluginInstance::FlashSetFullscreen(PP_Instance instance, | 1845 PP_Bool PluginInstance::FlashSetFullscreen(PP_Instance instance, |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1950 !containing_document.frame()->view()->mainFrame()) { | 2000 !containing_document.frame()->view()->mainFrame()) { |
1951 return false; | 2001 return false; |
1952 } | 2002 } |
1953 WebKit::WebDocument main_document = | 2003 WebKit::WebDocument main_document = |
1954 containing_document.frame()->view()->mainFrame()->document(); | 2004 containing_document.frame()->view()->mainFrame()->document(); |
1955 | 2005 |
1956 return containing_document.securityOrigin().canAccess( | 2006 return containing_document.securityOrigin().canAccess( |
1957 main_document.securityOrigin()); | 2007 main_document.securityOrigin()); |
1958 } | 2008 } |
1959 | 2009 |
1960 void PluginInstance::SetSentDidChangeView(const gfx::Rect& position, | |
1961 const gfx::Rect& clip) { | |
1962 sent_did_change_view_ = true; | |
1963 position_ = position; | |
1964 clip_ = clip; | |
1965 } | |
1966 | |
1967 void PluginInstance::KeepSizeAttributesBeforeFullscreen() { | 2010 void PluginInstance::KeepSizeAttributesBeforeFullscreen() { |
1968 WebElement element = container_->element(); | 2011 WebElement element = container_->element(); |
1969 width_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kWidth)); | 2012 width_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kWidth)); |
1970 height_before_fullscreen_ = | 2013 height_before_fullscreen_ = |
1971 element.getAttribute(WebString::fromUTF8(kHeight)); | 2014 element.getAttribute(WebString::fromUTF8(kHeight)); |
1972 border_before_fullscreen_ = | 2015 border_before_fullscreen_ = |
1973 element.getAttribute(WebString::fromUTF8(kBorder)); | 2016 element.getAttribute(WebString::fromUTF8(kBorder)); |
1974 style_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kStyle)); | 2017 style_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kStyle)); |
1975 } | 2018 } |
1976 | 2019 |
(...skipping 24 matching lines...) Expand all Loading... |
2001 screen_size_for_fullscreen_ = gfx::Size(); | 2044 screen_size_for_fullscreen_ = gfx::Size(); |
2002 WebElement element = container_->element(); | 2045 WebElement element = container_->element(); |
2003 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2046 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2004 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2047 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2005 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2048 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2006 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2049 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2007 } | 2050 } |
2008 | 2051 |
2009 } // namespace ppapi | 2052 } // namespace ppapi |
2010 } // namespace webkit | 2053 } // namespace webkit |
OLD | NEW |