Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 8413021: Add functions to generate input events to PPB_Testing_Dev. These make (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop.h" 12 #include "base/message_loop.h"
12 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
13 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
14 #include "base/utf_offset_string_conversions.h" 15 #include "base/utf_offset_string_conversions.h"
15 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
16 #include "ppapi/c/dev/ppb_console_dev.h" 17 #include "ppapi/c/dev/ppb_console_dev.h"
17 #include "ppapi/c/dev/ppb_find_dev.h" 18 #include "ppapi/c/dev/ppb_find_dev.h"
18 #include "ppapi/c/dev/ppb_memory_dev.h" 19 #include "ppapi/c/dev/ppb_memory_dev.h"
19 #include "ppapi/c/dev/ppb_zoom_dev.h" 20 #include "ppapi/c/dev/ppb_zoom_dev.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 #include "skia/ext/vector_platform_device_emf_win.h" 94 #include "skia/ext/vector_platform_device_emf_win.h"
94 #include "ui/gfx/codec/jpeg_codec.h" 95 #include "ui/gfx/codec/jpeg_codec.h"
95 #include "ui/gfx/gdi_util.h" 96 #include "ui/gfx/gdi_util.h"
96 #endif 97 #endif
97 98
98 #if defined(OS_MACOSX) && defined(USE_SKIA) 99 #if defined(OS_MACOSX) && defined(USE_SKIA)
99 #include "skia/ext/skia_utils_mac.h" 100 #include "skia/ext/skia_utils_mac.h"
100 #endif 101 #endif
101 102
102 using base::StringPrintf; 103 using base::StringPrintf;
104 using ppapi::InputEventData;
103 using ppapi::InputEventImpl; 105 using ppapi::InputEventImpl;
104 using ppapi::PpapiGlobals; 106 using ppapi::PpapiGlobals;
105 using ppapi::StringVar; 107 using ppapi::StringVar;
106 using ppapi::thunk::EnterResourceNoLock; 108 using ppapi::thunk::EnterResourceNoLock;
107 using ppapi::thunk::PPB_Buffer_API; 109 using ppapi::thunk::PPB_Buffer_API;
108 using ppapi::thunk::PPB_Graphics2D_API; 110 using ppapi::thunk::PPB_Graphics2D_API;
109 using ppapi::thunk::PPB_Graphics3D_API; 111 using ppapi::thunk::PPB_Graphics3D_API;
110 using ppapi::thunk::PPB_ImageData_API; 112 using ppapi::thunk::PPB_ImageData_API;
111 using ppapi::thunk::PPB_Instance_FunctionAPI; 113 using ppapi::thunk::PPB_Instance_FunctionAPI;
112 using ppapi::thunk::PPB_Surface3D_API; 114 using ppapi::thunk::PPB_Surface3D_API;
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 } 1594 }
1593 1595
1594 PP_RunAndClearCompletionCallback(&lock_mouse_callback_, result); 1596 PP_RunAndClearCompletionCallback(&lock_mouse_callback_, result);
1595 } 1597 }
1596 1598
1597 void PluginInstance::OnMouseLockLost() { 1599 void PluginInstance::OnMouseLockLost() {
1598 if (LoadMouseLockInterface()) 1600 if (LoadMouseLockInterface())
1599 plugin_mouse_lock_interface_->MouseLockLost(pp_instance()); 1601 plugin_mouse_lock_interface_->MouseLockLost(pp_instance());
1600 } 1602 }
1601 1603
1604 void PluginInstance::SimulateInputEvent(const InputEventData& input_event) {
1605 WebView* web_view = container()->element().document().frame()->view();
1606 if (!web_view) {
1607 NOTREACHED();
1608 return;
1609 }
1610
1611 std::vector<linked_ptr<WebInputEvent> > events =
1612 CreateSimulatedWebInputEvents(
1613 input_event,
1614 position().x() + position().width() / 2,
1615 position().y() + position().height() / 2);
1616 for (std::vector<linked_ptr<WebInputEvent> >::iterator it = events.begin();
1617 it != events.end(); ++it) {
1618 web_view->handleInputEvent(*it->get());
1619 }
1620 }
1621
1602 PPB_Instance_FunctionAPI* PluginInstance::AsPPB_Instance_FunctionAPI() { 1622 PPB_Instance_FunctionAPI* PluginInstance::AsPPB_Instance_FunctionAPI() {
1603 return this; 1623 return this;
1604 } 1624 }
1605 1625
1606 PP_Bool PluginInstance::BindGraphics(PP_Instance instance, 1626 PP_Bool PluginInstance::BindGraphics(PP_Instance instance,
1607 PP_Resource device) { 1627 PP_Resource device) {
1608 if (bound_graphics_.get()) { 1628 if (bound_graphics_.get()) {
1609 if (GetBoundGraphics2D()) { 1629 if (GetBoundGraphics2D()) {
1610 GetBoundGraphics2D()->BindToInstance(NULL); 1630 GetBoundGraphics2D()->BindToInstance(NULL);
1611 } else if (GetBoundGraphics3D()) { 1631 } else if (GetBoundGraphics3D()) {
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 screen_size_for_fullscreen_ = gfx::Size(); 2057 screen_size_for_fullscreen_ = gfx::Size();
2038 WebElement element = container_->element(); 2058 WebElement element = container_->element();
2039 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2059 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2040 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2060 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2041 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2061 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2042 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2062 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2043 } 2063 }
2044 2064
2045 } // namespace ppapi 2065 } // namespace ppapi
2046 } // namespace webkit 2066 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698