| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_MAC_H_ | 5 #ifndef WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_MAC_H_ |
| 6 #define WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_MAC_H_ | 6 #define WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_MAC_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "third_party/npapi/bindings/npapi.h" | 11 #include "third_party/npapi/bindings/npapi.h" |
| 12 // #include "webkit/default_plugin/install_dialog.h" | 12 #include "gfx/native_widget_types.h" |
| 13 // #include "webkit/default_plugin/plugin_database_handler.h" | |
| 14 // #include "webkit/default_plugin/plugin_install_job_monitor.h" | |
| 15 | 13 |
| 16 // Possible plugin installer states. | 14 // Possible plugin installer states. |
| 17 enum PluginInstallerState { | 15 enum PluginInstallerState { |
| 18 PluginInstallerStateUndefined, | 16 PluginInstallerStateUndefined, |
| 19 PluginListDownloadInitiated, | 17 PluginListDownloadInitiated, |
| 20 PluginListDownloaded, | 18 PluginListDownloaded, |
| 21 PluginListDownloadedPluginNotFound, | 19 PluginListDownloadedPluginNotFound, |
| 22 PluginListDownloadFailed, | 20 PluginListDownloadFailed, |
| 23 PluginDownloadInitiated, | 21 PluginDownloadInitiated, |
| 24 PluginDownloadCompleted, | 22 PluginDownloadCompleted, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 51 // mime_type | 49 // mime_type |
| 52 // Identifies the third party plugin which would be eventually installed. | 50 // Identifies the third party plugin which would be eventually installed. |
| 53 // argc | 51 // argc |
| 54 // Indicates the count of arguments passed in from the webpage. | 52 // Indicates the count of arguments passed in from the webpage. |
| 55 // argv | 53 // argv |
| 56 // Pointer to the arguments. | 54 // Pointer to the arguments. |
| 57 // Returns true on success. | 55 // Returns true on success. |
| 58 bool Initialize(void *module_handle, NPP instance, NPMIMEType mime_type, | 56 bool Initialize(void *module_handle, NPP instance, NPMIMEType mime_type, |
| 59 int16 argc, char* argn[], char* argv[]); | 57 int16 argc, char* argn[], char* argv[]); |
| 60 | 58 |
| 61 // Displays the default plugin UI. | 59 // Informs the plugin of its window information. |
| 62 // | 60 // |
| 63 // Parameters: | 61 // Parameters: |
| 64 // parent_window | 62 // window_info |
| 65 // Handle to the parent window. | 63 // The window info passed to npapi. |
| 66 bool SetWindow(gfx::NativeView parent_view); | 64 bool NPP_SetWindow(NPWindow* window_info); |
| 67 | 65 |
| 68 // Destroys the install dialog and the plugin window. | 66 // Destroys the install dialog. |
| 69 void Shutdown(); | 67 void Shutdown(); |
| 70 | 68 |
| 71 // Starts plugin download. Spawns the plugin installer after it is | 69 // Starts plugin download. Spawns the plugin installer after it is |
| 72 // downloaded. | 70 // downloaded. |
| 73 void DownloadPlugin(); | 71 void DownloadPlugin(); |
| 74 | 72 |
| 75 // Indicates that the plugin download was cancelled. | 73 // Indicates that the plugin download was cancelled. |
| 76 void DownloadCancelled(); | 74 void DownloadCancelled(); |
| 77 | 75 |
| 78 // Initializes the plugin download stream. | 76 // Initializes the plugin download stream. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // Handles notifications received in response to GetURLNotify calls issued | 118 // Handles notifications received in response to GetURLNotify calls issued |
| 121 // by the plugin. | 119 // by the plugin. |
| 122 // | 120 // |
| 123 // Parameters: | 121 // Parameters: |
| 124 // url | 122 // url |
| 125 // Pointer to the URL. | 123 // Pointer to the URL. |
| 126 // reason | 124 // reason |
| 127 // Describes why the notification was sent. | 125 // Describes why the notification was sent. |
| 128 void URLNotify(const char* url, NPReason reason); | 126 void URLNotify(const char* url, NPReason reason); |
| 129 | 127 |
| 130 // gfx::NativeView window() const { return m_hWnd; } | 128 // Used by the renderer to indicate plugin install through the infobar. |
| 129 int16 NPP_HandleEvent(void* event); |
| 130 |
| 131 const std::string& mime_type() const { return mime_type_; } | 131 const std::string& mime_type() const { return mime_type_; } |
| 132 | 132 |
| 133 // Replaces a resource string with the placeholder passed in as an argument | 133 // Replaces a resource string with the placeholder passed in as an argument |
| 134 // | 134 // |
| 135 // Parameters: | 135 // Parameters: |
| 136 // message_id_with_placeholders | 136 // message_id_with_placeholders |
| 137 // The resource id of the string with placeholders. This is only used if | 137 // The resource id of the string with placeholders. This is only used if |
| 138 // the placeholder string (the replacement_string) parameter is valid. | 138 // the placeholder string (the replacement_string) parameter is valid. |
| 139 // message_id_without_placeholders | 139 // message_id_without_placeholders |
| 140 // The resource id of the string to be returned if the placeholder is | 140 // The resource id of the string to be returned if the placeholder is |
| (...skipping 20 matching lines...) Expand all Loading... |
| 161 // Getter for the NPP instance member. | 161 // Getter for the NPP instance member. |
| 162 const NPP instance() const { | 162 const NPP instance() const { |
| 163 return instance_; | 163 return instance_; |
| 164 } | 164 } |
| 165 | 165 |
| 166 // Returns whether or not the UI layout is right-to-left (such as Hebrew or | 166 // Returns whether or not the UI layout is right-to-left (such as Hebrew or |
| 167 // Arabic). | 167 // Arabic). |
| 168 bool IsRTLLayout() const; | 168 bool IsRTLLayout() const; |
| 169 | 169 |
| 170 protected: | 170 protected: |
| 171 int16 OnDrawRect(CGContextRef context, CGRect dirty_rect); |
| 172 |
| 171 // Displays the plugin install confirmation dialog. | 173 // Displays the plugin install confirmation dialog. |
| 172 void ShowInstallDialog(); | 174 void ShowInstallDialog(); |
| 173 | 175 |
| 174 // Clears the current display state. | 176 // Clears the current display state. |
| 175 void ClearDisplay(); | 177 void ClearDisplay(); |
| 176 | 178 |
| 177 // Displays the status message identified by the message resource id | 179 // Displays the status message identified by the message resource id |
| 178 // passed in. | 180 // passed in. |
| 179 // | 181 // |
| 180 // Parameters: | 182 // Parameters: |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // | 261 // |
| 260 void PaintUserActionInformation(gfx::NativeDrawingContext paint_dc, | 262 void PaintUserActionInformation(gfx::NativeDrawingContext paint_dc, |
| 261 int x_origin, int y_origin); | 263 int x_origin, int y_origin); |
| 262 | 264 |
| 263 private: | 265 private: |
| 264 // Notify the renderer that plugin is available to download. | 266 // Notify the renderer that plugin is available to download. |
| 265 void NotifyPluginStatus(int status); | 267 void NotifyPluginStatus(int status); |
| 266 | 268 |
| 267 // The plugins opaque instance handle | 269 // The plugins opaque instance handle |
| 268 NPP instance_; | 270 NPP instance_; |
| 269 // If this is to install activex | |
| 270 bool is_activex_; | |
| 271 // The plugin instantiation mode (NP_FULL or NP_EMBED) | |
| 272 int16 mode_; | |
| 273 // The handle to the icon displayed in the plugin installation window. | |
| 274 // HICON icon_; | |
| 275 // The Get plugin link message string displayed at the top left corner of | |
| 276 // the plugin window. | |
| 277 std::wstring get_plugin_link_message_; | |
| 278 // The command string displayed in the plugin installation window. | |
| 279 std::wstring command_; | |
| 280 // An additional message displayed at times by the plugin. | |
| 281 std::wstring optional_additional_message_; | |
| 282 // The current stream. | 271 // The current stream. |
| 283 NPStream* plugin_install_stream_; | 272 NPStream* plugin_install_stream_; |
| 284 // The plugin finder URL. | |
| 285 std::string plugin_finder_url_; | |
| 286 // The desired mime type. | 273 // The desired mime type. |
| 287 std::string mime_type_; | 274 std::string mime_type_; |
| 288 // The desired language. | |
| 289 std::string desired_language_; | |
| 290 // The plugin name. | |
| 291 std::wstring plugin_name_; | |
| 292 // The actual download URL. | |
| 293 std::string plugin_download_url_; | |
| 294 // Indicates if the plugin download URL points to an exe. | |
| 295 bool plugin_download_url_for_display_; | |
| 296 // The current state of the plugin installer. | 275 // The current state of the plugin installer. |
| 297 PluginInstallerState plugin_installer_state_; | 276 PluginInstallerState plugin_installer_state_; |
| 298 // Used to display the UI for plugin installation. | 277 // Dimensions of the plugin |
| 299 // PluginInstallDialog install_dialog_; | 278 uint32_t width_; |
| 300 // To enable auto refresh of the plugin window once the installation | 279 uint32_t height_; |
| 301 // is complete, we spawn the installation process in a job, and monitor | |
| 302 // IO completion events on the job. When the active process count of the | |
| 303 // job falls to zero, we initiate an auto refresh of the plugin list | |
| 304 // which enables the downloaded plugin to be instantiated. | |
| 305 // The completion events from the job are monitored in an independent | |
| 306 // thread. | |
| 307 // scoped_refptr<PluginInstallationJobMonitorThread> | |
| 308 // installation_job_monitor_thread_; | |
| 309 // This object handles download and parsing of the plugins database. | |
| 310 // PluginDatabaseHandler plugin_database_handler_; | |
| 311 // Indicates if the left click to download/refresh should be enabled or not. | |
| 312 bool enable_click_; | |
| 313 // Handles to the fonts used to display text in the plugin window. | |
| 314 // HFONT bold_font_; | |
| 315 // HFONT regular_font_; | |
| 316 // HFONT underline_font_; | |
| 317 // Tooltip Window. | |
| 318 gfx::NativeWindow tooltip_; | |
| 319 | |
| 320 DISALLOW_EVIL_CONSTRUCTORS(PluginInstallerImpl); | 280 DISALLOW_EVIL_CONSTRUCTORS(PluginInstallerImpl); |
| 321 }; | 281 }; |
| 322 | 282 |
| 323 | 283 |
| 324 #endif // WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_MAC_H_ | 284 #endif // WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_MAC_H_ |
| OLD | NEW |