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