| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 7 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/stats_counters.h" | 15 #include "base/stats_counters.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "webkit/api/public/WebInputEvent.h" | 17 #include "webkit/api/public/WebInputEvent.h" |
| 18 #include "webkit/default_plugin/plugin_impl.h" | 18 #include "webkit/default_plugin/plugin_impl.h" |
| 19 #include "webkit/glue/glue_util.h" | 19 #include "webkit/glue/glue_util.h" |
| 20 #include "webkit/glue/webplugin.h" | 20 #include "webkit/glue/webplugin.h" |
| 21 #include "webkit/glue/plugins/fake_plugin_window_tracker_mac.h" | 21 #include "webkit/glue/plugins/fake_plugin_window_tracker_mac.h" |
| 22 #include "webkit/glue/plugins/plugin_constants_win.h" | 22 #include "webkit/glue/plugins/plugin_constants_win.h" |
| 23 #include "webkit/glue/plugins/plugin_instance.h" | 23 #include "webkit/glue/plugins/plugin_instance.h" |
| 24 #include "webkit/glue/plugins/plugin_lib.h" | 24 #include "webkit/glue/plugins/plugin_lib.h" |
| 25 #include "webkit/glue/plugins/plugin_list.h" | 25 #include "webkit/glue/plugins/plugin_list.h" |
| 26 #include "webkit/glue/plugins/plugin_stream_url.h" | 26 #include "webkit/glue/plugins/plugin_stream_url.h" |
| 27 #include "webkit/glue/webkit_glue.h" | 27 #include "webkit/glue/webkit_glue.h" |
| 28 | 28 |
| 29 using webkit_glue::WebPlugin; |
| 30 using webkit_glue::WebPluginDelegate; |
| 31 using webkit_glue::WebPluginResourceClient; |
| 29 using WebKit::WebCursorInfo; | 32 using WebKit::WebCursorInfo; |
| 30 using WebKit::WebKeyboardEvent; | 33 using WebKit::WebKeyboardEvent; |
| 31 using WebKit::WebInputEvent; | 34 using WebKit::WebInputEvent; |
| 32 using WebKit::WebMouseEvent; | 35 using WebKit::WebMouseEvent; |
| 33 | 36 |
| 34 // Important implementation notes: The Mac definition of NPAPI, particularly | 37 // Important implementation notes: The Mac definition of NPAPI, particularly |
| 35 // the distinction between windowed and windowless modes, differs from the | 38 // the distinction between windowed and windowless modes, differs from the |
| 36 // Windows and Linux definitions. Most of those differences are | 39 // Windows and Linux definitions. Most of those differences are |
| 37 // accomodated by the WebPluginDelegate class. | 40 // accomodated by the WebPluginDelegate class. |
| 38 | 41 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // no streams are left "in progress". Need to do | 156 // no streams are left "in progress". Need to do |
| 154 // this before calling set_web_plugin(NULL) because the | 157 // this before calling set_web_plugin(NULL) because the |
| 155 // instance uses the helper to do the download. | 158 // instance uses the helper to do the download. |
| 156 instance_->CloseStreams(); | 159 instance_->CloseStreams(); |
| 157 instance_->NPP_Destroy(); | 160 instance_->NPP_Destroy(); |
| 158 instance_->set_web_plugin(NULL); | 161 instance_->set_web_plugin(NULL); |
| 159 instance_ = 0; | 162 instance_ = 0; |
| 160 } | 163 } |
| 161 } | 164 } |
| 162 | 165 |
| 163 void WebPluginDelegateImpl::PlatformInitialize(WebPlugin* plugin) { | 166 void WebPluginDelegateImpl::PlatformInitialize() { |
| 164 // TODO(port): implement these after unforking. | 167 // TODO(port): implement these after unforking. |
| 165 } | 168 } |
| 169 |
| 166 void WebPluginDelegateImpl::PlatformDestroyInstance() { | 170 void WebPluginDelegateImpl::PlatformDestroyInstance() { |
| 167 // TODO(port): implement these after unforking. | 171 // TODO(port): implement these after unforking. |
| 168 } | 172 } |
| 169 | 173 |
| 170 void WebPluginDelegateImpl::UpdateGeometry( | 174 void WebPluginDelegateImpl::UpdateGeometry( |
| 171 const gfx::Rect& window_rect, | 175 const gfx::Rect& window_rect, |
| 172 const gfx::Rect& clip_rect) { | 176 const gfx::Rect& clip_rect) { |
| 173 DCHECK(windowless_); | 177 DCHECK(windowless_); |
| 174 WindowlessUpdateGeometry(window_rect, clip_rect); | 178 WindowlessUpdateGeometry(window_rect, clip_rect); |
| 175 } | 179 } |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 np_event.modifiers |= btnState; | 554 np_event.modifiers |= btnState; |
| 551 np_event.where.h = last_mouse_x_; | 555 np_event.where.h = last_mouse_x_; |
| 552 np_event.where.v = last_mouse_y_; | 556 np_event.where.v = last_mouse_y_; |
| 553 instance()->NPP_HandleEvent(&np_event); | 557 instance()->NPP_HandleEvent(&np_event); |
| 554 | 558 |
| 555 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 559 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 556 null_event_factory_.NewRunnableMethod( | 560 null_event_factory_.NewRunnableMethod( |
| 557 &WebPluginDelegateImpl::OnNullEvent), | 561 &WebPluginDelegateImpl::OnNullEvent), |
| 558 kPluginIdleThrottleDelayMs); | 562 kPluginIdleThrottleDelayMs); |
| 559 } | 563 } |
| OLD | NEW |