summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 22:06:36 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 22:06:36 +0000
commita171eb1211aa59550e68c4b8316b0edc784d8d61 (patch)
treeb5a3fb5ac8d35f9e48784ecc718f7e5e8e535614
parent6bf0f2f5505bb02313ebd39e74500afd1245e1f5 (diff)
downloadchromium_src-a171eb1211aa59550e68c4b8316b0edc784d8d61.zip
chromium_src-a171eb1211aa59550e68c4b8316b0edc784d8d61.tar.gz
chromium_src-a171eb1211aa59550e68c4b8316b0edc784d8d61.tar.bz2
Bring in latest PPAPI headers and implement IsFullFrame.
Review URL: http://codereview.chromium.org/2866039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51429 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--DEPS2
-rw-r--r--chrome/common/pepper_plugin_registry.cc20
-rw-r--r--chrome/common/pepper_plugin_registry.h3
-rw-r--r--webkit/glue/plugins/pepper_plugin_instance.cc15
-rw-r--r--webkit/glue/plugins/pepper_plugin_instance.h8
-rw-r--r--webkit/glue/plugins/pepper_webplugin_impl.cc6
-rw-r--r--webkit/glue/plugins/pepper_webplugin_impl.h3
7 files changed, 50 insertions, 7 deletions
diff --git a/DEPS b/DEPS
index ad0b26d..4691553 100644
--- a/DEPS
+++ b/DEPS
@@ -158,7 +158,7 @@ deps = {
Var("libvpx_revision"),
"src/third_party/ppapi":
- "http://ppapi.googlecode.com/svn/trunk@82",
+ "http://ppapi.googlecode.com/svn/trunk@84",
"src/third_party/libjingle/source":
"http://libjingle.googlecode.com/svn/branches/nextsnap@" +
diff --git a/chrome/common/pepper_plugin_registry.cc b/chrome/common/pepper_plugin_registry.cc
index e7771c4..e288eaa 100644
--- a/chrome/common/pepper_plugin_registry.cc
+++ b/chrome/common/pepper_plugin_registry.cc
@@ -5,7 +5,10 @@
#include "chrome/common/pepper_plugin_registry.h"
#include "base/command_line.h"
+#include "base/file_util.h"
+#include "base/path_service.h"
#include "base/string_util.h"
+#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "remoting/client/plugin/pepper_entrypoints.h"
@@ -27,6 +30,7 @@ void PepperPluginRegistry::GetList(std::vector<PepperPluginInfo>* plugins) {
}
GetPluginInfoFromSwitch(plugins);
+ GetExtraPlugins(plugins);
}
// static
@@ -61,6 +65,20 @@ void PepperPluginRegistry::GetPluginInfoFromSwitch(
}
// static
+void PepperPluginRegistry::GetExtraPlugins(
+ std::vector<PepperPluginInfo>* plugins) {
+ FilePath path;
+ if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path) &&
+ file_util::PathExists(path)) {
+ PepperPluginInfo pdf;
+ pdf.path = path;
+ pdf.name = "Chrome PDF Viewer";
+ pdf.mime_types.push_back("application/pdf");
+ plugins->push_back(pdf);
+ }
+}
+
+// static
void PepperPluginRegistry::GetInternalPluginInfo(
InternalPluginInfoList* plugin_info) {
// Currently, to centralize the internal plugin registration logic, we
@@ -86,7 +104,6 @@ void PepperPluginRegistry::GetInternalPluginInfo(
plugin_info->push_back(info);
#endif
-
}
pepper::PluginModule* PepperPluginRegistry::GetModule(
@@ -119,6 +136,7 @@ PepperPluginRegistry::PepperPluginRegistry() {
// override the internal plugins.
std::vector<PepperPluginInfo> plugins;
GetPluginInfoFromSwitch(&plugins);
+ GetExtraPlugins(&plugins);
for (size_t i = 0; i < plugins.size(); ++i) {
const FilePath& path = plugins[i].path;
ModuleHandle module = pepper::PluginModule::CreateModule(path);
diff --git a/chrome/common/pepper_plugin_registry.h b/chrome/common/pepper_plugin_registry.h
index 9949ed4..abddce5 100644
--- a/chrome/common/pepper_plugin_registry.h
+++ b/chrome/common/pepper_plugin_registry.h
@@ -14,6 +14,8 @@
struct PepperPluginInfo {
FilePath path; // Internal plugins are of the form "internal-[name]".
std::vector<std::string> mime_types;
+ std::string name;
+ std::string description;
};
// This class holds references to all of the known pepper plugin modules.
@@ -30,6 +32,7 @@ class PepperPluginRegistry {
private:
static void GetPluginInfoFromSwitch(std::vector<PepperPluginInfo>* plugins);
+ static void GetExtraPlugins(std::vector<PepperPluginInfo>* plugins);
struct InternalPluginInfo : public PepperPluginInfo {
pepper::PluginModule::EntryPoints entry_points;
diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc
index 454f055..5f054ee 100644
--- a/webkit/glue/plugins/pepper_plugin_instance.cc
+++ b/webkit/glue/plugins/pepper_plugin_instance.cc
@@ -130,10 +130,18 @@ bool BindGraphicsDeviceContext(PP_Instance instance_id, PP_Resource device_id) {
return instance->BindGraphicsDeviceContext(device_id);
}
+bool IsFullFrame(PP_Instance instance_id) {
+ PluginInstance* instance = PluginInstance::FromPPInstance(instance_id);
+ if (!instance)
+ return false;
+ return instance->full_frame();
+}
+
const PPB_Instance ppb_instance = {
&GetWindowObject,
&GetOwnerElementObject,
&BindGraphicsDeviceContext,
+ &IsFullFrame,
};
} // namespace
@@ -144,7 +152,8 @@ PluginInstance::PluginInstance(PluginDelegate* delegate,
: delegate_(delegate),
module_(module),
instance_interface_(instance_interface),
- container_(NULL) {
+ container_(NULL),
+ full_frame_(false) {
DCHECK(delegate);
module_->InstanceCreated(this);
delegate_->InstanceCreated(this);
@@ -235,8 +244,10 @@ void PluginInstance::Delete() {
bool PluginInstance::Initialize(WebPluginContainer* container,
const std::vector<std::string>& arg_names,
- const std::vector<std::string>& arg_values) {
+ const std::vector<std::string>& arg_values,
+ bool full_frame) {
container_ = container;
+ full_frame_ = full_frame;
if (!instance_interface_->New(GetPPInstance()))
return false;
diff --git a/webkit/glue/plugins/pepper_plugin_instance.h b/webkit/glue/plugins/pepper_plugin_instance.h
index 89f3c47..017a1e8 100644
--- a/webkit/glue/plugins/pepper_plugin_instance.h
+++ b/webkit/glue/plugins/pepper_plugin_instance.h
@@ -73,12 +73,14 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
PP_Var GetWindowObject();
PP_Var GetOwnerElementObject();
bool BindGraphicsDeviceContext(PP_Resource device_id);
+ bool full_frame() const { return full_frame_; }
// PPP_Instance pass-through.
void Delete();
bool Initialize(WebKit::WebPluginContainer* container,
const std::vector<std::string>& arg_names,
- const std::vector<std::string>& arg_values);
+ const std::vector<std::string>& arg_values,
+ bool full_frame);
bool HandleDocumentLoad(URLLoader* loader);
bool HandleInputEvent(const WebKit::WebInputEvent& event,
WebKit::WebCursorInfo* cursor_info);
@@ -99,6 +101,10 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
// NULL until we have been initialized.
WebKit::WebPluginContainer* container_;
+ // Indicates whether this is a full frame instance, which means it represents
+ // an entire document rather than an embed tag.
+ bool full_frame_;
+
// Position in the viewport (which moves as the page is scrolled) of this
// plugin. This will be a 0-sized rectangle if the plugin has not yet been
// laid out.
diff --git a/webkit/glue/plugins/pepper_webplugin_impl.cc b/webkit/glue/plugins/pepper_webplugin_impl.cc
index 2c4a1b6..2bddcc0 100644
--- a/webkit/glue/plugins/pepper_webplugin_impl.cc
+++ b/webkit/glue/plugins/pepper_webplugin_impl.cc
@@ -26,7 +26,8 @@ WebPluginImpl::WebPluginImpl(
PluginModule* plugin_module,
const WebPluginParams& params,
const base::WeakPtr<PluginDelegate>& plugin_delegate)
- : init_data_(new InitData()) {
+ : init_data_(new InitData()),
+ full_frame_(params.loadManually) {
DCHECK(plugin_module);
init_data_->module = plugin_module;
init_data_->delegate = plugin_delegate;
@@ -50,7 +51,8 @@ bool WebPluginImpl::initialize(WebPluginContainer* container) {
bool success = instance_->Initialize(container,
init_data_->arg_names,
- init_data_->arg_values);
+ init_data_->arg_values,
+ full_frame_);
if (!success) {
instance_->Delete();
instance_ = NULL;
diff --git a/webkit/glue/plugins/pepper_webplugin_impl.h b/webkit/glue/plugins/pepper_webplugin_impl.h
index d70d7a4..040a67b 100644
--- a/webkit/glue/plugins/pepper_webplugin_impl.h
+++ b/webkit/glue/plugins/pepper_webplugin_impl.h
@@ -69,6 +69,9 @@ class WebPluginImpl : public WebKit::WebPlugin {
};
scoped_ptr<InitData> init_data_; // Cleared upon successful initialization.
+ // True if the instance represents the entire document in a frame instead of
+ // being an embedded resource.
+ bool full_frame_;
scoped_refptr<PluginInstance> instance_;
scoped_refptr<URLLoader> document_loader_;
gfx::Rect plugin_rect_;