| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_GLUE_WEBPLUGIN_IMPL_H_ | 5 #ifndef WEBKIT_GLUE_WEBPLUGIN_IMPL_H_ |
| 6 #define WEBKIT_GLUE_WEBPLUGIN_IMPL_H_ | 6 #define WEBKIT_GLUE_WEBPLUGIN_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // Creates a WebPlugin instance, as long as the delegate's initialization | 117 // Creates a WebPlugin instance, as long as the delegate's initialization |
| 118 // succeeds. If it fails, the delegate is deleted and NULL is returned. | 118 // succeeds. If it fails, the delegate is deleted and NULL is returned. |
| 119 // Note that argn and argv are UTF8. | 119 // Note that argn and argv are UTF8. |
| 120 static WebCore::Widget* Create(const GURL& url, | 120 static WebCore::Widget* Create(const GURL& url, |
| 121 char** argn, | 121 char** argn, |
| 122 char** argv, | 122 char** argv, |
| 123 int argc, | 123 int argc, |
| 124 WebCore::Element* element, | 124 WebCore::Element* element, |
| 125 WebFrameImpl* frame, | 125 WebFrameImpl* frame, |
| 126 WebPluginDelegate* delegate, | 126 WebPluginDelegate* delegate, |
| 127 bool load_manually); | 127 bool load_manually, |
| 128 const std::string& mime_type); |
| 128 virtual ~WebPluginImpl(); | 129 virtual ~WebPluginImpl(); |
| 129 | 130 |
| 130 virtual NPObject* GetPluginScriptableObject(); | 131 virtual NPObject* GetPluginScriptableObject(); |
| 131 | 132 |
| 132 // Helper function for sorting post data. | 133 // Helper function for sorting post data. |
| 133 static bool SetPostData(WebCore::ResourceRequest* request, | 134 static bool SetPostData(WebCore::ResourceRequest* request, |
| 134 const char *buf, | 135 const char *buf, |
| 135 uint32 length); | 136 uint32 length); |
| 136 | 137 |
| 137 private: | 138 private: |
| 138 friend class WebPluginContainer; | 139 friend class WebPluginContainer; |
| 139 | 140 |
| 140 WebPluginImpl(WebCore::Element *element, WebFrameImpl *frame, | 141 WebPluginImpl(WebCore::Element *element, WebFrameImpl *frame, |
| 141 WebPluginDelegate* delegate, const GURL& plugin_url, | 142 WebPluginDelegate* delegate, const GURL& plugin_url, |
| 142 bool load_manually); | 143 bool load_manually, const std::string& mime_type, |
| 144 int arg_count, char** arg_names, char** arg_values); |
| 143 | 145 |
| 144 // WebPlugin implementation: | 146 // WebPlugin implementation: |
| 145 void SetWindow(HWND window, HANDLE pump_messages_event); | 147 void SetWindow(HWND window, HANDLE pump_messages_event); |
| 146 | 148 |
| 147 // Given a (maybe partial) url, completes using the base url. | 149 // Given a (maybe partial) url, completes using the base url. |
| 148 bool CompleteURL(const std::string& url_in, std::string* url_out); | 150 bool CompleteURL(const std::string& url_in, std::string* url_out); |
| 149 | 151 |
| 150 // Executes the script passed in. The notify_needed and notify_data arguments | 152 // Executes the script passed in. The notify_needed and notify_data arguments |
| 151 // are passed in by the plugin process. These indicate whether the plugin | 153 // are passed in by the plugin process. These indicate whether the plugin |
| 152 // expects a notification on script execution. We pass them back to the | 154 // expects a notification on script execution. We pass them back to the |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 virtual void hide(); | 226 virtual void hide(); |
| 225 | 227 |
| 226 // Handle widget events. | 228 // Handle widget events. |
| 227 virtual void handleEvent(WebCore::Event* event); | 229 virtual void handleEvent(WebCore::Event* event); |
| 228 void handleMouseEvent(WebCore::MouseEvent* event); | 230 void handleMouseEvent(WebCore::MouseEvent* event); |
| 229 void handleKeyboardEvent(WebCore::KeyboardEvent* event); | 231 void handleKeyboardEvent(WebCore::KeyboardEvent* event); |
| 230 | 232 |
| 231 // Sets the actual Widget for the plugin. | 233 // Sets the actual Widget for the plugin. |
| 232 void SetContainer(WebPluginContainer* container); | 234 void SetContainer(WebPluginContainer* container); |
| 233 | 235 |
| 236 // Destroys the plugin instance. |
| 237 // The response_handle_to_ignore parameter if not NULL indicates the |
| 238 // resource handle to be left valid during plugin shutdown. |
| 239 void TearDownPluginInstance( |
| 240 WebCore::ResourceHandle* response_handle_to_ignore); |
| 241 |
| 234 WebCore::ScrollView* parent() const; | 242 WebCore::ScrollView* parent() const; |
| 235 | 243 |
| 236 // ResourceHandleClient implementation. We implement this interface in the | 244 // ResourceHandleClient implementation. We implement this interface in the |
| 237 // renderer process, and then use the simple WebPluginResourceClient interface | 245 // renderer process, and then use the simple WebPluginResourceClient interface |
| 238 // to relay the callbacks to the plugin. | 246 // to relay the callbacks to the plugin. |
| 239 void willSendRequest(WebCore::ResourceHandle* handle, | 247 void willSendRequest(WebCore::ResourceHandle* handle, |
| 240 WebCore::ResourceRequest& request, | 248 WebCore::ResourceRequest& request, |
| 241 const WebCore::ResourceResponse&); | 249 const WebCore::ResourceResponse&); |
| 242 | 250 |
| 243 void didReceiveResponse(WebCore::ResourceHandle* handle, | 251 void didReceiveResponse(WebCore::ResourceHandle* handle, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 void HandleHttpMultipartResponse(const WebCore::ResourceResponse& response, | 295 void HandleHttpMultipartResponse(const WebCore::ResourceResponse& response, |
| 288 WebPluginResourceClient* client); | 296 WebPluginResourceClient* client); |
| 289 | 297 |
| 290 void HandleURLRequestInternal(const char *method, bool is_javascript_url, | 298 void HandleURLRequestInternal(const char *method, bool is_javascript_url, |
| 291 const char* target, unsigned int len, | 299 const char* target, unsigned int len, |
| 292 const char* buf, bool is_file_data, | 300 const char* buf, bool is_file_data, |
| 293 bool notify, const char* url, | 301 bool notify, const char* url, |
| 294 void* notify_data, bool popups_allowed, | 302 void* notify_data, bool popups_allowed, |
| 295 bool use_plugin_src_as_referrer); | 303 bool use_plugin_src_as_referrer); |
| 296 | 304 |
| 305 // Tears down the existing plugin instance and creates a new plugin instance |
| 306 // to handle the response identified by the response_handle parameter. |
| 307 bool ReinitializePluginForResponse(WebCore::ResourceHandle* response_handle); |
| 308 |
| 309 // Helper functions to convert an array of names/values to a vector. |
| 310 static void ArrayToVector(int total_values, char** values, |
| 311 std::vector<std::string>* value_vector); |
| 312 |
| 297 struct ClientInfo { | 313 struct ClientInfo { |
| 298 int id; | 314 int id; |
| 299 WebPluginResourceClient* client; | 315 WebPluginResourceClient* client; |
| 300 WebCore::ResourceRequest request; | 316 WebCore::ResourceRequest request; |
| 301 RefPtr<WebCore::ResourceHandle> handle; | 317 RefPtr<WebCore::ResourceHandle> handle; |
| 302 }; | 318 }; |
| 303 | 319 |
| 304 std::vector<ClientInfo> clients_; | 320 std::vector<ClientInfo> clients_; |
| 305 | 321 |
| 306 bool windowless_; | 322 bool windowless_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 325 | 341 |
| 326 // The plugin source URL. | 342 // The plugin source URL. |
| 327 GURL plugin_url_; | 343 GURL plugin_url_; |
| 328 | 344 |
| 329 // Indicates if the download would be initiated by the plugin or us. | 345 // Indicates if the download would be initiated by the plugin or us. |
| 330 bool load_manually_; | 346 bool load_manually_; |
| 331 | 347 |
| 332 // Indicates if this is the first geometry update received by the plugin. | 348 // Indicates if this is the first geometry update received by the plugin. |
| 333 bool first_geometry_update_; | 349 bool first_geometry_update_; |
| 334 | 350 |
| 351 // The mime type of the plugin. |
| 352 std::string mime_type_; |
| 353 |
| 354 // Holds the list of argument names passed to the plugin. |
| 355 std::vector<std::string> arg_names_; |
| 356 |
| 357 // Holds the list of argument values passed to the plugin. |
| 358 std::vector<std::string> arg_values_; |
| 359 |
| 335 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); | 360 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); |
| 336 }; | 361 }; |
| 337 | 362 |
| 338 #endif // #ifndef WEBKIT_GLUE_WEBPLUGIN_IMPL_H_ | 363 #endif // #ifndef WEBKIT_GLUE_WEBPLUGIN_IMPL_H_ |
| OLD | NEW |