summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-20 18:53:59 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-20 18:53:59 +0000
commit38d035e33fc2fac4f5c23819c6974afe2caff47b (patch)
tree82ecf8f419fbc6aafda5a068c03af0b1dd5acc75 /webkit
parente43145482ea2623ef59ff8c4cc5c10ccad8302a9 (diff)
downloadchromium_src-38d035e33fc2fac4f5c23819c6974afe2caff47b.zip
chromium_src-38d035e33fc2fac4f5c23819c6974afe2caff47b.tar.gz
chromium_src-38d035e33fc2fac4f5c23819c6974afe2caff47b.tar.bz2
Revert 93223 - Reland http://codereview.chromium.org/7452002/
Update chromoting input events. (Clang caught this. Thanks, Clang!) Note I'm leaving in temporary backwards-compatibility. brettw, just need a rubber-stamp. This is the same as the last CL. awong/garykac/sergeyu, looking for someone on chromoting team to glance at my changes and make sure I didn't do anything you don't like. This is a high priority for 14, so please look if you can. BUG=None TEST=ppapi tests Review URL: http://codereview.chromium.org/7466002 TBR=dmichael@chromium.org Review URL: http://codereview.chromium.org/7471006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93229 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/ppapi/event_conversion.cc2
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc9
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc62
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h6
-rw-r--r--webkit/plugins/ppapi/ppapi_unittest.cc7
-rw-r--r--webkit/plugins/ppapi/resource_tracker_unittest.cc8
6 files changed, 32 insertions, 62 deletions
diff --git a/webkit/plugins/ppapi/event_conversion.cc b/webkit/plugins/ppapi/event_conversion.cc
index d09faef..41db456c 100644
--- a/webkit/plugins/ppapi/event_conversion.cc
+++ b/webkit/plugins/ppapi/event_conversion.cc
@@ -13,8 +13,6 @@
#include "base/utf_string_conversion_utils.h"
#include "ppapi/c/pp_input_event.h"
#include "ppapi/shared_impl/input_event_impl.h"
-// TODO(dmichael): Remove this include when PP_InputEvent is gone from m14.
-#include "ppapi/shared_impl/ppp_instance_combined.h"
#include "ppapi/shared_impl/time_conversion.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/plugins/ppapi/common.h"
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index e0190c8..a3f7919 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -73,10 +73,6 @@
#include "ppapi/c/trusted/ppb_file_io_trusted.h"
#include "ppapi/c/trusted/ppb_image_data_trusted.h"
#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
-#include "ppapi/shared_impl/input_event_impl.h"
-// TODO(dmichael): Delete this include after PPP_Instance_0_5 goes away in m14.
-// This is just to get the PPP_INSTANCE_0_5 definition.
-#include "ppapi/shared_impl/ppp_instance_combined.h"
#include "ppapi/shared_impl/time_conversion.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
@@ -536,11 +532,8 @@ PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() {
PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) {
PluginInstance* instance(NULL);
- const void* ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_1_0);
+ const void* ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_0_5);
if (ppp_instance) {
- instance = PluginInstance::Create1_0(delegate, this, ppp_instance);
- } else if ((ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_0_5))) {
- // TODO(dmichael): Remove support for 0.5 in m14.
instance = PluginInstance::Create0_5(delegate, this, ppp_instance);
}
if (!instance) {
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 8bc4e62..3163a1c 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -200,18 +200,6 @@ PluginInstance* PluginInstance::Create0_5(PluginDelegate* delegate,
new ::ppapi::PPP_Instance_Combined(*interface));
}
-// static
-PluginInstance* PluginInstance::Create1_0(PluginDelegate* delegate,
- PluginModule* module,
- const void* ppp_instance_if_1_0) {
- const PPP_Instance_1_0* interface =
- static_cast<const PPP_Instance_1_0*>(ppp_instance_if_1_0);
- return new PluginInstance(
- delegate,
- module,
- new ::ppapi::PPP_Instance_Combined(*interface));
-}
-
PluginInstance::PluginInstance(
PluginDelegate* delegate,
PluginModule* module,
@@ -431,16 +419,16 @@ bool PluginInstance::Initialize(WebPluginContainer* container,
argc++;
}
- return PP_ToBool(instance_interface_->DidCreate(pp_instance(),
- argc,
- argn.get(),
- argv.get()));
+ return PPBoolToBool(instance_interface_->DidCreate(pp_instance(),
+ argc,
+ argn.get(),
+ argv.get()));
}
bool PluginInstance::HandleDocumentLoad(PPB_URLLoader_Impl* loader) {
Resource::ScopedResourceId resource(loader);
- return PP_ToBool(instance_interface_->HandleDocumentLoad(pp_instance(),
- resource.id));
+ return PPBoolToBool(instance_interface_->HandleDocumentLoad(pp_instance(),
+ resource.id));
}
bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event,
@@ -471,7 +459,7 @@ bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event,
new PPB_InputEvent_Impl(this, events[i]));
PP_Resource resource = event_resource->GetReference();
- rv |= PP_ToBool(plugin_input_event_interface_->HandleInputEvent(
+ rv |= PPBoolToBool(plugin_input_event_interface_->HandleInputEvent(
pp_instance(), event_resource->GetReference()));
// Release the reference we took above.
@@ -480,19 +468,15 @@ bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event,
}
}
- // For compatibility, also send all input events through the old interface,
- // if it exists.
+ // For compatibility, also send all input events through the old interface.
// TODO(brettw) remove this.
- if (instance_interface_->HandleInputEvent_0_5) {
- std::vector<PP_InputEvent> pp_events;
- CreatePPEvent(event, &pp_events);
-
- // Each input event may generate more than one PP_InputEvent.
- for (size_t i = 0; i < pp_events.size(); i++) {
- rv |= PP_ToBool(
- instance_interface_->HandleInputEvent_0_5(pp_instance(),
- &pp_events[i]));
- }
+ std::vector<PP_InputEvent> pp_events;
+ CreatePPEvent(event, &pp_events);
+
+ // Each input event may generate more than one PP_InputEvent.
+ for (size_t i = 0; i < pp_events.size(); i++) {
+ rv |= PPBoolToBool(instance_interface_->HandleInputEvent(pp_instance(),
+ &pp_events[i]));
}
if (cursor_.get())
@@ -549,7 +533,7 @@ void PluginInstance::SetWebKitFocus(bool has_focus) {
if (PluginHasFocus() != old_plugin_focus) {
delegate()->PluginFocusChanged(PluginHasFocus());
instance_interface_->DidChangeFocus(pp_instance(),
- PP_FromBool(PluginHasFocus()));
+ BoolToPPBool(PluginHasFocus()));
}
}
@@ -561,7 +545,7 @@ void PluginInstance::SetContentAreaFocus(bool has_focus) {
has_content_area_focus_ = has_focus;
if (PluginHasFocus() != old_plugin_focus) {
instance_interface_->DidChangeFocus(pp_instance(),
- PP_FromBool(PluginHasFocus()));
+ BoolToPPBool(PluginHasFocus()));
}
}
@@ -621,7 +605,7 @@ string16 PluginInstance::GetSelectedText(bool html) {
return string16();
PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(),
- PP_FromBool(html));
+ BoolToPPBool(html));
scoped_refptr<StringVar> string(StringVar::FromPPVar(rv));
Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us.
if (!string)
@@ -651,7 +635,7 @@ void PluginInstance::Zoom(double factor, bool text_only) {
scoped_refptr<PluginInstance> ref(this);
if (!LoadZoomInterface())
return;
- plugin_zoom_interface_->Zoom(pp_instance(), factor, PP_FromBool(text_only));
+ plugin_zoom_interface_->Zoom(pp_instance(), factor, BoolToPPBool(text_only));
}
bool PluginInstance::StartFind(const string16& search_text,
@@ -662,11 +646,11 @@ bool PluginInstance::StartFind(const string16& search_text,
if (!LoadFindInterface())
return false;
find_identifier_ = identifier;
- return PP_ToBool(
+ return PPBoolToBool(
plugin_find_interface_->StartFind(
pp_instance(),
UTF16ToUTF8(search_text.c_str()).c_str(),
- PP_FromBool(case_sensitive)));
+ BoolToPPBool(case_sensitive)));
}
void PluginInstance::SelectFindResult(bool forward) {
@@ -674,7 +658,7 @@ void PluginInstance::SelectFindResult(bool forward) {
scoped_refptr<PluginInstance> ref(this);
if (LoadFindInterface())
plugin_find_interface_->SelectFindResult(pp_instance(),
- PP_FromBool(forward));
+ BoolToPPBool(forward));
}
void PluginInstance::StopFind() {
@@ -1518,7 +1502,7 @@ PP_Bool PluginInstance::SetFullscreen(PP_Instance instance,
PP_Bool fullscreen) {
// TODO(yzshen): Re-enable it once fullscreen mode is supported on Windows.
#if !defined(OS_WIN)
- SetFullscreen(PP_ToBool(fullscreen), true);
+ SetFullscreen(PPBoolToBool(fullscreen), true);
return PP_TRUE;
#else
return PP_FALSE;
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index a69c54a..c122ada 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -86,17 +86,11 @@ class PluginInstance : public base::RefCounted<PluginInstance>,
public ::ppapi::thunk::PPB_Instance_FunctionAPI,
public ::ppapi::InstanceImpl {
public:
- // TODO(dmichael): Delete this for m14.
// Create and return a PluginInstance object which supports the
// PPP_Instance_0_5 interface.
static PluginInstance* Create0_5(PluginDelegate* delegate,
PluginModule* module,
const void* ppp_instance_if_0_5);
- // Create and return a PluginInstance object which supports the
- // PPP_Instance_0_5 interface.
- static PluginInstance* Create1_0(PluginDelegate* delegate,
- PluginModule* module,
- const void* ppp_instance_if_1_0);
// Delete should be called by the WebPlugin before this destructor.
virtual ~PluginInstance();
diff --git a/webkit/plugins/ppapi/ppapi_unittest.cc b/webkit/plugins/ppapi/ppapi_unittest.cc
index ef083998..03a9793 100644
--- a/webkit/plugins/ppapi/ppapi_unittest.cc
+++ b/webkit/plugins/ppapi/ppapi_unittest.cc
@@ -61,6 +61,7 @@ static PPP_Instance mock_instance_interface = {
&Instance_DidDestroy,
&Instance_DidChangeView,
&Instance_DidChangeFocus,
+ &Instance_HandleInputEvent,
&Instance_HandleDocumentLoad
};
@@ -89,10 +90,10 @@ void PpapiUnittest::SetUp() {
ASSERT_TRUE(module_->InitAsInternalPlugin(entry_points));
// Initialize the mock instance.
- instance_ = PluginInstance::Create1_0(
+ instance_ = PluginInstance::Create0_5(
delegate_.get(),
module(),
- GetMockInterface(PPP_INSTANCE_INTERFACE_1_0));
+ GetMockInterface(PPP_INSTANCE_INTERFACE_0_5));
}
@@ -102,7 +103,7 @@ void PpapiUnittest::TearDown() {
}
const void* PpapiUnittest::GetMockInterface(const char* interface_name) const {
- if (strcmp(interface_name, PPP_INSTANCE_INTERFACE_1_0) == 0)
+ if (strcmp(interface_name, PPP_INSTANCE_INTERFACE_0_5) == 0)
return &mock_instance_interface;
return NULL;
}
diff --git a/webkit/plugins/ppapi/resource_tracker_unittest.cc b/webkit/plugins/ppapi/resource_tracker_unittest.cc
index 75ea9983..e73b243 100644
--- a/webkit/plugins/ppapi/resource_tracker_unittest.cc
+++ b/webkit/plugins/ppapi/resource_tracker_unittest.cc
@@ -141,8 +141,8 @@ TEST_F(ResourceTrackerTest, Ref) {
TEST_F(ResourceTrackerTest, DeleteResourceWithInstance) {
// Make a second instance (the test harness already creates & manages one).
scoped_refptr<PluginInstance> instance2(
- PluginInstance::Create1_0(delegate(), module(),
- GetMockInterface(PPP_INSTANCE_INTERFACE_1_0)));
+ PluginInstance::Create0_5(delegate(), module(),
+ GetMockInterface(PPP_INSTANCE_INTERFACE_0_5)));
PP_Instance pp_instance2 = instance2->pp_instance();
// Make two resources and take refs on behalf of the "plugin" for each.
@@ -175,8 +175,8 @@ TEST_F(ResourceTrackerTest, DeleteResourceWithInstance) {
TEST_F(ResourceTrackerTest, DeleteObjectVarWithInstance) {
// Make a second instance (the test harness already creates & manages one).
scoped_refptr<PluginInstance> instance2(
- PluginInstance::Create1_0(delegate(), module(),
- GetMockInterface(PPP_INSTANCE_INTERFACE_1_0)));
+ PluginInstance::Create0_5(delegate(), module(),
+ GetMockInterface(PPP_INSTANCE_INTERFACE_0_5)));
PP_Instance pp_instance2 = instance2->pp_instance();
// Make an object var.