diff options
-rw-r--r-- | chrome/plugin/plugin_thread.cc | 5 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 4 | ||||
-rw-r--r-- | webkit/default_plugin/default_plugin.gyp | 45 | ||||
-rw-r--r-- | webkit/default_plugin/plugin_impl_mac.h | 68 | ||||
-rw-r--r-- | webkit/default_plugin/plugin_impl_mac.mm | 179 | ||||
-rw-r--r-- | webkit/default_plugin/plugin_impl_win.cc | 5 | ||||
-rw-r--r-- | webkit/default_plugin/plugin_impl_win.h | 6 | ||||
-rw-r--r-- | webkit/default_plugin/plugin_main.cc | 63 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list.cc | 2 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.gypi | 2 |
10 files changed, 87 insertions, 292 deletions
diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc index 0920c7c..e74e95e 100644 --- a/chrome/plugin/plugin_thread.cc +++ b/chrome/plugin/plugin_thread.cc @@ -207,11 +207,14 @@ bool GetPluginFinderURL(std::string* plugin_finder_url) { } bool IsDefaultPluginEnabled() { -#if defined(OS_WIN) || defined(OS_MACOSX) +#if defined(OS_WIN) return true; #elif defined(OS_LINUX) // http://code.google.com/p/chromium/issues/detail?id=10952 return false; +#elif defined(OS_MACOSX) + // http://code.google.com/p/chromium/issues/detail?id=17392 + return false; #endif } diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 52d50c3..82c4775 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -1533,9 +1533,7 @@ void RenderView::OnMissingPluginStatus( } } #else - // TODO(port): Implement the infobar that accompanies the default plugin. - // Linux: http://crbug.com/10952 - // Mac: http://crbug.com/17392 + // TODO(port): plugins current not supported NOTIMPLEMENTED(); #endif } diff --git a/webkit/default_plugin/default_plugin.gyp b/webkit/default_plugin/default_plugin.gyp index 4092a2e..10450d6 100644 --- a/webkit/default_plugin/default_plugin.gyp +++ b/webkit/default_plugin/default_plugin.gyp @@ -3,13 +3,10 @@ # found in the LICENSE file. { - 'variables': { - 'chromium_code': 1, - }, 'targets': [ ], 'conditions': [ - ['OS=="win" or OS=="mac"', { + ['OS=="win"', { 'targets': [ { 'target_name': 'default_plugin', @@ -20,6 +17,8 @@ '../../third_party/icu/icu.gyp:icuuc', '../../third_party/libxml/libxml.gyp:libxml', '../../third_party/npapi/npapi.gyp:npapi', + '../support/webkit_support.gyp:webkit_resources', + '../support/webkit_support.gyp:webkit_strings', ], 'include_dirs': [ '../..', @@ -27,42 +26,28 @@ # TODO(bradnelson): this should fall out of the dependencies. '<(SHARED_INTERMEDIATE_DIR)/webkit', ], + 'msvs_guid': '5916D37D-8C97-424F-A904-74E52594C2D6', 'sources': [ 'default_plugin.cc', + 'default_plugin_resources.h', 'default_plugin_shared.h', - 'plugin_impl_mac.h', - 'plugin_impl_mac.mm', + 'install_dialog.cc', + 'install_dialog.h', + 'plugin_database_handler.cc', + 'plugin_database_handler.h', 'plugin_impl_win.cc', 'plugin_impl_win.h', + 'plugin_install_job_monitor.cc', + 'plugin_install_job_monitor.h', 'plugin_main.cc', 'plugin_main.h', ], - 'conditions': [ - ['OS=="win"', { - 'dependencies': [ - # TODO(thakis): These throw a CircularException on mac. - # Figure out why once they're needed. - '../support/webkit_support.gyp:webkit_resources', - '../support/webkit_support.gyp:webkit_strings', - ], - 'msvs_guid': '5916D37D-8C97-424F-A904-74E52594C2D6', - 'link_settings': { - 'libraries': ['-lurlmon.lib'], - }, - 'sources': [ - 'default_plugin_resources.h', - 'install_dialog.cc', - 'install_dialog.h', - 'plugin_database_handler.cc', - 'plugin_database_handler.h', - 'plugin_install_job_monitor.cc', - 'plugin_install_job_monitor.h', - ], - }], - ], + 'link_settings': { + 'libraries': ['-lurlmon.lib'], + }, }, ], - }], + },], ], } diff --git a/webkit/default_plugin/plugin_impl_mac.h b/webkit/default_plugin/plugin_impl_mac.h index 96686a3..bd9cd77 100644 --- a/webkit/default_plugin/plugin_impl_mac.h +++ b/webkit/default_plugin/plugin_impl_mac.h @@ -9,7 +9,9 @@ #include <vector> #include "third_party/npapi/bindings/npapi.h" -#include "gfx/native_widget_types.h" +// #include "webkit/default_plugin/install_dialog.h" +// #include "webkit/default_plugin/plugin_database_handler.h" +// #include "webkit/default_plugin/plugin_install_job_monitor.h" // Possible plugin installer states. enum PluginInstallerState { @@ -56,14 +58,14 @@ class PluginInstallerImpl { bool Initialize(void *module_handle, NPP instance, NPMIMEType mime_type, int16 argc, char* argn[], char* argv[]); - // Informs the plugin of its window information. + // Displays the default plugin UI. // // Parameters: - // window_info - // The window info passed to npapi. - bool NPP_SetWindow(NPWindow* window_info); + // parent_window + // Handle to the parent window. + bool SetWindow(gfx::NativeView parent_view); - // Destroys the install dialog. + // Destroys the install dialog and the plugin window. void Shutdown(); // Starts plugin download. Spawns the plugin installer after it is @@ -125,9 +127,7 @@ class PluginInstallerImpl { // Describes why the notification was sent. void URLNotify(const char* url, NPReason reason); - // Used by the renderer to indicate plugin install through the infobar. - int16 NPP_HandleEvent(void* event); - + // gfx::NativeView window() const { return m_hWnd; } const std::string& mime_type() const { return mime_type_; } // Replaces a resource string with the placeholder passed in as an argument @@ -168,8 +168,6 @@ class PluginInstallerImpl { bool IsRTLLayout() const; protected: - int16 OnDrawRect(CGContextRef context, CGRect dirty_rect); - // Displays the plugin install confirmation dialog. void ShowInstallDialog(); @@ -268,15 +266,57 @@ class PluginInstallerImpl { // The plugins opaque instance handle NPP instance_; + // If this is to install activex + bool is_activex_; + // The plugin instantiation mode (NP_FULL or NP_EMBED) + int16 mode_; + // The handle to the icon displayed in the plugin installation window. + // HICON icon_; + // The Get plugin link message string displayed at the top left corner of + // the plugin window. + std::wstring get_plugin_link_message_; + // The command string displayed in the plugin installation window. + std::wstring command_; + // An additional message displayed at times by the plugin. + std::wstring optional_additional_message_; // The current stream. NPStream* plugin_install_stream_; + // The plugin finder URL. + std::string plugin_finder_url_; // The desired mime type. std::string mime_type_; + // The desired language. + std::string desired_language_; + // The plugin name. + std::wstring plugin_name_; + // The actual download URL. + std::string plugin_download_url_; + // Indicates if the plugin download URL points to an exe. + bool plugin_download_url_for_display_; // The current state of the plugin installer. PluginInstallerState plugin_installer_state_; - // Dimensions of the plugin - uint32_t width_; - uint32_t height_; + // Used to display the UI for plugin installation. + // PluginInstallDialog install_dialog_; + // To enable auto refresh of the plugin window once the installation + // is complete, we spawn the installation process in a job, and monitor + // IO completion events on the job. When the active process count of the + // job falls to zero, we initiate an auto refresh of the plugin list + // which enables the downloaded plugin to be instantiated. + // The completion events from the job are monitored in an independent + // thread. + // scoped_refptr<PluginInstallationJobMonitorThread> + // installation_job_monitor_thread_; + // This object handles download and parsing of the plugins database. + // PluginDatabaseHandler plugin_database_handler_; + // Indicates if the left click to download/refresh should be enabled or not. + bool enable_click_; + // Handles to the fonts used to display text in the plugin window. + // HFONT bold_font_; + // HFONT regular_font_; + // HFONT underline_font_; + // Tooltip Window. + gfx::NativeWindow tooltip_; + DISALLOW_EVIL_CONSTRUCTORS(PluginInstallerImpl); }; diff --git a/webkit/default_plugin/plugin_impl_mac.mm b/webkit/default_plugin/plugin_impl_mac.mm deleted file mode 100644 index 290fa1c..0000000 --- a/webkit/default_plugin/plugin_impl_mac.mm +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) 2006-2009 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_mac.h" - -#import <Cocoa/Cocoa.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 and need to be -// implemented. - -PluginInstallerImpl::PluginInstallerImpl(int16 mode) { -} - -PluginInstallerImpl::~PluginInstallerImpl() { -} - -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) { - 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) { - const NSString* text = @"Missing Plug-in"; - const float kTextMarginX = 6; - const float kTextMarginY = 1; - NSSize bounds = NSMakeSize(width_, height_); - - [NSGraphicsContext saveGraphicsState]; - NSGraphicsContext* ns_context = [NSGraphicsContext - graphicsContextWithGraphicsPort:context flipped:YES]; - [NSGraphicsContext setCurrentContext:ns_context]; - - NSShadow* shadow = [[[NSShadow alloc] init] autorelease]; - [shadow setShadowColor:[NSColor colorWithDeviceWhite:0.0 alpha:0.5]]; - [shadow setShadowOffset:NSMakeSize(0, -1)]; - NSFont* font = [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]]; - NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys: - font, NSFontAttributeName, - [NSColor whiteColor], NSForegroundColorAttributeName, - shadow, NSShadowAttributeName, - nil]; - - NSSize text_size = [text sizeWithAttributes:attributes]; - NSRect text_rect; - text_rect.size.width = text_size.width + 2*kTextMarginX; - text_rect.size.height = text_size.height + 2*kTextMarginY; - text_rect.origin.x = (bounds.width - NSWidth(text_rect))/2; - text_rect.origin.y = (bounds.height - NSHeight(text_rect))/2; - - [[NSColor colorWithCalibratedWhite:0.52 alpha:1.0] setFill]; - [[NSBezierPath bezierPathWithRoundedRect:text_rect - xRadius:NSHeight(text_rect)/2 - yRadius:NSHeight(text_rect)/2] fill]; - - NSPoint label_point = NSMakePoint( - roundf(text_rect.origin.x + (text_rect.size.width - text_size.width)/2), - roundf(text_rect.origin.y + (text_rect.size.height - text_size.height)/2)); - [text drawAtPoint:label_point withAttributes:attributes]; - - [NSGraphicsContext restoreGraphicsState]; - return 1; -} - - -void PluginInstallerImpl::ShowInstallDialog() { -} - -void PluginInstallerImpl::NotifyPluginStatus(int status) { - default_plugin::g_browser->getvalue( - instance_, - static_cast<NPNVariable>( - default_plugin::kMissingPluginStatusStart + status), - NULL); -} diff --git a/webkit/default_plugin/plugin_impl_win.cc b/webkit/default_plugin/plugin_impl_win.cc index 4920240..2a62a1c 100644 --- a/webkit/default_plugin/plugin_impl_win.cc +++ b/webkit/default_plugin/plugin_impl_win.cc @@ -52,7 +52,7 @@ PluginInstallerImpl::~PluginInstallerImpl() { bool PluginInstallerImpl::Initialize(HINSTANCE module_handle, NPP instance, NPMIMEType mime_type, int16 argc, char* argn[], char* argv[]) { - DLOG(INFO) << __FUNCTION__ << " MIME Type : " << mime_type; + DLOG(INFO) << __FUNCTION__ << " Mime Type : " << mime_type; DCHECK(instance != NULL); DCHECK(module_handle != NULL); @@ -287,8 +287,7 @@ std::wstring PluginInstallerImpl::ReplaceStringForPossibleEmptyReplacement( } } -bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) { - HWND parent_window = reinterpret_cast<HWND>(window_info->window); +bool PluginInstallerImpl::SetWindow(HWND parent_window) { if (!IsWindow(parent_window)) { // No window created yet. Ignore this call. if (!IsWindow(hwnd())) diff --git a/webkit/default_plugin/plugin_impl_win.h b/webkit/default_plugin/plugin_impl_win.h index bc110ec..c1aa535 100644 --- a/webkit/default_plugin/plugin_impl_win.h +++ b/webkit/default_plugin/plugin_impl_win.h @@ -74,9 +74,9 @@ class PluginInstallerImpl : public app::WindowImpl { // Displays the default plugin UI. // // Parameters: - // window_info - // The window info passed to npapi. - bool NPP_SetWindow(NPWindow* window_info); + // parent_window + // Handle to the parent window. + bool SetWindow(HWND parent_window); // Destroys the install dialog and the plugin window. void Shutdown(); diff --git a/webkit/default_plugin/plugin_main.cc b/webkit/default_plugin/plugin_main.cc index a4dacc5..95dda07 100644 --- a/webkit/default_plugin/plugin_main.cc +++ b/webkit/default_plugin/plugin_main.cc @@ -10,8 +10,6 @@ #include "webkit/glue/webkit_glue.h" namespace default_plugin { - -#if defined(OS_WIN) // // Forward declare the linker-provided pseudo variable for the // current module handle. @@ -22,7 +20,6 @@ extern "C" IMAGE_DOS_HEADER __ImageBase; inline HMODULE GetCurrentModuleHandle() { return reinterpret_cast<HINSTANCE>(&__ImageBase); } -#endif // Initialized in NP_Initialize. NPNetscapeFuncs* g_browser = NULL; @@ -74,53 +71,13 @@ void SignalTestResult(NPP instance) { static_cast<unsigned int>(script.length()); NPVariant result_var; - g_browser->evaluate(instance, window_obj, - &script_string, &result_var); + NPError result = g_browser->evaluate(instance, window_obj, + &script_string, &result_var); g_browser->releaseobject(window_obj); } } // namespace CHROMIUM_DefaultPluginTest -bool NegotiateModels(NPP instance) { -#if defined(OS_MACOSX) - NPError err; - // Set drawing model to core graphics - NPBool supportsCoreGraphics = FALSE; - err = g_browser->getvalue(instance, - NPNVsupportsCoreGraphicsBool, - &supportsCoreGraphics); - if (err != NPERR_NO_ERROR || !supportsCoreGraphics) { - NOTREACHED(); - return false; - } - err = g_browser->setvalue(instance, - NPPVpluginDrawingModel, - (void*)NPDrawingModelCoreGraphics); - if (err != NPERR_NO_ERROR) { - NOTREACHED(); - return false; - } - - // Set event model to cocoa - NPBool supportsCocoaEvents = FALSE; - err = g_browser->getvalue(instance, - NPNVsupportsCocoaBool, - &supportsCocoaEvents); - if (err != NPERR_NO_ERROR || !supportsCocoaEvents) { - NOTREACHED(); - return false; - } - err = g_browser->setvalue(instance, - NPPVpluginEventModel, - (void*)NPEventModelCocoa); - if (err != NPERR_NO_ERROR) { - NOTREACHED(); - return false; - } -#endif - return true; -} - NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved) { if (instance == NULL) @@ -138,19 +95,10 @@ NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc, return NPERR_GENERIC_ERROR; } - if (!NegotiateModels(instance)) - return NPERR_INCOMPATIBLE_VERSION_ERROR; - + PluginInstallerImpl* plugin_impl = new PluginInstallerImpl(mode); - plugin_impl->Initialize( -#if defined(OS_WIN) - GetCurrentModuleHandle(), -#else - NULL, -#endif - instance, plugin_type, argc, + plugin_impl->Initialize(GetCurrentModuleHandle(), instance, plugin_type, argc, argn, argv); - instance->pdata = reinterpret_cast<void*>(plugin_impl); return NPERR_NO_ERROR; } @@ -191,7 +139,8 @@ NPError NPP_SetWindow(NPP instance, NPWindow* window_info) { return NPERR_GENERIC_ERROR; } - if (!plugin_impl->NPP_SetWindow(window_info)) { + HWND window_handle = reinterpret_cast<HWND>(window_info->window); + if (!plugin_impl->SetWindow(window_handle)) { delete plugin_impl; return NPERR_GENERIC_ERROR; } diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc index d0a628d..7640b0c63 100644 --- a/webkit/glue/plugins/plugin_list.cc +++ b/webkit/glue/plugins/plugin_list.cc @@ -141,7 +141,7 @@ PluginList::PluginList() : plugins_loaded_(false), plugins_need_refresh_(false) { PlatformInit(); -#if defined(OS_WIN) || defined(OS_MACOSX) +#if defined(OS_WIN) const PluginVersionInfo default_plugin = { FilePath(kDefaultPluginLibraryName), L"Default Plug-in", diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 3c42c6b..f357109 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -366,7 +366,7 @@ 'plugins/plugin_stubs.cc', ], }], - ['inside_chromium_build==1 and (OS=="mac" or OS=="win")', { + ['inside_chromium_build==1 and OS=="win"', { 'dependencies': [ '<(DEPTH)/webkit/default_plugin/default_plugin.gyp:default_plugin', ], |