| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ | 5 #ifndef WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ |
| 6 #define WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ | 6 #define WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ |
| 7 | 7 |
| 8 #include <atlbase.h> |
| 9 #include <atlwin.h> |
| 8 #include <string> | 10 #include <string> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/window_impl.h" | |
| 12 #include "third_party/npapi/bindings/npapi.h" | 13 #include "third_party/npapi/bindings/npapi.h" |
| 13 #include "webkit/default_plugin/install_dialog.h" | 14 #include "webkit/default_plugin/install_dialog.h" |
| 14 #include "webkit/default_plugin/plugin_database_handler.h" | 15 #include "webkit/default_plugin/plugin_database_handler.h" |
| 15 #include "webkit/default_plugin/plugin_install_job_monitor.h" | 16 #include "webkit/default_plugin/plugin_install_job_monitor.h" |
| 16 | 17 |
| 17 // Possible plugin installer states. | 18 // Possible plugin installer states. |
| 18 enum PluginInstallerState { | 19 enum PluginInstallerState { |
| 19 PluginInstallerStateUndefined, | 20 PluginInstallerStateUndefined, |
| 20 PluginListDownloadInitiated, | 21 PluginListDownloadInitiated, |
| 21 PluginListDownloaded, | 22 PluginListDownloaded, |
| 22 PluginListDownloadedPluginNotFound, | 23 PluginListDownloadedPluginNotFound, |
| 23 PluginListDownloadFailed, | 24 PluginListDownloadFailed, |
| 24 PluginDownloadInitiated, | 25 PluginDownloadInitiated, |
| 25 PluginDownloadCompleted, | 26 PluginDownloadCompleted, |
| 26 PluginDownloadFailed, | 27 PluginDownloadFailed, |
| 27 PluginInstallerLaunchSuccess, | 28 PluginInstallerLaunchSuccess, |
| 28 PluginInstallerLaunchFailure | 29 PluginInstallerLaunchFailure |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 class ActiveXInstaller; | 32 class ActiveXInstaller; |
| 32 class PluginInstallDialog; | 33 class PluginInstallDialog; |
| 33 class PluginDatabaseHandler; | 34 class PluginDatabaseHandler; |
| 34 | 35 |
| 35 // Provides the plugin installation functionality. This class is | 36 // Provides the plugin installation functionality. This class is |
| 36 // instantiated with the information like the mime type of the | 37 // instantiated with the information like the mime type of the |
| 37 // target plugin, the display mode, etc. | 38 // target plugin, the display mode, etc. |
| 38 class PluginInstallerImpl : public base::WindowImpl { | 39 class PluginInstallerImpl : public CWindowImpl<PluginInstallerImpl> { |
| 39 public: | 40 public: |
| 40 static const int kRefreshPluginsMessage = WM_APP + 1; | 41 static const int kRefreshPluginsMessage = WM_APP + 1; |
| 41 static const int kInstallMissingPluginMessage = WM_APP + 2; | 42 static const int kInstallMissingPluginMessage = WM_APP + 2; |
| 42 static const int kActivexInstallResult = WM_USER + 74; | 43 static const int kActivexInstallResult = WM_USER + 74; |
| 43 | 44 |
| 44 // mode is the plugin instantiation mode, i.e. whether it is a full | 45 // mode is the plugin instantiation mode, i.e. whether it is a full |
| 45 // page plugin (NP_FULL) or an embedded plugin (NP_EMBED) | 46 // page plugin (NP_FULL) or an embedded plugin (NP_EMBED) |
| 46 explicit PluginInstallerImpl(int16 mode); | 47 explicit PluginInstallerImpl(int16 mode); |
| 47 virtual ~PluginInstallerImpl(); | 48 virtual ~PluginInstallerImpl(); |
| 48 | 49 |
| 49 BEGIN_MSG_MAP_EX(PluginInstallerImpl) | 50 BEGIN_MSG_MAP(PluginInstallerImpl) |
| 50 MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackGround) | 51 MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackGround) |
| 51 MESSAGE_HANDLER(WM_PAINT, OnPaint) | 52 MESSAGE_HANDLER(WM_PAINT, OnPaint) |
| 52 MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) | 53 MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) |
| 53 MESSAGE_HANDLER(kRefreshPluginsMessage, OnRefreshPlugins) | 54 MESSAGE_HANDLER(kRefreshPluginsMessage, OnRefreshPlugins) |
| 54 MESSAGE_HANDLER(WM_COPYDATA, OnCopyData) | 55 MESSAGE_HANDLER(WM_COPYDATA, OnCopyData) |
| 55 MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) | 56 MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) |
| 56 MESSAGE_HANDLER(kActivexInstallResult, OnActiveXInstallResult) | 57 MESSAGE_HANDLER(kActivexInstallResult, OnActiveXInstallResult) |
| 57 END_MSG_MAP() | 58 END_MSG_MAP() |
| 58 | 59 |
| 59 // Initializes the plugin with the instance information, mime type | 60 // Initializes the plugin with the instance information, mime type |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // Describes why the notification was sent. | 144 // Describes why the notification was sent. |
| 144 void URLNotify(const char* url, NPReason reason); | 145 void URLNotify(const char* url, NPReason reason); |
| 145 | 146 |
| 146 // Initiates activex installs if applicable. | 147 // Initiates activex installs if applicable. |
| 147 // Note: The null plugin being a windowed plugin does not have to implement | 148 // Note: The null plugin being a windowed plugin does not have to implement |
| 148 // NPP_HandleEvent. However to handle activex installations, we have this | 149 // NPP_HandleEvent. However to handle activex installations, we have this |
| 149 // hack to allow the renderer to send out a request for installing the | 150 // hack to allow the renderer to send out a request for installing the |
| 150 // activex. | 151 // activex. |
| 151 int16 NPP_HandleEvent(void* event); | 152 int16 NPP_HandleEvent(void* event); |
| 152 | 153 |
| 154 HWND window() const { return m_hWnd; } |
| 153 const std::string& mime_type() const { return mime_type_; } | 155 const std::string& mime_type() const { return mime_type_; } |
| 154 | 156 |
| 155 // Replaces a resource string with the placeholder passed in as an argument | 157 // Replaces a resource string with the placeholder passed in as an argument |
| 156 // | 158 // |
| 157 // Parameters: | 159 // Parameters: |
| 158 // message_id_with_placeholders | 160 // message_id_with_placeholders |
| 159 // The resource id of the string with placeholders. This is only used if | 161 // The resource id of the string with placeholders. This is only used if |
| 160 // the placeholder string (the replacement_string) parameter is valid. | 162 // the placeholder string (the replacement_string) parameter is valid. |
| 161 // message_id_without_placeholders | 163 // message_id_without_placeholders |
| 162 // The resource id of the string to be returned if the placeholder is | 164 // The resource id of the string to be returned if the placeholder is |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 HFONT bold_font_; | 368 HFONT bold_font_; |
| 367 HFONT regular_font_; | 369 HFONT regular_font_; |
| 368 HFONT underline_font_; | 370 HFONT underline_font_; |
| 369 // Tooltip Window. | 371 // Tooltip Window. |
| 370 HWND tooltip_; | 372 HWND tooltip_; |
| 371 // ActiveX related. | 373 // ActiveX related. |
| 372 std::string activex_codebase_; | 374 std::string activex_codebase_; |
| 373 std::string activex_clsid_; | 375 std::string activex_clsid_; |
| 374 CComObject<ActiveXInstaller>* activex_installer_; | 376 CComObject<ActiveXInstaller>* activex_installer_; |
| 375 | 377 |
| 376 DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl); | 378 DISALLOW_EVIL_CONSTRUCTORS(PluginInstallerImpl); |
| 377 }; | 379 }; |
| 378 | 380 |
| 379 | 381 |
| 380 #endif // WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ | 382 #endif // WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ |
| OLD | NEW |