summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-25 13:15:43 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-25 13:15:43 +0000
commitef777a4cc0aa03ba9e1d738f7f8ac27e4d045eb3 (patch)
tree00d1b93b053b8b8a02d2247de1fb26e7911be1e6
parentf5478b310ce3590b5555321cef0574f50d81bb1d (diff)
downloadchromium_src-ef777a4cc0aa03ba9e1d738f7f8ac27e4d045eb3.zip
chromium_src-ef777a4cc0aa03ba9e1d738f7f8ac27e4d045eb3.tar.gz
chromium_src-ef777a4cc0aa03ba9e1d738f7f8ac27e4d045eb3.tar.bz2
Reland 111519: Remove default plug-in on Mac, Gtk and Aura.
Aura doesn't do plug-ins, and Mac and Gtk already use in-renderer placeholders. TBR=jam@chromium.org BUG=62079 TEST=none Review URL: http://codereview.chromium.org/8689001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111590 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/chrome_common.gypi13
-rw-r--r--chrome/chrome_tests.gypi8
-rw-r--r--chrome/default_plugin/default_plugin.gyp6
-rw-r--r--chrome/default_plugin/plugin_impl.h8
-rw-r--r--chrome/default_plugin/plugin_impl_aura.cc74
-rw-r--r--chrome/default_plugin/plugin_impl_aura.h119
-rw-r--r--chrome/default_plugin/plugin_impl_gtk.cc147
-rw-r--r--chrome/default_plugin/plugin_impl_gtk.h281
-rw-r--r--chrome/default_plugin/plugin_impl_mac.h295
-rw-r--r--chrome/default_plugin/plugin_impl_mac.mm204
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl_win.cc1
11 files changed, 14 insertions, 1142 deletions
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 0111b2d..3f2f4871 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -32,7 +32,6 @@
'common_constants',
'common_net',
'common_version',
- 'default_plugin/default_plugin.gyp:default_plugin',
'../base/base.gyp:base',
'../base/base.gyp:base_i18n',
'../base/base.gyp:base_static',
@@ -247,7 +246,12 @@
['OS=="win"', {
'include_dirs': [
'<(DEPTH)/third_party/wtl/include',
- ],
+ ]
+ }],
+ ['OS=="win" and use_aura==0', {
+ 'dependencies': [
+ 'default_plugin/default_plugin.gyp:default_plugin',
+ ]
}],
['toolkit_uses_gtk == 1', {
'dependencies': [
@@ -264,11 +268,6 @@
'-lXext',
],
},
- },],
- ['use_aura==1', {
- 'dependencies!': [
- 'default_plugin/default_plugin.gyp:default_plugin',
- ],
}],
['OS=="linux" and selinux==1', {
'dependencies': [
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index c668963..3220cc3 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -734,7 +734,6 @@
'../third_party/icu/icu.gyp:icuuc',
'../third_party/libxml/libxml.gyp:libxml',
# run time dependencies
- 'default_plugin/default_plugin.gyp:default_plugin',
'../ppapi/ppapi_internal.gyp:ppapi_tests',
'../third_party/mesa/mesa.gyp:osmesa',
'../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:copy_TestNetscapePlugIn',
@@ -843,6 +842,7 @@
'sources!': [
'test/automation/automation_proxy_uitest.cc',
'test/ui/npapi_uitest.cc',
+ 'browser/default_plugin_uitest.cc',
],
'dependencies': [
'../ui/aura/aura.gyp:aura',
@@ -874,6 +874,12 @@
'<(allocator_target)',
],
}],
+ ['use_aura==0', {
+ 'dependencies': [
+ # Runtime dependency
+ 'default_plugin/default_plugin.gyp:default_plugin',
+ ]
+ }],
],
'link_settings': {
'libraries': [
diff --git a/chrome/default_plugin/default_plugin.gyp b/chrome/default_plugin/default_plugin.gyp
index 4d3f600..30aab78 100644
--- a/chrome/default_plugin/default_plugin.gyp
+++ b/chrome/default_plugin/default_plugin.gyp
@@ -29,12 +29,6 @@
'<(DEPTH)/third_party/wtl/include',
],
'sources': [
- 'plugin_impl_aura.cc',
- 'plugin_impl_aura.h',
- 'plugin_impl_gtk.cc',
- 'plugin_impl_gtk.h',
- 'plugin_impl_mac.h',
- 'plugin_impl_mac.mm',
'plugin_impl_win.cc',
'plugin_impl_win.h',
'plugin_installer_base.cc',
diff --git a/chrome/default_plugin/plugin_impl.h b/chrome/default_plugin/plugin_impl.h
index ac57490..845c0d5 100644
--- a/chrome/default_plugin/plugin_impl.h
+++ b/chrome/default_plugin/plugin_impl.h
@@ -2,12 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#if defined(USE_AURA)
-#include "chrome/default_plugin/plugin_impl_aura.h"
-#elif defined(OS_WIN)
+#if defined(OS_WIN)
#include "chrome/default_plugin/plugin_impl_win.h"
-#elif defined(OS_MACOSX)
-#include "chrome/default_plugin/plugin_impl_mac.h"
-#elif defined(TOOLKIT_USES_GTK)
-#include "chrome/default_plugin/plugin_impl_gtk.h"
#endif
diff --git a/chrome/default_plugin/plugin_impl_aura.cc b/chrome/default_plugin/plugin_impl_aura.cc
deleted file mode 100644
index 4122854..0000000
--- a/chrome/default_plugin/plugin_impl_aura.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 "chrome/default_plugin/plugin_impl_aura.h"
-
-#include "base/file_util.h"
-#include "base/path_service.h"
-#include "base/string_util.h"
-#include "chrome/common/chrome_plugin_messages.h"
-#include "chrome/default_plugin/plugin_main.h"
-#include "content/common/child_thread.h"
-#include "content/public/common/content_constants.h"
-#include "googleurl/src/gurl.h"
-#include "grit/webkit_strings.h"
-#include "unicode/locid.h"
-#include "webkit/plugins/npapi/default_plugin_shared.h"
-
-PluginInstallerImpl::PluginInstallerImpl(int16 mode) {}
-
-PluginInstallerImpl::~PluginInstallerImpl() {
-}
-
-bool PluginInstallerImpl::Initialize(void* module_handle,
- NPP instance,
- NPMIMEType mime_type,
- int16 argc,
- char* argn[],
- char* argv[]) {
- DVLOG(1) << __FUNCTION__ << " MIME Type : " << mime_type;
- DCHECK(instance != NULL);
-
- if (mime_type == NULL || strlen(mime_type) == 0) {
- DLOG(WARNING) << __FUNCTION__ << " Invalid parameters passed in";
- NOTREACHED();
- return false;
- }
-
- PluginInstallerBase::SetRoutingIds(argc, argn, argv);
- return true;
-}
-
-bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) {
- NOTIMPLEMENTED();
- return true;
-}
-
-void PluginInstallerImpl::Shutdown() {
-}
-
-void PluginInstallerImpl::NewStream(NPStream* stream) {
- NOTIMPLEMENTED();
-}
-
-void PluginInstallerImpl::DestroyStream(NPStream* stream, NPError reason) {
- NOTIMPLEMENTED();
-}
-
-bool PluginInstallerImpl::WriteReady(NPStream* stream) {
- NOTIMPLEMENTED();
- return false;
-}
-
-int32 PluginInstallerImpl::Write(NPStream* stream, int32 offset,
- int32 buffer_length, void* buffer) {
- return true;
-}
-
-void PluginInstallerImpl::URLNotify(const char* url, NPReason reason) {
-}
-
-int16 PluginInstallerImpl::NPP_HandleEvent(void* event) {
- return 0;
-}
diff --git a/chrome/default_plugin/plugin_impl_aura.h b/chrome/default_plugin/plugin_impl_aura.h
deleted file mode 100644
index ed65932b..0000000
--- a/chrome/default_plugin/plugin_impl_aura.h
+++ /dev/null
@@ -1,119 +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.
-
-#ifndef CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_AURA_H_
-#define CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_AURA_H_
-#pragma once
-
-#include <string>
-
-#include "chrome/default_plugin/plugin_installer_base.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "ui/gfx/native_widget_types.h"
-
-// Provides the plugin installation functionality. This class is
-// instantiated with the information like the mime type of the
-// target plugin, the display mode, etc.
-class PluginInstallerImpl : public PluginInstallerBase {
- public:
- // mode is the plugin instantiation mode, i.e. whether it is a full
- // page plugin (NP_FULL) or an embedded plugin (NP_EMBED)
- explicit PluginInstallerImpl(int16 mode);
- virtual ~PluginInstallerImpl();
-
- // Initializes the plugin with the instance information, mime type
- // and the list of parameters passed down to the plugin from the webpage.
- //
- // Parameters:
- // module_handle
- // The handle to the dll in which this object is instantiated.
- // instance
- // The plugins opaque instance handle.
- // mime_type
- // Identifies the third party plugin which would be eventually installed.
- // argc
- // Indicates the count of arguments passed in from the webpage.
- // argv
- // Pointer to the arguments.
- // Returns true on success.
- bool Initialize(void* module_handle, NPP instance, NPMIMEType mime_type,
- int16 argc, char* argn[], char* argv[]);
-
- // Informs the plugin of its window information.
- //
- // Parameters:
- // window_info
- // The window info passed to npapi.
- bool NPP_SetWindow(NPWindow* window_info);
-
- // Destroys the install dialog.
- void Shutdown();
-
- // Starts plugin download. Spawns the plugin installer after it is
- // downloaded.
- void DownloadPlugin();
-
- // Indicates that the plugin download was cancelled.
- void DownloadCancelled();
-
- // Initializes the plugin download stream.
- //
- // Parameters:
- // stream
- // Pointer to the new stream being created.
- void NewStream(NPStream* stream);
-
- // Uninitializes the plugin download stream.
- //
- // Parameters:
- // stream
- // Pointer to the stream being destroyed.
- // reason
- // Indicates why the stream is being destroyed.
- //
- void DestroyStream(NPStream* stream, NPError reason);
-
- // Determines whether the plugin is ready to accept data.
- // We only accept data when we have initiated a download for the plugin
- // database.
- //
- // Parameters:
- // stream
- // Pointer to the stream being destroyed.
- // Returns true if the plugin is ready to accept data.
- bool WriteReady(NPStream* stream);
-
- // Delivers data to the plugin instance.
- //
- // Parameters:
- // stream
- // Pointer to the stream being destroyed.
- // offset
- // Indicates the data offset.
- // buffer_length
- // Indicates the length of the data buffer.
- // buffer
- // Pointer to the actual buffer.
- // Returns the number of bytes actually written, 0 on error.
- int32 Write(NPStream* stream, int32 offset, int32 buffer_length,
- void* buffer);
-
- // Handles notifications received in response to GetURLNotify calls issued
- // by the plugin.
- //
- // Parameters:
- // url
- // Pointer to the URL.
- // reason
- // Describes why the notification was sent.
- void URLNotify(const char* url, NPReason reason);
-
- // Used by the renderer to pass events (for e.g. input events) to the plugin.
- int16 NPP_HandleEvent(void* event);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl);
-};
-
-#endif // CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_AURA_H_
diff --git a/chrome/default_plugin/plugin_impl_gtk.cc b/chrome/default_plugin/plugin_impl_gtk.cc
deleted file mode 100644
index 0da5f30..0000000
--- a/chrome/default_plugin/plugin_impl_gtk.cc
+++ /dev/null
@@ -1,147 +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 "chrome/default_plugin/plugin_impl_gtk.h"
-
-#include <X11/Xdefs.h>
-#include <gtk/gtk.h>
-
-#include "base/file_util.h"
-#include "base/path_service.h"
-#include "base/string_util.h"
-#include "chrome/common/chrome_plugin_messages.h"
-#include "chrome/default_plugin/plugin_main.h"
-#include "content/common/child_thread.h"
-#include "content/public/common/content_constants.h"
-#include "googleurl/src/gurl.h"
-#include "grit/webkit_strings.h"
-#include "unicode/locid.h"
-#include "webkit/plugins/npapi/default_plugin_shared.h"
-
-// TODO(thakis): Most methods in this class are stubbed out an need to be
-// implemented.
-
-PluginInstallerImpl::PluginInstallerImpl(int16 mode)
- : instance_(NULL),
- plugin_install_stream_(NULL),
- plugin_installer_state_(PluginInstallerStateUndefined),
- container_(NULL) {
-}
-
-PluginInstallerImpl::~PluginInstallerImpl() {
- if (container_)
- gtk_widget_destroy(container_);
-}
-
-bool PluginInstallerImpl::Initialize(void* module_handle, NPP instance,
- NPMIMEType mime_type, int16 argc,
- char* argn[], char* argv[]) {
- DVLOG(1) << __FUNCTION__ << " MIME Type : " << mime_type;
- DCHECK(instance != NULL);
-
- if (mime_type == NULL || strlen(mime_type) == 0) {
- DLOG(WARNING) << __FUNCTION__ << " Invalid parameters passed in";
- NOTREACHED();
- return false;
- }
-
- instance_ = instance;
- mime_type_ = mime_type;
-
- PluginInstallerBase::SetRoutingIds(argc, argn, argv);
- return true;
-}
-
-bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) {
- if (container_)
- gtk_widget_destroy(container_);
- container_ = gtk_plug_new(reinterpret_cast<XID>(window_info->window));
-
- // Add label.
- GtkWidget* box = gtk_vbox_new(FALSE, 0);
- GtkWidget* label = gtk_label_new("Missing Plug-in");
- gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 0);
- gtk_container_add(GTK_CONTAINER(container_), box);
-
- gtk_widget_show_all(container_);
-
- return true;
-}
-
-void PluginInstallerImpl::Shutdown() {
-}
-
-void PluginInstallerImpl::NewStream(NPStream* stream) {
- plugin_install_stream_ = stream;
-}
-
-void PluginInstallerImpl::DestroyStream(NPStream* stream, NPError reason) {
- if (stream == plugin_install_stream_)
- plugin_install_stream_ = NULL;
-}
-
-bool PluginInstallerImpl::WriteReady(NPStream* stream) {
- bool ready_to_accept_data = false;
- return ready_to_accept_data;
-}
-
-int32 PluginInstallerImpl::Write(NPStream* stream, int32 offset,
- int32 buffer_length, void* buffer) {
- return true;
-}
-
-void PluginInstallerImpl::ClearDisplay() {
-}
-
-void PluginInstallerImpl::RefreshDisplay() {
-}
-
-bool PluginInstallerImpl::CreateToolTip() {
- return true;
-}
-
-void PluginInstallerImpl::UpdateToolTip() {
-}
-
-void PluginInstallerImpl::DisplayAvailablePluginStatus() {
-}
-
-void PluginInstallerImpl::DisplayStatus(int message_resource_id) {
-}
-
-void PluginInstallerImpl::DisplayPluginDownloadFailedStatus() {
-}
-
-void PluginInstallerImpl::URLNotify(const char* url, NPReason reason) {
-}
-
-int16 PluginInstallerImpl::NPP_HandleEvent(void* event) {
- return 0;
-}
-
-std::wstring PluginInstallerImpl::ReplaceStringForPossibleEmptyReplacement(
- int message_id_with_placeholders,
- int messsage_id_without_placeholders,
- const std::wstring& replacement_string) {
- return L"";
-}
-
-void PluginInstallerImpl::DownloadPlugin() {
-}
-
-void PluginInstallerImpl::DownloadCancelled() {
- DisplayAvailablePluginStatus();
-}
-
-void PluginInstallerImpl::ShowInstallDialog() {
-}
-
-void PluginInstallerImpl::NotifyPluginStatus(int status) {
- ChildThread::current()->Send(
- new ChromePluginProcessHostMsg_MissingPluginStatus(
- status,
- renderer_process_id(),
- render_view_id(),
- 0));
-}
diff --git a/chrome/default_plugin/plugin_impl_gtk.h b/chrome/default_plugin/plugin_impl_gtk.h
deleted file mode 100644
index ac4a04b..0000000
--- a/chrome/default_plugin/plugin_impl_gtk.h
+++ /dev/null
@@ -1,281 +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.
-
-#ifndef CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_GTK_H_
-#define CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_GTK_H_
-#pragma once
-
-#include <string>
-
-#include <gtk/gtk.h>
-
-#include "chrome/default_plugin/plugin_installer_base.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "ui/gfx/native_widget_types.h"
-
-// Possible plugin installer states.
-enum PluginInstallerState {
- PluginInstallerStateUndefined,
- PluginListDownloadInitiated,
- PluginListDownloaded,
- PluginListDownloadedPluginNotFound,
- PluginListDownloadFailed,
- PluginDownloadInitiated,
- PluginDownloadCompleted,
- PluginDownloadFailed,
- PluginInstallerLaunchSuccess,
- PluginInstallerLaunchFailure
-};
-
-// Provides the plugin installation functionality. This class is
-// instantiated with the information like the mime type of the
-// target plugin, the display mode, etc.
-class PluginInstallerImpl : public PluginInstallerBase {
- public:
- // mode is the plugin instantiation mode, i.e. whether it is a full
- // page plugin (NP_FULL) or an embedded plugin (NP_EMBED)
- explicit PluginInstallerImpl(int16 mode);
- virtual ~PluginInstallerImpl();
-
- // Initializes the plugin with the instance information, mime type
- // and the list of parameters passed down to the plugin from the webpage.
- //
- // Parameters:
- // module_handle
- // The handle to the dll in which this object is instantiated.
- // instance
- // The plugins opaque instance handle.
- // mime_type
- // Identifies the third party plugin which would be eventually installed.
- // argc
- // Indicates the count of arguments passed in from the webpage.
- // argv
- // Pointer to the arguments.
- // Returns true on success.
- bool Initialize(void* module_handle, NPP instance, NPMIMEType mime_type,
- int16 argc, char* argn[], char* argv[]);
-
- // Informs the plugin of its window information.
- //
- // Parameters:
- // window_info
- // The window info passed to npapi.
- bool NPP_SetWindow(NPWindow* window_info);
-
- // Destroys the install dialog.
- void Shutdown();
-
- // Starts plugin download. Spawns the plugin installer after it is
- // downloaded.
- void DownloadPlugin();
-
- // Indicates that the plugin download was cancelled.
- void DownloadCancelled();
-
- // Initializes the plugin download stream.
- //
- // Parameters:
- // stream
- // Pointer to the new stream being created.
- void NewStream(NPStream* stream);
-
- // Uninitializes the plugin download stream.
- //
- // Parameters:
- // stream
- // Pointer to the stream being destroyed.
- // reason
- // Indicates why the stream is being destroyed.
- //
- void DestroyStream(NPStream* stream, NPError reason);
-
- // Determines whether the plugin is ready to accept data.
- // We only accept data when we have initiated a download for the plugin
- // database.
- //
- // Parameters:
- // stream
- // Pointer to the stream being destroyed.
- // Returns true if the plugin is ready to accept data.
- bool WriteReady(NPStream* stream);
-
- // Delivers data to the plugin instance.
- //
- // Parameters:
- // stream
- // Pointer to the stream being destroyed.
- // offset
- // Indicates the data offset.
- // buffer_length
- // Indicates the length of the data buffer.
- // buffer
- // Pointer to the actual buffer.
- // Returns the number of bytes actually written, 0 on error.
- int32 Write(NPStream* stream, int32 offset, int32 buffer_length,
- void* buffer);
-
- // Handles notifications received in response to GetURLNotify calls issued
- // by the plugin.
- //
- // Parameters:
- // url
- // Pointer to the URL.
- // reason
- // Describes why the notification was sent.
- void URLNotify(const char* url, NPReason reason);
-
- // Used by the renderer to pass events (for e.g. input events) to the plugin.
- int16 NPP_HandleEvent(void* event);
-
- const std::string& mime_type() const { return mime_type_; }
-
- // Replaces a resource string with the placeholder passed in as an argument
- //
- // Parameters:
- // message_id_with_placeholders
- // The resource id of the string with placeholders. This is only used if
- // the placeholder string (the replacement_string) parameter is valid.
- // message_id_without_placeholders
- // The resource id of the string to be returned if the placeholder is
- // empty.
- // replacement_string
- // The placeholder which replaces tokens in the string identified by
- // resource id message_id_with_placeholders.
- // Returns a string which has the placeholders replaced, or the string
- // without placeholders.
- static std::wstring ReplaceStringForPossibleEmptyReplacement(
- int message_id_with_placeholders, int message_id_without_placeholders,
- const std::wstring& replacement_string);
-
- // Setter/getter combination to set and retreieve the current
- // state of the plugin installer.
- void set_plugin_installer_state(PluginInstallerState new_state) {
- plugin_installer_state_ = new_state;
- }
-
- PluginInstallerState plugin_installer_state() const {
- return plugin_installer_state_;
- }
-
- // Getter for the NPP instance member.
- NPP instance() const {
- return instance_;
- }
-
- // Returns whether or not the UI layout is right-to-left (such as Hebrew or
- // Arabic).
- bool IsRTLLayout() const;
-
- protected:
- // Displays the plugin install confirmation dialog.
- void ShowInstallDialog();
-
- // Clears the current display state.
- void ClearDisplay();
-
- // Displays the status message identified by the message resource id
- // passed in.
- //
- // Parameters:
- // message_resource_id parameter
- // The resource id of the message to be displayed.
- void DisplayStatus(int message_resource_id);
-
- // Displays status information for the third party plugin which is needed
- // by the page.
- void DisplayAvailablePluginStatus();
-
- // Displays information related to third party plugin download failure.
- void DisplayPluginDownloadFailedStatus();
-
- // Enables the plugin window if required and initiates an update of the
- // the plugin window.
- void RefreshDisplay();
-
- // Create tooltip window.
- bool CreateToolTip();
-
- // Update ToolTip text with the message shown inside the default plugin.
- void UpdateToolTip();
-
- // Resolves the relative URL (could be already an absolute URL too) to return
- // full URL based on current document's URL and base.
- //
- // Parameters:
- // instance
- // The plugins opaque instance handle.
- // relative_url
- // The URL to be resolved.
- // Returns the resolved URL.
- std::string ResolveURL(NPP instance, const std::string& relative_url);
-
- // Initializes resources like the icon, fonts, etc needed by the plugin
- // installer
- //
- // Parameters:
- // module_handle
- // Handle to the dll in which this object is instantiated.
- // Returns true on success.
- bool InitializeResources(void *module_handle);
-
- // Parses the plugin instantiation arguments. This includes checking for
- // whether this is an activex install and reading the appropriate
- // arguments like codebase, etc. For plugin installs we download the
- // plugin finder URL and initalize the mime type and the plugin instance
- // info.
- //
- // Parameters:
- // module_handle
- // The handle to the dll in which this object is instantiated.
- // instance
- // The plugins opaque instance handle.
- // mime_type
- // Identifies the third party plugin which would be eventually installed.
- // argc
- // Indicates the count of arguments passed in from the webpage.
- // argv
- // Pointer to the arguments.
- // raw_activex_clsid
- // Output parameter which contains the CLSID of the Activex plugin needed.
- // This is only applicable if the webpage specifically requests an ActiveX
- // control.
- // Returns true on success.
- bool ParseInstantiationArguments(NPMIMEType mime_type, NPP instance,
- int16 argc, char* argn[], char* argv[],
- std::string* raw_activex_clsid);
-
- // Paints user action messages to the plugin window. These include messages
- // like whether the user should click on the plugin window to download the
- // plugin, etc.
- //
- // Parameters:
- // paint_dc
- // The device context returned in BeginPaint.
- // x_origin
- // Horizontal reference point indicating where the text is to be displayed.
- // y_origin
- // Vertical reference point indicating where the text is to be displayed.
- //
- void PaintUserActionInformation(gfx::NativeDrawingContext paint_dc,
- int x_origin, int y_origin);
-
- private:
- // Notify the renderer that plugin is available to download.
- void NotifyPluginStatus(int status);
-
- // The plugins opaque instance handle
- NPP instance_;
- // The current stream.
- NPStream* plugin_install_stream_;
- // The desired mime type.
- std::string mime_type_;
- // The current state of the plugin installer.
- PluginInstallerState plugin_installer_state_;
- // GtkPlug containing everything in the plugin.
- GtkWidget* container_;
-
- DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl);
-};
-
-#endif // CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_GTK_H_
diff --git a/chrome/default_plugin/plugin_impl_mac.h b/chrome/default_plugin/plugin_impl_mac.h
deleted file mode 100644
index e7b6eb7..0000000
--- a/chrome/default_plugin/plugin_impl_mac.h
+++ /dev/null
@@ -1,295 +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.
-
-#ifndef CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_MAC_H_
-#define CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_MAC_H_
-#pragma once
-
-#include <string>
-
-#include "chrome/default_plugin/plugin_installer_base.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "ui/gfx/native_widget_types.h"
-
-#ifdef __OBJC__
-@class NSImage;
-@class NSString;
-#else
-class NSImage;
-class NSString;
-#endif
-
-// Possible plugin installer states.
-enum PluginInstallerState {
- PluginInstallerStateUndefined,
- PluginListDownloadInitiated,
- PluginListDownloaded,
- PluginListDownloadedPluginNotFound,
- PluginListDownloadFailed,
- PluginDownloadInitiated,
- PluginDownloadCompleted,
- PluginDownloadFailed,
- PluginInstallerLaunchSuccess,
- PluginInstallerLaunchFailure
-};
-
-// Provides the plugin installation functionality. This class is
-// instantiated with the information like the mime type of the
-// target plugin, the display mode, etc.
-class PluginInstallerImpl : public PluginInstallerBase {
- public:
- // mode is the plugin instantiation mode, i.e. whether it is a full
- // page plugin (NP_FULL) or an embedded plugin (NP_EMBED)
- explicit PluginInstallerImpl(int16 mode);
- virtual ~PluginInstallerImpl();
-
- // Initializes the plugin with the instance information, mime type
- // and the list of parameters passed down to the plugin from the webpage.
- //
- // Parameters:
- // module_handle
- // The handle to the dll in which this object is instantiated.
- // instance
- // The plugins opaque instance handle.
- // mime_type
- // Identifies the third party plugin which would be eventually installed.
- // argc
- // Indicates the count of arguments passed in from the webpage.
- // argv
- // Pointer to the arguments.
- // Returns true on success.
- bool Initialize(void* module_handle, NPP instance, NPMIMEType mime_type,
- int16 argc, char* argn[], char* argv[]);
-
- // Informs the plugin of its window information.
- //
- // Parameters:
- // window_info
- // The window info passed to npapi.
- bool NPP_SetWindow(NPWindow* window_info);
-
- // Destroys the install dialog.
- void Shutdown();
-
- // Starts plugin download. Spawns the plugin installer after it is
- // downloaded.
- void DownloadPlugin();
-
- // Indicates that the plugin download was cancelled.
- void DownloadCancelled();
-
- // Initializes the plugin download stream.
- //
- // Parameters:
- // stream
- // Pointer to the new stream being created.
- void NewStream(NPStream* stream);
-
- // Uninitializes the plugin download stream.
- //
- // Parameters:
- // stream
- // Pointer to the stream being destroyed.
- // reason
- // Indicates why the stream is being destroyed.
- //
- void DestroyStream(NPStream* stream, NPError reason);
-
- // Determines whether the plugin is ready to accept data.
- // We only accept data when we have initiated a download for the plugin
- // database.
- //
- // Parameters:
- // stream
- // Pointer to the stream being destroyed.
- // Returns true if the plugin is ready to accept data.
- bool WriteReady(NPStream* stream);
-
- // Delivers data to the plugin instance.
- //
- // Parameters:
- // stream
- // Pointer to the stream being destroyed.
- // offset
- // Indicates the data offset.
- // buffer_length
- // Indicates the length of the data buffer.
- // buffer
- // Pointer to the actual buffer.
- // Returns the number of bytes actually written, 0 on error.
- int32 Write(NPStream* stream, int32 offset, int32 buffer_length,
- void* buffer);
-
- // Handles notifications received in response to GetURLNotify calls issued
- // by the plugin.
- //
- // Parameters:
- // url
- // Pointer to the URL.
- // reason
- // Describes why the notification was sent.
- void URLNotify(const char* url, NPReason reason);
-
- // Used by the renderer to pass events (for e.g. input events) to the plugin.
- int16 NPP_HandleEvent(void* event);
-
- const std::string& mime_type() const { return mime_type_; }
-
- // Replaces a resource string with the placeholder passed in as an argument
- //
- // Parameters:
- // message_id_with_placeholders
- // The resource id of the string with placeholders. This is only used if
- // the placeholder string (the replacement_string) parameter is valid.
- // message_id_without_placeholders
- // The resource id of the string to be returned if the placeholder is
- // empty.
- // replacement_string
- // The placeholder which replaces tokens in the string identified by
- // resource id message_id_with_placeholders.
- // Returns a string which has the placeholders replaced, or the string
- // without placeholders.
- static std::wstring ReplaceStringForPossibleEmptyReplacement(
- int message_id_with_placeholders, int message_id_without_placeholders,
- const std::wstring& replacement_string);
-
- // Setter/getter combination to set and retreieve the current
- // state of the plugin installer.
- void set_plugin_installer_state(PluginInstallerState new_state) {
- plugin_installer_state_ = new_state;
- }
-
- PluginInstallerState plugin_installer_state() const {
- return plugin_installer_state_;
- }
-
- // Getter for the NPP instance member.
- NPP instance() const {
- return instance_;
- }
-
- // Returns whether or not the UI layout is right-to-left (such as Hebrew or
- // Arabic).
- bool IsRTLLayout() const;
-
- protected:
- int16 OnDrawRect(CGContextRef context, CGRect dirty_rect);
-
- // Displays the plugin install confirmation dialog.
- void ShowInstallDialog();
-
- // Clears the current display state.
- void ClearDisplay();
-
- // Displays the status message identified by the message resource id
- // passed in.
- //
- // Parameters:
- // message_resource_id parameter
- // The resource id of the message to be displayed.
- void DisplayStatus(int message_resource_id);
-
- // Displays status information for the third party plugin which is needed
- // by the page.
- void DisplayAvailablePluginStatus();
-
- // Displays information related to third party plugin download failure.
- void DisplayPluginDownloadFailedStatus();
-
- // Enables the plugin window if required and initiates an update of the
- // the plugin window.
- void RefreshDisplay();
-
- // Create tooltip window.
- bool CreateToolTip();
-
- // Update ToolTip text with the message shown inside the default plugin.
- void UpdateToolTip();
-
- // Resolves the relative URL (could be already an absolute URL too) to return
- // full URL based on current document's URL and base.
- //
- // Parameters:
- // instance
- // The plugins opaque instance handle.
- // relative_url
- // The URL to be resolved.
- // Returns the resolved URL.
- std::string ResolveURL(NPP instance, const std::string& relative_url);
-
- // Initializes resources like the icon, fonts, etc needed by the plugin
- // installer
- //
- // Parameters:
- // module_handle
- // Handle to the dll in which this object is instantiated.
- // Returns true on success.
- bool InitializeResources(void *module_handle);
-
- // Parses the plugin instantiation arguments. This includes checking for
- // whether this is an activex install and reading the appropriate
- // arguments like codebase, etc. For plugin installs we download the
- // plugin finder URL and initalize the mime type and the plugin instance
- // info.
- //
- // Parameters:
- // module_handle
- // The handle to the dll in which this object is instantiated.
- // instance
- // The plugins opaque instance handle.
- // mime_type
- // Identifies the third party plugin which would be eventually installed.
- // argc
- // Indicates the count of arguments passed in from the webpage.
- // argv
- // Pointer to the arguments.
- // raw_activex_clsid
- // Output parameter which contains the CLSID of the Activex plugin needed.
- // This is only applicable if the webpage specifically requests an ActiveX
- // control.
- // Returns true on success.
- bool ParseInstantiationArguments(NPMIMEType mime_type, NPP instance,
- int16 argc, char* argn[], char* argv[],
- std::string* raw_activex_clsid);
-
- // Paints user action messages to the plugin window. These include messages
- // like whether the user should click on the plugin window to download the
- // plugin, etc.
- //
- // Parameters:
- // paint_dc
- // The device context returned in BeginPaint.
- // x_origin
- // Horizontal reference point indicating where the text is to be displayed.
- // y_origin
- // Vertical reference point indicating where the text is to be displayed.
- //
- void PaintUserActionInformation(gfx::NativeDrawingContext paint_dc,
- int x_origin, int y_origin);
-
- private:
- // Notify the renderer that plugin is available to download.
- void NotifyPluginStatus(int status);
-
- // The plugins opaque instance handle
- NPP instance_;
- // The current stream.
- NPStream* plugin_install_stream_;
- // The desired mime type.
- std::string mime_type_;
- // The current state of the plugin installer.
- PluginInstallerState plugin_installer_state_;
- // Dimensions of the plugin
- uint32_t width_;
- uint32_t height_;
- // Plugin icon, weak (owned by ResourceBundle).
- NSImage* image_;
- // Displayed text
- NSString* command_;
-
- DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl);
-};
-
-
-#endif // CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_MAC_H_
diff --git a/chrome/default_plugin/plugin_impl_mac.mm b/chrome/default_plugin/plugin_impl_mac.mm
deleted file mode 100644
index 36a7dfd..0000000
--- a/chrome/default_plugin/plugin_impl_mac.mm
+++ /dev/null
@@ -1,204 +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 "chrome/default_plugin/plugin_impl_mac.h"
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/file_util.h"
-#include "base/path_service.h"
-#include "base/string_util.h"
-#include "chrome/common/chrome_plugin_messages.h"
-#include "chrome/default_plugin/plugin_main.h"
-#include "content/common/child_thread.h"
-#include "googleurl/src/gurl.h"
-#include "grit/default_plugin_resources.h"
-#include "grit/webkit_strings.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/l10n/l10n_util_mac.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/image/image.h"
-#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
-#include "unicode/locid.h"
-#include "webkit/glue/webkit_glue.h"
-#include "webkit/plugins/npapi/default_plugin_shared.h"
-
-// TODO(thakis): Most methods in this class are stubbed out and need to be
-// implemented.
-
-PluginInstallerImpl::PluginInstallerImpl(int16 mode)
- : image_(nil),
- command_(nil) {
-}
-
-PluginInstallerImpl::~PluginInstallerImpl() {
- [command_ release];
-}
-
-bool PluginInstallerImpl::Initialize(void* module_handle, NPP instance,
- NPMIMEType mime_type, int16 argc,
- char* argn[], char* argv[]) {
- DVLOG(1) << __FUNCTION__ << " MIME Type : " << mime_type;
- DCHECK(instance != NULL);
-
- if (mime_type == NULL || strlen(mime_type) == 0) {
- DLOG(WARNING) << __FUNCTION__ << " Invalid parameters passed in";
- NOTREACHED();
- return false;
- }
-
- instance_ = instance;
- mime_type_ = mime_type;
-
- command_ = [l10n_util::FixUpWindowsStyleLabel(l10n_util::GetStringUTF16(
- IDS_DEFAULT_PLUGIN_NO_PLUGIN_AVAILABLE_MSG)) retain];
-
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- image_ = rb.GetNativeImageNamed(IDR_PLUGIN_ICON);
-
- PluginInstallerBase::SetRoutingIds(argc, argn, argv);
- return true;
-}
-
-bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) {
- width_ = window_info->width;
- height_ = window_info->height;
- return true;
-}
-
-void PluginInstallerImpl::Shutdown() {
-}
-
-void PluginInstallerImpl::NewStream(NPStream* stream) {
- plugin_install_stream_ = stream;
-}
-
-void PluginInstallerImpl::DestroyStream(NPStream* stream, NPError reason) {
- if (stream == plugin_install_stream_)
- plugin_install_stream_ = NULL;
-}
-
-bool PluginInstallerImpl::WriteReady(NPStream* stream) {
- bool ready_to_accept_data = false;
- return ready_to_accept_data;
-}
-
-int32 PluginInstallerImpl::Write(NPStream* stream, int32 offset,
- int32 buffer_length, void* buffer) {
- return true;
-}
-
-void PluginInstallerImpl::ClearDisplay() {
-}
-
-void PluginInstallerImpl::RefreshDisplay() {
-}
-
-bool PluginInstallerImpl::CreateToolTip() {
- return true;
-}
-
-void PluginInstallerImpl::UpdateToolTip() {
-}
-
-void PluginInstallerImpl::DisplayAvailablePluginStatus() {
-}
-
-void PluginInstallerImpl::DisplayStatus(int message_resource_id) {
-}
-
-void PluginInstallerImpl::DisplayPluginDownloadFailedStatus() {
-}
-
-void PluginInstallerImpl::URLNotify(const char* url, NPReason reason) {
-}
-
-int16 PluginInstallerImpl::NPP_HandleEvent(void* event) {
- NPCocoaEvent* npp_event = static_cast<NPCocoaEvent*>(event);
-
- if (npp_event->type == NPCocoaEventDrawRect) {
- CGContextRef context = npp_event->data.draw.context;
- CGRect rect = CGRectMake(npp_event->data.draw.x,
- npp_event->data.draw.y,
- npp_event->data.draw.width,
- npp_event->data.draw.height);
- return OnDrawRect(context, rect);
- }
- return 0;
-}
-
-std::wstring PluginInstallerImpl::ReplaceStringForPossibleEmptyReplacement(
- int message_id_with_placeholders,
- int messsage_id_without_placeholders,
- const std::wstring& replacement_string) {
- return L"";
-}
-
-void PluginInstallerImpl::DownloadPlugin() {
-}
-
-void PluginInstallerImpl::DownloadCancelled() {
- DisplayAvailablePluginStatus();
-}
-
-int16 PluginInstallerImpl::OnDrawRect(CGContextRef context, CGRect dirty_rect) {
- gfx::ScopedNSGraphicsContextSaveGState scoped_state;
- NSGraphicsContext* ns_context = [NSGraphicsContext
- graphicsContextWithGraphicsPort:context flipped:YES];
- [NSGraphicsContext setCurrentContext:ns_context];
-
- // Fill background.
- NSColor* bg_color = [NSColor colorWithCalibratedRed:252 / 255.0
- green:235 / 255.0
- blue:162 / 255.0
- alpha:1.0];
- [bg_color setFill];
- NSRectFill(NSRectFromCGRect(dirty_rect));
-
- [[NSColor blackColor] set];
- NSFrameRect(NSMakeRect(0, 0, width_, height_));
-
- // Drag image.
- DCHECK(image_);
- if (image_) {
- NSPoint point = NSMakePoint((width_ - [image_ size].width) / 2,
- (height_ + [image_ size].height) / 2);
- [image_ dissolveToPoint:point fraction:1.0];
- }
-
- // Draw text.
- NSShadow* shadow = [[[NSShadow alloc] init] autorelease];
- [shadow setShadowColor:[NSColor colorWithDeviceWhite:1.0 alpha:0.5]];
- [shadow setShadowOffset:NSMakeSize(0, -1)];
- NSFont* font = [NSFont systemFontOfSize:
- [NSFont systemFontSizeForControlSize:NSSmallControlSize]];
- NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:
- font, NSFontAttributeName,
- [NSColor blackColor], NSForegroundColorAttributeName,
- shadow, NSShadowAttributeName,
- nil];
-
- NSSize text_size = [command_ sizeWithAttributes:attributes];
- NSPoint label_point = NSMakePoint((width_ - text_size.width) / 2,
- (height_ - text_size.height) / 2);
- if (image_)
- label_point.y += [image_ size].height / 2 + text_size.height / 2 + 10;
- label_point = NSMakePoint(roundf(label_point.x), roundf(label_point.y));
- [command_ drawAtPoint:label_point withAttributes:attributes];
-
- return 1;
-}
-
-
-void PluginInstallerImpl::ShowInstallDialog() {
-}
-
-void PluginInstallerImpl::NotifyPluginStatus(int status) {
- ChildThread::current()->Send(
- new ChromePluginProcessHostMsg_MissingPluginStatus(
- status,
- renderer_process_id(),
- render_view_id(),
- 0));
-}
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc
index 55fcb25..835e49e 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc
+++ b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc
@@ -26,7 +26,6 @@
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/glue/webkit_glue.h"
-#include "webkit/plugins/npapi/default_plugin_shared.h"
#include "webkit/plugins/npapi/plugin_constants_win.h"
#include "webkit/plugins/npapi/plugin_group.h"
#include "webkit/plugins/npapi/plugin_instance.h"