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