| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "webkit/default_plugin/plugin_impl_gtk.h" |
| 6 |
| 7 #include <gdk/gdkx.h> |
| 8 |
| 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" |
| 11 #include "base/string_util.h" |
| 12 #include "googleurl/src/gurl.h" |
| 13 #include "grit/webkit_strings.h" |
| 14 #include "unicode/locid.h" |
| 15 #include "webkit/default_plugin/default_plugin_shared.h" |
| 16 #include "webkit/default_plugin/plugin_main.h" |
| 17 #include "webkit/glue/webkit_glue.h" |
| 18 |
| 19 // TODO(thakis): Most methods in this class are stubbed out an need to be |
| 20 // implemented. |
| 21 |
| 22 PluginInstallerImpl::PluginInstallerImpl(int16 mode) |
| 23 : container_(NULL) { |
| 24 } |
| 25 |
| 26 PluginInstallerImpl::~PluginInstallerImpl() { |
| 27 if (container_) |
| 28 gtk_widget_destroy(container_); |
| 29 } |
| 30 |
| 31 bool PluginInstallerImpl::Initialize(void* module_handle, NPP instance, |
| 32 NPMIMEType mime_type, int16 argc, |
| 33 char* argn[], char* argv[]) { |
| 34 DLOG(INFO) << __FUNCTION__ << " MIME Type : " << mime_type; |
| 35 DCHECK(instance != NULL); |
| 36 |
| 37 if (mime_type == NULL || strlen(mime_type) == 0) { |
| 38 DLOG(WARNING) << __FUNCTION__ << " Invalid parameters passed in"; |
| 39 NOTREACHED(); |
| 40 return false; |
| 41 } |
| 42 |
| 43 instance_ = instance; |
| 44 mime_type_ = mime_type; |
| 45 |
| 46 return true; |
| 47 } |
| 48 |
| 49 bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) { |
| 50 if (container_) |
| 51 gtk_widget_destroy(container_); |
| 52 container_ = gtk_plug_new(reinterpret_cast<XID>(window_info->window)); |
| 53 |
| 54 // Add label. |
| 55 GtkWidget* box = gtk_vbox_new(FALSE, 0); |
| 56 GtkWidget* label = gtk_label_new("Missing Plug-in"); |
| 57 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 0); |
| 58 gtk_container_add(GTK_CONTAINER(container_), box); |
| 59 |
| 60 gtk_widget_show_all(container_); |
| 61 |
| 62 return true; |
| 63 } |
| 64 |
| 65 void PluginInstallerImpl::Shutdown() { |
| 66 } |
| 67 |
| 68 void PluginInstallerImpl::NewStream(NPStream* stream) { |
| 69 plugin_install_stream_ = stream; |
| 70 } |
| 71 |
| 72 void PluginInstallerImpl::DestroyStream(NPStream* stream, NPError reason) { |
| 73 if (stream == plugin_install_stream_) |
| 74 plugin_install_stream_ = NULL; |
| 75 } |
| 76 |
| 77 bool PluginInstallerImpl::WriteReady(NPStream* stream) { |
| 78 bool ready_to_accept_data = false; |
| 79 return ready_to_accept_data; |
| 80 } |
| 81 |
| 82 int32 PluginInstallerImpl::Write(NPStream* stream, int32 offset, |
| 83 int32 buffer_length, void* buffer) { |
| 84 return true; |
| 85 } |
| 86 |
| 87 void PluginInstallerImpl::ClearDisplay() { |
| 88 } |
| 89 |
| 90 void PluginInstallerImpl::RefreshDisplay() { |
| 91 } |
| 92 |
| 93 bool PluginInstallerImpl::CreateToolTip() { |
| 94 return true; |
| 95 } |
| 96 |
| 97 void PluginInstallerImpl::UpdateToolTip() { |
| 98 } |
| 99 |
| 100 void PluginInstallerImpl::DisplayAvailablePluginStatus() { |
| 101 } |
| 102 |
| 103 void PluginInstallerImpl::DisplayStatus(int message_resource_id) { |
| 104 } |
| 105 |
| 106 void PluginInstallerImpl::DisplayPluginDownloadFailedStatus() { |
| 107 } |
| 108 |
| 109 void PluginInstallerImpl::URLNotify(const char* url, NPReason reason) { |
| 110 } |
| 111 |
| 112 int16 PluginInstallerImpl::NPP_HandleEvent(void* event) { |
| 113 return 0; |
| 114 } |
| 115 |
| 116 std::wstring PluginInstallerImpl::ReplaceStringForPossibleEmptyReplacement( |
| 117 int message_id_with_placeholders, |
| 118 int messsage_id_without_placeholders, |
| 119 const std::wstring& replacement_string) { |
| 120 return L""; |
| 121 } |
| 122 |
| 123 void PluginInstallerImpl::DownloadPlugin() { |
| 124 } |
| 125 |
| 126 void PluginInstallerImpl::DownloadCancelled() { |
| 127 DisplayAvailablePluginStatus(); |
| 128 } |
| 129 |
| 130 void PluginInstallerImpl::ShowInstallDialog() { |
| 131 } |
| 132 |
| 133 void PluginInstallerImpl::NotifyPluginStatus(int status) { |
| 134 default_plugin::g_browser->getvalue( |
| 135 instance_, |
| 136 static_cast<NPNVariable>( |
| 137 default_plugin::kMissingPluginStatusStart + status), |
| 138 NULL); |
| 139 } |
| OLD | NEW |