OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ | 5 #ifndef CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ |
6 #define CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ | 6 #define CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "chrome/default_plugin/install_dialog.h" | 11 #include "chrome/default_plugin/install_dialog.h" |
12 #include "chrome/default_plugin/plugin_database_handler.h" | 12 #include "chrome/default_plugin/plugin_database_handler.h" |
| 13 #include "chrome/default_plugin/plugin_installer_base.h" |
13 #include "chrome/default_plugin/plugin_install_job_monitor.h" | 14 #include "chrome/default_plugin/plugin_install_job_monitor.h" |
| 15 #include "chrome/default_plugin/plugin_main.h" |
14 #include "third_party/npapi/bindings/npapi.h" | 16 #include "third_party/npapi/bindings/npapi.h" |
15 #include "ui/base/win/window_impl.h" | 17 #include "ui/base/win/window_impl.h" |
| 18 #include "webkit/plugins/npapi/default_plugin_shared.h" |
16 | 19 |
17 // Possible plugin installer states. | 20 // Possible plugin installer states. |
18 enum PluginInstallerState { | 21 enum PluginInstallerState { |
19 PluginInstallerStateUndefined, | 22 PluginInstallerStateUndefined, |
20 PluginListDownloadInitiated, | 23 PluginListDownloadInitiated, |
21 PluginListDownloaded, | 24 PluginListDownloaded, |
22 PluginListDownloadedPluginNotFound, | 25 PluginListDownloadedPluginNotFound, |
23 PluginListDownloadFailed, | 26 PluginListDownloadFailed, |
24 PluginDownloadInitiated, | 27 PluginDownloadInitiated, |
25 PluginDownloadCompleted, | 28 PluginDownloadCompleted, |
26 PluginDownloadFailed, | 29 PluginDownloadFailed, |
27 PluginInstallerLaunchSuccess, | 30 PluginInstallerLaunchSuccess, |
28 PluginInstallerLaunchFailure | 31 PluginInstallerLaunchFailure |
29 }; | 32 }; |
30 | 33 |
31 class PluginInstallDialog; | 34 class PluginInstallDialog; |
32 class PluginDatabaseHandler; | 35 class PluginDatabaseHandler; |
33 | 36 |
34 // Provides the plugin installation functionality. This class is | 37 // Provides the plugin installation functionality. This class is |
35 // instantiated with the information like the mime type of the | 38 // instantiated with the information like the mime type of the |
36 // target plugin, the display mode, etc. | 39 // target plugin, the display mode, etc. |
37 class PluginInstallerImpl : public ui::WindowImpl { | 40 class PluginInstallerImpl : public PluginInstallerBase, |
| 41 public ui::WindowImpl { |
38 public: | 42 public: |
39 static const int kRefreshPluginsMessage = WM_APP + 1; | 43 static const int kRefreshPluginsMessage = WM_APP + 1; |
40 | 44 |
41 // 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 |
42 // page plugin (NP_FULL) or an embedded plugin (NP_EMBED) | 46 // page plugin (NP_FULL) or an embedded plugin (NP_EMBED) |
43 explicit PluginInstallerImpl(int16 mode); | 47 explicit PluginInstallerImpl(int16 mode); |
44 virtual ~PluginInstallerImpl(); | 48 virtual ~PluginInstallerImpl(); |
45 | 49 |
46 BEGIN_MSG_MAP_EX(PluginInstallerImpl) | 50 BEGIN_MSG_MAP_EX(PluginInstallerImpl) |
47 MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackGround) | 51 MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackGround) |
48 MESSAGE_HANDLER(WM_PAINT, OnPaint) | 52 MESSAGE_HANDLER(WM_PAINT, OnPaint) |
49 MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) | 53 MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) |
50 MESSAGE_HANDLER(kRefreshPluginsMessage, OnRefreshPlugins) | 54 MESSAGE_HANDLER(kRefreshPluginsMessage, OnRefreshPlugins) |
51 MESSAGE_HANDLER(WM_COPYDATA, OnCopyData) | 55 MESSAGE_HANDLER(WM_COPYDATA, OnCopyData) |
52 MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) | 56 MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) |
| 57 MESSAGE_HANDLER( |
| 58 webkit::npapi::default_plugin::kInstallMissingPluginMessage, |
| 59 OnInstallPluginMessage) |
53 END_MSG_MAP() | 60 END_MSG_MAP() |
54 | 61 |
55 // Initializes the plugin with the instance information, mime type | 62 // Initializes the plugin with the instance information, mime type |
56 // and the list of parameters passed down to the plugin from the webpage. | 63 // and the list of parameters passed down to the plugin from the webpage. |
57 // | 64 // |
58 // Parameters: | 65 // Parameters: |
59 // module_handle | 66 // module_handle |
60 // The handle to the dll in which this object is instantiated. | 67 // The handle to the dll in which this object is instantiated. |
61 // instance | 68 // instance |
62 // The plugins opaque instance handle. | 69 // The plugins opaque instance handle. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 190 |
184 protected: | 191 protected: |
185 // Window message handlers. | 192 // Window message handlers. |
186 LRESULT OnPaint(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled); | 193 LRESULT OnPaint(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled); |
187 LRESULT OnEraseBackGround(UINT message, WPARAM wparam, LPARAM lparam, | 194 LRESULT OnEraseBackGround(UINT message, WPARAM wparam, LPARAM lparam, |
188 BOOL& handled); | 195 BOOL& handled); |
189 LRESULT OnLButtonDown(UINT message, WPARAM wparam, LPARAM lparam, | 196 LRESULT OnLButtonDown(UINT message, WPARAM wparam, LPARAM lparam, |
190 BOOL& handled); | 197 BOOL& handled); |
191 LRESULT OnSetCursor(UINT message, WPARAM wparam, LPARAM lparam, | 198 LRESULT OnSetCursor(UINT message, WPARAM wparam, LPARAM lparam, |
192 BOOL& handled); | 199 BOOL& handled); |
| 200 // Handles the install plugin message coming from the plugin infobar. |
| 201 LRESULT OnInstallPluginMessage(UINT message, WPARAM wparam, LPARAM lparam, |
| 202 BOOL& handled); |
193 | 203 |
194 // Refreshes the loaded plugin list and reloads the current page. | 204 // Refreshes the loaded plugin list and reloads the current page. |
195 LRESULT OnRefreshPlugins(UINT message, WPARAM wparam, LPARAM lparam, | 205 LRESULT OnRefreshPlugins(UINT message, WPARAM wparam, LPARAM lparam, |
196 BOOL& handled); | 206 BOOL& handled); |
197 | 207 |
198 // Launches the third party plugin installer. This message is | 208 // Launches the third party plugin installer. This message is |
199 // received when the request to download the installer, initiated by | 209 // received when the request to download the installer, initiated by |
200 // plugin completes. | 210 // plugin completes. |
201 LRESULT OnCopyData(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled); | 211 LRESULT OnCopyData(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled); |
202 | 212 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 PluginDatabaseHandler plugin_database_handler_; | 314 PluginDatabaseHandler plugin_database_handler_; |
305 // Indicates if the left click to download/refresh should be enabled or not. | 315 // Indicates if the left click to download/refresh should be enabled or not. |
306 bool enable_click_; | 316 bool enable_click_; |
307 // Handles to the fonts used to display text in the plugin window. | 317 // Handles to the fonts used to display text in the plugin window. |
308 HFONT bold_font_; | 318 HFONT bold_font_; |
309 HFONT regular_font_; | 319 HFONT regular_font_; |
310 HFONT underline_font_; | 320 HFONT underline_font_; |
311 // Tooltip Window. | 321 // Tooltip Window. |
312 HWND tooltip_; | 322 HWND tooltip_; |
313 | 323 |
| 324 // Count of plugin instances. |
| 325 static int instance_count_; |
| 326 |
| 327 // Set to true if the plugin install infobar is to be shown. |
| 328 static bool show_install_infobar_; |
| 329 |
314 DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl); | 330 DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl); |
315 }; | 331 }; |
316 | 332 |
317 | 333 |
318 #endif // CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ | 334 #endif // CHROME_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ |
OLD | NEW |