summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ppapi/c/ppb_messaging.h (renamed from ppapi/c/dev/ppb_messaging_dev.h)16
-rw-r--r--ppapi/c/ppp_messaging.h (renamed from ppapi/c/dev/ppp_messaging_dev.h)14
-rw-r--r--ppapi/cpp/instance.cc12
-rw-r--r--ppapi/cpp/module.cc8
-rw-r--r--ppapi/examples/scripting/reentrant_example.cc74
-rw-r--r--ppapi/examples/scripting/reentrant_example.html48
-rw-r--r--ppapi/ppapi_cpp.gypi4
-rw-r--r--ppapi/tests/all_c_includes.h2
-rw-r--r--webkit/plugins/ppapi/message_channel.h2
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc4
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc12
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h8
12 files changed, 42 insertions, 162 deletions
diff --git a/ppapi/c/dev/ppb_messaging_dev.h b/ppapi/c/ppb_messaging.h
index 8ae1ac5..68e8b29 100644
--- a/ppapi/c/dev/ppb_messaging_dev.h
+++ b/ppapi/c/ppb_messaging.h
@@ -2,18 +2,18 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#ifndef PPAPI_C_DEV_PPB_MESSAGING_DEV_H_
-#define PPAPI_C_DEV_PPB_MESSAGING_DEV_H_
+#ifndef PPAPI_C_PPB_MESSAGING_H_
+#define PPAPI_C_PPB_MESSAGING_H_
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_var.h"
-#define PPB_MESSAGING_DEV_INTERFACE "PPB_Messaging(Dev);0.1"
+#define PPB_MESSAGING_INTERFACE "PPB_Messaging;0.1"
/**
* @file
- * This file defines the PPB_Messaging_Dev interface implemented by the browser.
- * The PPB_Messaging_Dev interface contains pointers to functions related to
+ * This file defines the PPB_Messaging interface implemented by the browser.
+ * The PPB_Messaging interface contains pointers to functions related to
* sending messages to the JavaScript onmessage handler on the DOM element
* associated with a specific module instance.
*
@@ -22,11 +22,11 @@
*/
/**
- * The PPB_Messaging_Dev interface contains pointers to functions related to
+ * The PPB_Messaging interface contains pointers to functions related to
* sending messages to the JavaScript onmessage handler on the DOM element
* associated with a specific module instance.
*/
-struct PPB_Messaging_Dev {
+struct PPB_Messaging {
/**
* @a PostMessage is a pointer to a function which asynchronously invokes the
* onmessage handler on the DOM element for the given module instance, if one
@@ -78,5 +78,5 @@ struct PPB_Messaging_Dev {
* @}
*/
-#endif /* PPAPI_C_DEV_PPB_MESSAGING_DEV_H_ */
+#endif /* PPAPI_C_PPB_MESSAGING_H_ */
diff --git a/ppapi/c/dev/ppp_messaging_dev.h b/ppapi/c/ppp_messaging.h
index 8a65986..29a1213 100644
--- a/ppapi/c/dev/ppp_messaging_dev.h
+++ b/ppapi/c/ppp_messaging.h
@@ -2,18 +2,18 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#ifndef PPAPI_C_DEV_PPP_MESSAGING_DEV_H_
-#define PPAPI_C_DEV_PPP_MESSAGING_DEV_H_
+#ifndef PPAPI_C_PPP_MESSAGING_H_
+#define PPAPI_C_PPP_MESSAGING_H_
#include "ppapi/c/pp_instance.h"
struct PP_Var;
-#define PPP_MESSAGING_DEV_INTERFACE "PPP_Messaging_Dev;0.1"
+#define PPP_MESSAGING_INTERFACE "PPP_Messaging;0.1"
/**
* @file
- * This file defines the PPP_Messaging_Dev structure - a series of pointers to
+ * This file defines the PPP_Messaging structure - a series of pointers to
* methods that you must implement if you wish to handle messages posted to the
* module instance via calls to postMessage on the associated DOM element.
*
@@ -24,11 +24,11 @@ struct PP_Var;
*/
/**
- * The PPP_Messaging_Dev interface contains pointers to a series of functions
+ * The PPP_Messaging interface contains pointers to a series of functions
* that you must implement if you wish to handle messages posted to the module
* instance via calls to postMessage on the associated DOM element.
*/
-struct PPP_Messaging_Dev {
+struct PPP_Messaging {
/**
* HandleMessage is a pointer to a function that the browser will call when
* @a postMessage() is invoked on the DOM element for the module instance in
@@ -59,5 +59,5 @@ struct PPP_Messaging_Dev {
/**
* @}
*/
-#endif /* PPAPI_C_DEV_PPP_MESSAGING_DEV_H_ */
+#endif /* PPAPI_C_PPP_MESSAGING_H_ */
diff --git a/ppapi/cpp/instance.cc b/ppapi/cpp/instance.cc
index 7717ad3..12cfc02 100644
--- a/ppapi/cpp/instance.cc
+++ b/ppapi/cpp/instance.cc
@@ -4,9 +4,9 @@
#include "ppapi/cpp/instance.h"
-#include "ppapi/c/dev/ppb_messaging_dev.h"
#include "ppapi/c/dev/ppp_printing_dev.h"
#include "ppapi/c/ppb_instance.h"
+#include "ppapi/c/ppb_messaging.h"
#include "ppapi/cpp/common.h"
#include "ppapi/cpp/dev/surface_3d_dev.h"
#include "ppapi/cpp/graphics_2d.h"
@@ -26,8 +26,8 @@ template <> const char* interface_name<PPB_Instance>() {
return PPB_INSTANCE_INTERFACE;
}
-template <> const char* interface_name<PPB_Messaging_Dev>() {
- return PPB_MESSAGING_DEV_INTERFACE;
+template <> const char* interface_name<PPB_Messaging>() {
+ return PPB_MESSAGING_INTERFACE;
}
} // namespace
@@ -125,10 +125,10 @@ Var Instance::ExecuteScript(const Var& script, Var* exception) {
}
void Instance::PostMessage(const Var& message) {
- if (!has_interface<PPB_Messaging_Dev>())
+ if (!has_interface<PPB_Messaging>())
return;
- get_interface<PPB_Messaging_Dev>()->PostMessage(pp_instance(),
- message.pp_var());
+ get_interface<PPB_Messaging>()->PostMessage(pp_instance(),
+ message.pp_var());
}
void Instance::AddPerInstanceObject(const std::string& interface_name,
diff --git a/ppapi/cpp/module.cc b/ppapi/cpp/module.cc
index f64041d..3883a5c2 100644
--- a/ppapi/cpp/module.cc
+++ b/ppapi/cpp/module.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -25,10 +25,10 @@
#include <string.h>
-#include "ppapi/c/dev/ppp_messaging_dev.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/c/ppp_instance.h"
+#include "ppapi/c/ppp_messaging.h"
#include "ppapi/cpp/common.h"
#include "ppapi/cpp/url_loader.h"
#include "ppapi/cpp/instance.h"
@@ -145,7 +145,7 @@ void Messaging_HandleMessage(PP_Instance pp_instance, PP_Var var) {
instance->HandleMessage(Var(Var::PassRef(), var));
}
-static PPP_Messaging_Dev instance_messaging_interface = {
+static PPP_Messaging instance_messaging_interface = {
&Messaging_HandleMessage
};
@@ -167,7 +167,7 @@ const void* Module::GetPluginInterface(const char* interface_name) {
if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0)
return &instance_interface;
- if (strcmp(interface_name, PPP_MESSAGING_DEV_INTERFACE) == 0)
+ if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0)
return &instance_messaging_interface;
// Now see if anything was dynamically registered.
diff --git a/ppapi/examples/scripting/reentrant_example.cc b/ppapi/examples/scripting/reentrant_example.cc
deleted file mode 100644
index a2fd53e..0000000
--- a/ppapi/examples/scripting/reentrant_example.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// 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.
-
-#include <algorithm>
-#include <sstream>
-
-#include "ppapi/cpp/instance.h"
-#include "ppapi/cpp/module.h"
-#include "ppapi/cpp/var.h"
-
-// This is a simple C++ Pepper plugin that demonstrates HandleMessage and
-// PostMessage.
-
-// This object represents one time the page says <embed>.
-class MyInstance : public pp::Instance {
- public:
- explicit MyInstance(PP_Instance instance) : pp::Instance(instance) {}
- virtual ~MyInstance() {}
- virtual void HandleMessage(const pp::Var& message_data);
-};
-
-// HandleMessage gets invoked when postMessage is called on the DOM element
-// associated with this plugin instance.
-// In this case, if we are given a string, we'll post a message back to
-// JavaScript indicating whether or not that string is a palindrome.
-void MyInstance::HandleMessage(const pp::Var& message_data) {
- if (message_data.is_string()) {
- std::string string_copy(message_data.AsString());
- std::istringstream str_stream(string_copy);
- std::string id;
- std::string input_string;
- // Tokenize the string to get the id and the input_string. If we find both,
- // post a message back to JavaScript indicating whether the given string is
- // a palindrome.
- if (std::getline(str_stream, id, ',') &&
- std::getline(str_stream, input_string, ',')) {
- std::string reversed_string(input_string);
- std::reverse(reversed_string.begin(), reversed_string.end());
- bool is_palindrome(input_string == reversed_string);
- // Create a result string of the form "<id>,<result>", where <id> is the
- // id we were given, and <result> is true if the given string was a
- // palindrome, false otherwise.
- std::string result(id);
- result += ",";
- result += is_palindrome ? "true" : "false";
- // Send this result back to JS.
- PostMessage(pp::Var(result));
- }
- }
-}
-
-// This object is the global object representing this plugin library as long
-// as it is loaded.
-class MyModule : public pp::Module {
- public:
- MyModule() : pp::Module() {}
- virtual ~MyModule() {}
-
- // Override CreateInstance to create your customized Instance object.
- virtual pp::Instance* CreateInstance(PP_Instance instance) {
- return new MyInstance(instance);
- }
-};
-
-namespace pp {
-
-// Factory function for your specialization of the Module object.
-Module* CreateModule() {
- return new MyModule();
-}
-
-} // namespace pp
-
diff --git a/ppapi/examples/scripting/reentrant_example.html b/ppapi/examples/scripting/reentrant_example.html
deleted file mode 100644
index 6fa6b34..0000000
--- a/ppapi/examples/scripting/reentrant_example.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<body>
-
-<script type="text/javascript">
-
-var id_string_dictionary = new Object;
-var last_id = 0;
-
-function SendString() {
- plugin = document.getElementById('plugin');
-
- // If we haven't already done it, set up an 'onmessage' function. This will
- // get invoked whenever the plugin calls Instance::PostMessage in C++ (or
- // PPB_Instance::PostMessage in C). In this case, we're expecting a bool to
- // tell us whether the string we passed was a palindrome.
- if (!plugin.onmessage) {
- plugin.onmessage = function(message_event) {
- var id_bool_pair = message_event.data.split(",");
- var sent_string = id_string_dictionary[id_bool_pair[0]];
- delete id_string_dictionary[id_bool_pair[0]];
- if (id_bool_pair[1] == "true") {
- alert(sent_string + " was a palindrome.");
- } else {
- alert(sent_string + " was not a palindrome.");
- }
- }
- }
-
- var inputBox = document.getElementById("inputBox");
-
- // Send an id and a string to the plugin using postMessage. This results in a call
- // to Instance::HandleMessage in C++ (or PPP_Instance::HandleMessage in C).
- var id = ++last_id;
-
- plugin.postMessage(id + "," + inputBox.value);
- // Now put the string in our dictionary, so when we get a response, we know
- // which request it goes with.
- id_string_dictionary[id] = inputBox.value;
-}
-
-</script>
-
-<input type="text" id="inputBox" name="inputBox" value="ablewasiereisawelba"/>
-<p>
-<button onclick='SendString()'>Is Palindrome</button>
-<object id="plugin" type="application/x-ppapi-reentrant-example"
- width="0" height="0"/>
-<hr>
-</body>
diff --git a/ppapi/ppapi_cpp.gypi b/ppapi/ppapi_cpp.gypi
index be43504..c636b7c 100644
--- a/ppapi/ppapi_cpp.gypi
+++ b/ppapi/ppapi_cpp.gypi
@@ -34,12 +34,14 @@
'c/ppb_graphics_2d.h',
'c/ppb_image_data.h',
'c/ppb_instance.h',
+ 'c/ppb_messaging.h',
'c/ppb_url_loader.h',
'c/ppb_url_request_info.h',
'c/ppb_url_response_info.h',
'c/ppb_var.h',
'c/ppp.h',
'c/ppp_instance.h',
+ 'c/ppp_messaging.h',
# Dev interfaces.
'c/dev/pp_cursor_type_dev.h',
@@ -63,7 +65,6 @@
'c/dev/ppb_font_list_dev.h',
'c/dev/ppb_fullscreen_dev.h',
'c/dev/ppb_graphics_3d_dev.h',
- 'c/dev/ppb_messaging_dev.h',
'c/dev/ppb_opengles_dev.h',
'c/dev/ppb_scrollbar_dev.h',
'c/dev/ppb_surface_3d_dev.h',
@@ -76,7 +77,6 @@
'c/dev/ppp_cursor_control_dev.h',
'c/dev/ppp_find_dev.h',
'c/dev/ppp_graphics_3d_dev.h',
- 'c/dev/ppp_messaging_dev.h',
'c/dev/ppp_scrollbar_dev.h',
'c/dev/ppp_selection_dev.h',
'c/dev/ppp_printing_dev.h',
diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h
index 2d421e0..86b6a22 100644
--- a/ppapi/tests/all_c_includes.h
+++ b/ppapi/tests/all_c_includes.h
@@ -71,11 +71,13 @@
#include "ppapi/c/ppb_graphics_2d.h"
#include "ppapi/c/ppb_image_data.h"
#include "ppapi/c/ppb_instance.h"
+#include "ppapi/c/ppb_messaging.h"
#include "ppapi/c/ppb_url_loader.h"
#include "ppapi/c/ppb_url_request_info.h"
#include "ppapi/c/ppb_url_response_info.h"
#include "ppapi/c/ppp.h"
#include "ppapi/c/ppp_instance.h"
+#include "ppapi/c/ppp_messaging.h"
#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/c/private/ppb_flash_menu.h"
#include "ppapi/c/private/ppb_nacl_private.h"
diff --git a/webkit/plugins/ppapi/message_channel.h b/webkit/plugins/ppapi/message_channel.h
index efe4568..a6091f13 100644
--- a/webkit/plugins/ppapi/message_channel.h
+++ b/webkit/plugins/ppapi/message_channel.h
@@ -18,7 +18,7 @@ class PluginInstance;
// MessageChannel implements bidirectional postMessage functionality, allowing
// calls from JavaScript to plugins and vice-versa. See
-// PPB_Instance::PostMessage and PPP_Instance::HandleMessage for more
+// PPB_Messaging::PostMessage and PPP_Messaging::HandleMessage for more
// information.
//
// Currently, only 1 MessageChannel can exist, to implement postMessage
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index 6a7c397..a166c14 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -27,7 +27,6 @@
#include "ppapi/c/dev/ppb_fullscreen_dev.h"
#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
-#include "ppapi/c/dev/ppb_messaging_dev.h"
#include "ppapi/c/dev/ppb_opengles_dev.h"
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
@@ -44,6 +43,7 @@
#include "ppapi/c/ppb_graphics_2d.h"
#include "ppapi/c/ppb_image_data.h"
#include "ppapi/c/ppb_instance.h"
+#include "ppapi/c/ppb_messaging.h"
#include "ppapi/c/ppb_url_loader.h"
#include "ppapi/c/ppb_url_request_info.h"
#include "ppapi/c/ppb_url_response_info.h"
@@ -277,7 +277,7 @@ const void* GetInterface(const char* name) {
return PPB_ImageData_Impl::GetTrustedInterface();
if (strcmp(name, PPB_INSTANCE_INTERFACE) == 0)
return PluginInstance::GetInterface();
- if (strcmp(name, PPB_MESSAGING_DEV_INTERFACE) == 0)
+ if (strcmp(name, PPB_MESSAGING_INTERFACE) == 0)
return PluginInstance::GetMessagingInterface();
if (strcmp(name, PPB_PDF_INTERFACE) == 0)
return PPB_PDF_Impl::GetInterface();
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 265885c..fa5b9aa 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -11,10 +11,8 @@
#include "base/utf_string_conversions.h"
#include "ppapi/c/dev/ppb_find_dev.h"
#include "ppapi/c/dev/ppb_fullscreen_dev.h"
-#include "ppapi/c/dev/ppb_messaging_dev.h"
#include "ppapi/c/dev/ppb_zoom_dev.h"
#include "ppapi/c/dev/ppp_find_dev.h"
-#include "ppapi/c/dev/ppp_messaging_dev.h"
#include "ppapi/c/dev/ppp_selection_dev.h"
#include "ppapi/c/dev/ppp_zoom_dev.h"
#include "ppapi/c/pp_input_event.h"
@@ -24,7 +22,9 @@
#include "ppapi/c/pp_var.h"
#include "ppapi/c/ppb_core.h"
#include "ppapi/c/ppb_instance.h"
+#include "ppapi/c/ppb_messaging.h"
#include "ppapi/c/ppp_instance.h"
+#include "ppapi/c/ppp_messaging.h"
#include "printing/units.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
@@ -281,7 +281,7 @@ void PostMessage(PP_Instance instance_id, PP_Var message) {
instance->PostMessage(message);
}
-const PPB_Messaging_Dev ppb_messaging = {
+const PPB_Messaging ppb_messaging = {
&PostMessage
};
@@ -403,7 +403,7 @@ const PPB_Fullscreen_Dev* PluginInstance::GetFullscreenInterface() {
}
// static
-const PPB_Messaging_Dev* PluginInstance::GetMessagingInterface() {
+const PPB_Messaging* PluginInstance::GetMessagingInterface() {
return &ppb_messaging;
}
@@ -921,8 +921,8 @@ bool PluginInstance::LoadMessagingInterface() {
if (!checked_for_plugin_messaging_interface_) {
checked_for_plugin_messaging_interface_ = true;
plugin_messaging_interface_ =
- reinterpret_cast<const PPP_Messaging_Dev*>(module_->GetPluginInterface(
- PPP_MESSAGING_DEV_INTERFACE));
+ reinterpret_cast<const PPP_Messaging*>(module_->GetPluginInterface(
+ PPP_MESSAGING_INTERFACE));
}
return !!plugin_messaging_interface_;
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index 837a179..35968bb 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -30,11 +30,11 @@ struct PP_Var;
struct PPB_Instance;
struct PPB_Find_Dev;
struct PPB_Fullscreen_Dev;
-struct PPB_Messaging_Dev;
+struct PPB_Messaging;
struct PPB_Zoom_Dev;
struct PPP_Find_Dev;
struct PPP_Instance;
-struct PPP_Messaging_Dev;
+struct PPP_Messaging;
struct PPP_Pdf;
struct PPP_Selection_Dev;
struct PPP_Zoom_Dev;
@@ -87,7 +87,7 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
// exposed to the plugin.
static const PPB_Find_Dev* GetFindInterface();
static const PPB_Fullscreen_Dev* GetFullscreenInterface();
- static const PPB_Messaging_Dev* GetMessagingInterface();
+ static const PPB_Messaging* GetMessagingInterface();
static const PPB_Zoom_Dev* GetZoomInterface();
PluginDelegate* delegate() const { return delegate_; }
@@ -345,7 +345,7 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
// The plugin-provided interfaces.
const PPP_Find_Dev* plugin_find_interface_;
- const PPP_Messaging_Dev* plugin_messaging_interface_;
+ const PPP_Messaging* plugin_messaging_interface_;
const PPP_Pdf* plugin_pdf_interface_;
const PPP_Selection_Dev* plugin_selection_interface_;
const PPP_Zoom_Dev* plugin_zoom_interface_;