| 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 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 5 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 using webkit_glue::WebPluginResourceClient; | 25 using webkit_glue::WebPluginResourceClient; |
| 26 using WebKit::WebCursorInfo; | 26 using WebKit::WebCursorInfo; |
| 27 using WebKit::WebKeyboardEvent; | 27 using WebKit::WebKeyboardEvent; |
| 28 using WebKit::WebInputEvent; | 28 using WebKit::WebInputEvent; |
| 29 using WebKit::WebMouseEvent; | 29 using WebKit::WebMouseEvent; |
| 30 | 30 |
| 31 WebPluginDelegateImpl* WebPluginDelegateImpl::Create( | 31 WebPluginDelegateImpl* WebPluginDelegateImpl::Create( |
| 32 const FilePath& filename, | 32 const FilePath& filename, |
| 33 const std::string& mime_type, | 33 const std::string& mime_type, |
| 34 gfx::PluginWindowHandle containing_view) { | 34 gfx::PluginWindowHandle containing_view) { |
| 35 scoped_refptr<NPAPI::PluginLib> plugin_lib = | 35 scoped_refptr<NPAPI::PluginLib> plugin_lib( |
| 36 NPAPI::PluginLib::CreatePluginLib(filename); | 36 NPAPI::PluginLib::CreatePluginLib(filename)); |
| 37 if (plugin_lib.get() == NULL) | 37 if (plugin_lib.get() == NULL) |
| 38 return NULL; | 38 return NULL; |
| 39 | 39 |
| 40 NPError err = plugin_lib->NP_Initialize(); | 40 NPError err = plugin_lib->NP_Initialize(); |
| 41 if (err != NPERR_NO_ERROR) | 41 if (err != NPERR_NO_ERROR) |
| 42 return NULL; | 42 return NULL; |
| 43 | 43 |
| 44 scoped_refptr<NPAPI::PluginInstance> instance = | 44 scoped_refptr<NPAPI::PluginInstance> instance( |
| 45 plugin_lib->CreateInstance(mime_type); | 45 plugin_lib->CreateInstance(mime_type)); |
| 46 return new WebPluginDelegateImpl(containing_view, instance.get()); | 46 return new WebPluginDelegateImpl(containing_view, instance.get()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void WebPluginDelegateImpl::PluginDestroyed() { | 49 void WebPluginDelegateImpl::PluginDestroyed() { |
| 50 if (handle_event_depth_) { | 50 if (handle_event_depth_) { |
| 51 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 51 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 52 } else { | 52 } else { |
| 53 delete this; | 53 delete this; |
| 54 } | 54 } |
| 55 } | 55 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( | 294 WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( |
| 295 unsigned long resource_id, const GURL& url, int notify_id) { | 295 unsigned long resource_id, const GURL& url, int notify_id) { |
| 296 return instance()->CreateStream( | 296 return instance()->CreateStream( |
| 297 resource_id, url, std::string(), notify_id); | 297 resource_id, url, std::string(), notify_id); |
| 298 } | 298 } |
| 299 | 299 |
| 300 WebPluginResourceClient* WebPluginDelegateImpl::CreateSeekableResourceClient( | 300 WebPluginResourceClient* WebPluginDelegateImpl::CreateSeekableResourceClient( |
| 301 unsigned long resource_id, int range_request_id) { | 301 unsigned long resource_id, int range_request_id) { |
| 302 return instance()->GetRangeRequest(range_request_id); | 302 return instance()->GetRangeRequest(range_request_id); |
| 303 } | 303 } |
| OLD | NEW |