Commit ed33e2eb authored by bbudge@chromium.org's avatar bbudge@chromium.org

Add functions to generate input events to PPB_Testing_Dev. These make

it possible to test APIs that require user gestures and other input events.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/8413021

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110865 0039d316-1c4b-4281-b951-d872f2087c98
parent 52dc8402
......@@ -241,6 +241,9 @@ TEST_PPAPI_IN_PROCESS(CursorControl)
TEST_PPAPI_OUT_OF_PROCESS(CursorControl)
TEST_PPAPI_NACL_VIA_HTTP(CursorControl)
TEST_PPAPI_IN_PROCESS(InputEvent)
TEST_PPAPI_OUT_OF_PROCESS(InputEvent)
TEST_PPAPI_IN_PROCESS(Instance)
// http://crbug.com/91729
TEST_PPAPI_OUT_OF_PROCESS(DISABLED_Instance)
......
......@@ -10,7 +10,8 @@
*/
label Chrome {
M14 = 0.7
M14 = 0.7,
M15 = 0.8
};
interface PPB_Testing_Dev {
......@@ -77,4 +78,28 @@ interface PPB_Testing_Dev {
* otherwise.
*/
PP_Bool IsOutOfProcess();
/**
* Passes the input event to the browser, which sends it back to the
* plugin. The plugin should implement PPP_InputEvent and register for
* the input event type.
*
* This method sends an input event through the browser just as if it had
* come from the user. If the browser determines that it is an event for the
* plugin, it will be sent to be handled by the plugin's PPP_InputEvent
* interface. When generating mouse events, make sure the position is within
* the plugin's area on the page. When generating a keyboard event, make sure
* the plugin is focused.
*
* Note that the browser may generate extra input events in order to
* maintain certain invariants, such as always having a "mouse enter" event
* before any other mouse event. Furthermore, the event the plugin receives
* after sending a simulated event will be slightly different from the
* original event. The browser may change the timestamp, add modifiers, and
* slightly alter the mouse position, due to coordinate transforms it
* performs.
*/
[version=0.8]
void SimulateInputEvent([in] PP_Instance instance,
[in] PP_Resource input_event);
};
......@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
/* From dev/ppb_testing_dev.idl modified Thu Nov 17 13:50:20 2011. */
/* From dev/ppb_testing_dev.idl modified Sat Nov 19 15:58:18 2011. */
#ifndef PPAPI_C_DEV_PPB_TESTING_DEV_H_
#define PPAPI_C_DEV_PPB_TESTING_DEV_H_
......@@ -16,7 +16,8 @@
#include "ppapi/c/pp_stdint.h"
#define PPB_TESTING_DEV_INTERFACE_0_7 "PPB_Testing(Dev);0.7"
#define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_7
#define PPB_TESTING_DEV_INTERFACE_0_8 "PPB_Testing(Dev);0.8"
#define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_8
/**
* @file
......@@ -90,6 +91,37 @@ struct PPB_Testing_Dev {
* otherwise.
*/
PP_Bool (*IsOutOfProcess)();
/**
* Passes the input event to the browser, which sends it back to the
* plugin. The plugin should implement PPP_InputEvent and register for
* the input event type.
*
* This method sends an input event through the browser just as if it had
* come from the user. If the browser determines that it is an event for the
* plugin, it will be sent to be handled by the plugin's PPP_InputEvent
* interface. When generating mouse events, make sure the position is within
* the plugin's area on the page. When generating a keyboard event, make sure
* the plugin is focused.
*
* Note that the browser may generate extra input events in order to
* maintain certain invariants, such as always having a "mouse enter" event
* before any other mouse event. Furthermore, the event the plugin receives
* after sending a simulated event will be slightly different from the
* original event. The browser may change the timestamp, add modifiers, and
* slightly alter the mouse position, due to coordinate transforms it
* performs.
*/
void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event);
};
struct PPB_Testing_Dev_0_7 {
PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
PP_Resource image,
const struct PP_Point* top_left);
void (*RunMessageLoop)(PP_Instance instance);
void (*QuitMessageLoop)(PP_Instance instance);
uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
PP_Bool (*IsOutOfProcess)();
};
/**
* @}
......
......@@ -79,7 +79,8 @@ InterfaceMapElement interface_map[] = {
true },
{ PPB_PDF_INTERFACE, PluginPDF::GetInterface(), true },
{ PPB_SCROLLBAR_DEV_INTERFACE, PluginScrollbar::GetInterface(), true },
{ PPB_TESTING_DEV_INTERFACE, PluginTesting::GetInterface(), true },
{ PPB_TESTING_DEV_INTERFACE_0_7, PluginTesting::GetInterface(), true },
{ PPB_TESTING_DEV_INTERFACE_0_8, PluginTesting::GetInterface(), true },
{ PPB_URLLOADER_INTERFACE, PluginURLLoader::GetInterface(), true },
{ PPB_URLREQUESTINFO_INTERFACE, PluginURLRequestInfo::GetInterface(), true },
{ PPB_URLRESPONSEINFO_INTERFACE, PluginURLResponseInfo::GetInterface(),
......
......@@ -112,6 +112,8 @@
'tests/test_graphics_3d.h',
'tests/test_image_data.cc',
'tests/test_image_data.h',
'tests/test_input_event.cc',
'tests/test_input_event.h',
'tests/test_memory.cc',
'tests/test_memory.h',
'tests/test_net_address_private.cc',
......
......@@ -974,6 +974,9 @@ IPC_SYNC_MESSAGE_ROUTED3_1(
IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance,
PP_Instance /* instance */,
uint32 /* result */)
IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBTesting_SimulateInputEvent,
PP_Instance /* instance */,
ppapi::InputEventData /* input_event */)
// PPB_TextInput.
IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBTextInput_SetTextInputType,
......
......@@ -6,11 +6,17 @@
#include "base/message_loop.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/proxy/enter_proxy.h"
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/resource.h"
#include "ppapi/shared_impl/resource_tracker.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_input_event_api.h"
using ppapi::thunk::EnterResource;
using ppapi::thunk::PPB_InputEvent_API;
namespace ppapi {
namespace proxy {
......@@ -68,12 +74,26 @@ PP_Bool IsOutOfProcess() {
return PP_TRUE;
}
void SimulateInputEvent(PP_Instance instance_id, PP_Resource input_event) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
if (!dispatcher)
return;
EnterResource<PPB_InputEvent_API> enter(input_event, false);
if (enter.failed())
return;
const InputEventData& input_event_data = enter.object()->GetInputEventData();
dispatcher->Send(new PpapiHostMsg_PPBTesting_SimulateInputEvent(
API_ID_PPB_TESTING, instance_id, input_event_data));
}
const PPB_Testing_Dev testing_interface = {
&ReadImageData,
&RunMessageLoop,
&QuitMessageLoop,
&GetLiveObjectsForInstance,
&IsOutOfProcess
&IsOutOfProcess,
&SimulateInputEvent
};
InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher) {
......@@ -113,6 +133,8 @@ bool PPB_Testing_Proxy::OnMessageReceived(const IPC::Message& msg) {
OnMsgReadImageData)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance,
OnMsgGetLiveObjectsForInstance)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_SimulateInputEvent,
OnMsgSimulateInputEvent)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
......@@ -140,5 +162,16 @@ void PPB_Testing_Proxy::OnMsgGetLiveObjectsForInstance(PP_Instance instance,
*result = ppb_testing_impl_->GetLiveObjectsForInstance(instance);
}
void PPB_Testing_Proxy::OnMsgSimulateInputEvent(
PP_Instance instance,
const InputEventData& input_event) {
scoped_refptr<InputEventImpl> input_event_impl(
new InputEventImpl(InputEventImpl::InitAsProxy(),
instance,
input_event));
ppb_testing_impl_->SimulateInputEvent(instance,
input_event_impl->pp_resource());
}
} // namespace proxy
} // namespace ppapi
......@@ -15,6 +15,9 @@ struct PP_Point;
struct PPB_Testing_Dev;
namespace ppapi {
struct InputEventData;
namespace proxy {
class PPB_Testing_Proxy : public InterfaceProxy {
......@@ -36,6 +39,8 @@ class PPB_Testing_Proxy : public InterfaceProxy {
void OnMsgRunMessageLoop(PP_Instance instance);
void OnMsgQuitMessageLoop(PP_Instance instance);
void OnMsgGetLiveObjectsForInstance(PP_Instance instance, uint32_t* result);
void OnMsgSimulateInputEvent(PP_Instance instance,
const ppapi::InputEventData& input_event);
// When this proxy is in the host side, this value caches the interface
// pointer so we don't have to retrieve it from the dispatcher each time.
......
This diff is collapsed.
// Copyright (c) 2011 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.
#ifndef PPAPI_TESTS_TEST_INPUT_EVENT_H_
#define PPAPI_TESTS_TEST_INPUT_EVENT_H_
#include <string>
#include <vector>
#include "ppapi/cpp/input_event.h"
#include "ppapi/cpp/point.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/tests/test_case.h"
struct PPB_InputEvent;
struct PPB_MouseInputEvent;
struct PPB_WheelInputEvent;
struct PPB_KeyboardInputEvent;
struct PPB_Testing_Dev;
class TestInputEvent : public TestCase {
public:
explicit TestInputEvent(TestingInstance* instance);
~TestInputEvent();
bool HandleInputEvent(const pp::InputEvent& input_event);
void HandleMessage(const pp::Var& message_data);
void DidChangeView(const pp::Rect& position, const pp::Rect& clip);
// TestCase implementation.
virtual bool Init();
virtual void RunTests(const std::string& test_filter);
private:
pp::InputEvent CreateMouseEvent(PP_InputEvent_Type type,
PP_InputEvent_MouseButton buttons);
pp::InputEvent CreateWheelEvent();
pp::InputEvent CreateKeyEvent(PP_InputEvent_Type type,
uint32_t key_code);
pp::InputEvent CreateCharEvent(const std::string& text);
bool SimulateInputEvent(const pp::InputEvent& input_event);
bool AreEquivalentEvents(PP_Resource first, PP_Resource second);
std::string TestEvents();
const struct PPB_InputEvent* input_event_interface_;
const struct PPB_MouseInputEvent* mouse_input_event_interface_;
const struct PPB_WheelInputEvent* wheel_input_event_interface_;
const struct PPB_KeyboardInputEvent* keyboard_input_event_interface_;
pp::Rect view_rect_;
pp::InputEvent expected_input_event_;
bool received_expected_event_;
bool received_finish_message_;
};
#endif // PPAPI_TESTS_TEST_INPUT_EVENT_H_
......@@ -9,12 +9,14 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "base/utf_string_conversion_utils.h"
#include "ppapi/c/pp_input_event.h"
#include "ppapi/shared_impl/input_event_impl.h"
#include "ppapi/shared_impl/time_conversion.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
#include "webkit/plugins/ppapi/common.h"
using ppapi::EventTimeToPPTimeTicks;
......@@ -24,6 +26,8 @@ using WebKit::WebInputEvent;
using WebKit::WebKeyboardEvent;
using WebKit::WebMouseEvent;
using WebKit::WebMouseWheelEvent;
using WebKit::WebString;
using WebKit::WebUChar;
namespace webkit {
namespace ppapi {
......@@ -246,6 +250,92 @@ WebMouseWheelEvent* BuildMouseWheelEvent(const InputEventData& event) {
return mouse_wheel_event;
}
#if !defined(OS_WIN)
#define VK_RETURN 0x0D
#define VK_PRIOR 0x21
#define VK_NEXT 0x22
#define VK_END 0x23
#define VK_HOME 0x24
#define VK_LEFT 0x25
#define VK_UP 0x26
#define VK_RIGHT 0x27
#define VK_DOWN 0x28
#define VK_SNAPSHOT 0x2C
#define VK_INSERT 0x2D
#define VK_DELETE 0x2E
#define VK_APPS 0x5D
#define VK_F1 0x70
#endif
// Convert a character string to a Windows virtual key code. Adapted from
// src/third_party/WebKit/Tools/DumpRenderTree/chromium/EventSender.cpp. This
// is used by CreateSimulatedWebInputEvents to convert keyboard events.
void GetKeyCode(const std::string& char_text,
WebUChar* code,
WebUChar* text,
bool* needs_shift_modifier,
bool* generate_char) {
WebUChar vk_code = 0;
WebUChar vk_text = 0;
*needs_shift_modifier = false;
*generate_char = false;
if ("\n" == char_text) {
vk_text = vk_code = VK_RETURN;
*generate_char = true;
} else if ("rightArrow" == char_text) {
vk_code = VK_RIGHT;
} else if ("downArrow" == char_text) {
vk_code = VK_DOWN;
} else if ("leftArrow" == char_text) {
vk_code = VK_LEFT;
} else if ("upArrow" == char_text) {
vk_code = VK_UP;
} else if ("insert" == char_text) {
vk_code = VK_INSERT;
} else if ("delete" == char_text) {
vk_code = VK_DELETE;
} else if ("pageUp" == char_text) {
vk_code = VK_PRIOR;
} else if ("pageDown" == char_text) {
vk_code = VK_NEXT;
} else if ("home" == char_text) {
vk_code = VK_HOME;
} else if ("end" == char_text) {
vk_code = VK_END;
} else if ("printScreen" == char_text) {
vk_code = VK_SNAPSHOT;
} else if ("menu" == char_text) {
vk_code = VK_APPS;
} else {
// Compare the input string with the function-key names defined by the
// DOM spec (i.e. "F1",...,"F24").
for (int i = 1; i <= 24; ++i) {
std::string functionKeyName = base::StringPrintf("F%d", i);
if (functionKeyName == char_text) {
vk_code = VK_F1 + (i - 1);
break;
}
}
if (!vk_code) {
WebString web_char_text =
WebString::fromUTF8(char_text.data(), char_text.size());
DCHECK_EQ(web_char_text.length(), 1U);
vk_text = vk_code = web_char_text.data()[0];
*needs_shift_modifier =
(vk_code & 0xFF) >= 'A' && (vk_code & 0xFF) <= 'Z';
if ((vk_code & 0xFF) >= 'a' && (vk_code & 0xFF) <= 'z')
vk_code -= 'a' - 'A';
*generate_char = true;
}
}
*code = vk_code;
*text = vk_text;
}
} // namespace
void CreateInputEventData(const WebInputEvent& event,
......@@ -315,6 +405,98 @@ WebInputEvent* CreateWebInputEvent(const InputEventData& event) {
return web_input_event.release();
}
// Generate a coherent sequence of input events to simulate a user event.
// From src/third_party/WebKit/Tools/DumpRenderTree/chromium/EventSender.cpp.
std::vector<linked_ptr<WebInputEvent> > CreateSimulatedWebInputEvents(
const ::ppapi::InputEventData& event,
int plugin_x,
int plugin_y) {
std::vector<linked_ptr<WebInputEvent> > events;
linked_ptr<WebInputEvent> original_event(CreateWebInputEvent(event));
switch (event.event_type) {
case PP_INPUTEVENT_TYPE_MOUSEDOWN:
case PP_INPUTEVENT_TYPE_MOUSEUP:
case PP_INPUTEVENT_TYPE_MOUSEMOVE:
case PP_INPUTEVENT_TYPE_MOUSEENTER:
case PP_INPUTEVENT_TYPE_MOUSELEAVE:
events.push_back(original_event);
break;
case PP_INPUTEVENT_TYPE_WHEEL: {
WebMouseWheelEvent* web_mouse_wheel_event =
static_cast<WebMouseWheelEvent*>(original_event.get());
web_mouse_wheel_event->x = plugin_x;
web_mouse_wheel_event->y = plugin_y;
events.push_back(original_event);
break;
}
case PP_INPUTEVENT_TYPE_RAWKEYDOWN:
case PP_INPUTEVENT_TYPE_KEYDOWN:
case PP_INPUTEVENT_TYPE_KEYUP: {
// Windows key down events should always be "raw" to avoid an ASSERT.
#if defined(OS_WIN)
WebKeyboardEvent* web_keyboard_event =
static_cast<WebKeyboardEvent*>(original_event.get());
if (web_keyboard_event->type == WebInputEvent::KeyDown)
web_keyboard_event->type = WebInputEvent::RawKeyDown;
#endif
events.push_back(original_event);
break;
}
case PP_INPUTEVENT_TYPE_CHAR: {
WebKeyboardEvent* web_char_event =
static_cast<WebKeyboardEvent*>(original_event.get());
WebUChar code = 0, text = 0;
bool needs_shift_modifier = false, generate_char = false;
GetKeyCode(event.character_text,
&code,
&text,
&needs_shift_modifier,
&generate_char);
// Synthesize key down and key up events in all cases.
scoped_ptr<WebKeyboardEvent> key_down_event(new WebKeyboardEvent());
scoped_ptr<WebKeyboardEvent> key_up_event(new WebKeyboardEvent());
key_down_event->type = WebInputEvent::RawKeyDown;
key_down_event->windowsKeyCode = code;
key_down_event->nativeKeyCode = code;
if (needs_shift_modifier)
key_down_event->modifiers |= WebInputEvent::ShiftKey;
// If a char event is needed, set the text fields.
if (generate_char) {
key_down_event->text[0] = text;
key_down_event->unmodifiedText[0] = text;
}
// Convert the key code to a string identifier.
key_down_event->setKeyIdentifierFromWindowsKeyCode();
*key_up_event = *web_char_event = *key_down_event;
events.push_back(linked_ptr<WebInputEvent>(key_down_event.release()));
if (generate_char) {
web_char_event->type = WebInputEvent::Char;
web_char_event->keyIdentifier[0] = '\0';
events.push_back(original_event);
}
key_up_event->type = WebInputEvent::KeyUp;
events.push_back(linked_ptr<WebInputEvent>(key_up_event.release()));
break;
}
default:
break;
}
return events;
}
PP_InputEvent_Class ClassifyInputEvent(WebInputEvent::Type type) {
switch (type) {
case WebInputEvent::MouseDown:
......
......@@ -7,6 +7,7 @@
#include <vector>
#include "base/memory/linked_ptr.h"
#include "ppapi/c/ppb_input_event.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
......@@ -37,6 +38,14 @@ void CreateInputEventData(const WebKit::WebInputEvent& event,
WebKit::WebInputEvent* CreateWebInputEvent(
const ::ppapi::InputEventData& event);
// Creates an array of WebInputEvents to make the given event look like a user
// input event on all platforms. |plugin_x| and |plugin_y| should be the
// coordinates of a point within the plugin's area on the page.
std::vector<linked_ptr<WebKit::WebInputEvent> > CreateSimulatedWebInputEvents(
const ::ppapi::InputEventData& event,
int plugin_x,
int plugin_y);
// Returns the PPAPI event class for the given WebKit event type. The given
// type should not be "Undefined" since there's no corresponding PPAPI class.
PP_InputEvent_Class ClassifyInputEvent(WebKit::WebInputEvent::Type type);
......
......@@ -117,11 +117,13 @@
#include "webkit/plugins/ppapi/ppb_video_layer_impl.h"
#include "webkit/plugins/ppapi/webkit_forwarding_impl.h"
using ppapi::InputEventData;
using ppapi::PpapiGlobals;
using ppapi::TimeTicksToPPTimeTicks;
using ppapi::TimeToPPTime;
using ppapi::thunk::EnterResource;
using ppapi::thunk::PPB_Graphics2D_API;
using ppapi::thunk::PPB_InputEvent_API;
namespace webkit {
namespace ppapi {
......@@ -225,12 +227,26 @@ PP_Bool IsOutOfProcess() {
return PP_FALSE;
}
void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
PluginInstance* plugin_instance = host_globals->GetInstance(instance);
if (!plugin_instance)
return;
EnterResource<PPB_InputEvent_API> enter(input_event, false);
if (enter.failed())
return;
const InputEventData& input_event_data = enter.object()->GetInputEventData();
plugin_instance->SimulateInputEvent(input_event_data);
}
const PPB_Testing_Dev testing_interface = {
&ReadImageData,
&RunMessageLoop,
&QuitMessageLoop,
&GetLiveObjectsForInstance,
&IsOutOfProcess
&IsOutOfProcess,
&SimulateInputEvent
};
// GetInterface ----------------------------------------------------------------
......@@ -324,10 +340,12 @@ const void* GetInterface(const char* name) {
// Only support the testing interface when the command line switch is
// specified. This allows us to prevent people from (ab)using this interface
// in production code.
if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0) {
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnablePepperTesting))
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnablePepperTesting)) {
if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0 ||
strcmp(name, PPB_TESTING_DEV_INTERFACE_0_7) == 0) {
return &testing_interface;
}
}
return NULL;
}
......
......@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
......@@ -100,6 +101,7 @@
#endif
using base::StringPrintf;
using ppapi::InputEventData;
using ppapi::InputEventImpl;
using ppapi::PpapiGlobals;
using ppapi::StringVar;
......@@ -1599,6 +1601,24 @@ void PluginInstance::OnMouseLockLost() {
plugin_mouse_lock_interface_->MouseLockLost(pp_instance());
}
void PluginInstance::SimulateInputEvent(const InputEventData& input_event) {
WebView* web_view = container()->element().document().frame()->view();
if (!web_view) {
NOTREACHED();
return;
}
std::vector<linked_ptr<WebInputEvent> > events =
CreateSimulatedWebInputEvents(
input_event,
position().x() + position().width() / 2,
position().y() + position().height() / 2);
for (std::vector<linked_ptr<WebInputEvent> >::iterator it = events.begin();
it != events.end(); ++it) {
web_view->handleInputEvent(*it->get());
}
}
PPB_Instance_FunctionAPI* PluginInstance::AsPPB_Instance_FunctionAPI() {
return this;
}
......
......@@ -58,6 +58,7 @@ struct WebCursorInfo;
}
namespace ppapi {
struct InputEventData;
struct PPP_Instance_Combined;
class Resource;
}
......@@ -244,14 +245,15 @@ class PluginInstance : public base::RefCounted<PluginInstance>,
// In normal state, events come from webkit and painting goes back to it.
// In fullscreen state, events come from the fullscreen container, and
// painting goes back to it.
// In pending state, events from webkit are ignored, and as soon as we receive
// events from the fullscreen container, we go to the fullscreen state.
// In pending state, events from webkit are ignored, and as soon as we
// receive events from the fullscreen container, we go to the fullscreen
// state.
bool FlashIsFullscreenOrPending();
// Switches between fullscreen and normal mode. If |delay_report| is set to
// false, it may report the new state through DidChangeView immediately. If
// true, it will delay it. When called from the plugin, delay_report should be
// true to avoid re-entrancy.
// true, it will delay it. When called from the plugin, delay_report should
// be true to avoid re-entrancy.
void FlashSetFullscreen(bool fullscreen, bool delay_report);
FullscreenContainer* fullscreen_container() const {
......@@ -288,16 +290,20 @@ class PluginInstance : public base::RefCounted<PluginInstance>,
PluginDelegate::PlatformContext3D* CreateContext3D();
// Returns true iff the plugin is a full-page plugin (i.e. not in an iframe or
// embedded in a page).
// Returns true iff the plugin is a full-page plugin (i.e. not in an iframe
// or embedded in a page).
bool IsFullPagePlugin() const;
void OnLockMouseACK(int32_t result);
void OnMouseLockLost();
// Simulates an input event to the plugin by passing it down to WebKit,
// which sends it back up to the plugin as if it came from the user.
void SimulateInputEvent(const ::ppapi::InputEventData& input_event);
// FunctionGroupBase overrides.
virtual ::ppapi::thunk::PPB_Instance_FunctionAPI* AsPPB_Instance_FunctionAPI()
OVERRIDE;
virtual ::ppapi::thunk::PPB_Instance_FunctionAPI*
AsPPB_Instance_FunctionAPI() OVERRIDE;
// PPB_Instance_FunctionAPI implementation.
virtual PP_Bool BindGraphics(PP_Instance instance,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment