diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-26 22:23:10 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-26 22:23:10 +0000 |
commit | 118586fd1b8e8a40e22f96dede6aef21d2101a65 (patch) | |
tree | 50b2552fcfbd690f5ba47cb1dbbf648a10072241 /webkit/default_plugin/plugin_impl_gtk.cc | |
parent | 0d3a07fe3b5ab17fca5bdd3b60a32593ac7ffff1 (diff) | |
download | chromium_src-118586fd1b8e8a40e22f96dede6aef21d2101a65.zip chromium_src-118586fd1b8e8a40e22f96dede6aef21d2101a65.tar.gz chromium_src-118586fd1b8e8a40e22f96dede6aef21d2101a65.tar.bz2 |
Part 1 of http://codereview.chromium.org/2079016
BUG=10952
Review URL: http://codereview.chromium.org/2295001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48337 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/default_plugin/plugin_impl_gtk.cc')
-rw-r--r-- | webkit/default_plugin/plugin_impl_gtk.cc | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/webkit/default_plugin/plugin_impl_gtk.cc b/webkit/default_plugin/plugin_impl_gtk.cc new file mode 100644 index 0000000..cfc599a --- /dev/null +++ b/webkit/default_plugin/plugin_impl_gtk.cc @@ -0,0 +1,139 @@ +// Copyright (c) 2010 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 "webkit/default_plugin/plugin_impl_gtk.h" + +#include <gdk/gdkx.h> + +#include "base/file_util.h" +#include "base/path_service.h" +#include "base/string_util.h" +#include "googleurl/src/gurl.h" +#include "grit/webkit_strings.h" +#include "unicode/locid.h" +#include "webkit/default_plugin/default_plugin_shared.h" +#include "webkit/default_plugin/plugin_main.h" +#include "webkit/glue/webkit_glue.h" + +// TODO(thakis): Most methods in this class are stubbed out an need to be +// implemented. + +PluginInstallerImpl::PluginInstallerImpl(int16 mode) + : 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[]) { + DLOG(INFO) << __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; + + 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) { + default_plugin::g_browser->getvalue( + instance_, + static_cast<NPNVariable>( + default_plugin::kMissingPluginStatusStart + status), + NULL); +} |