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 #include "config.h" | 5 #include "config.h" |
6 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 6 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/stats_counters.h" | 14 #include "base/stats_counters.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "webkit/api/public/WebInputEvent.h" |
16 #include "webkit/default_plugin/plugin_impl.h" | 17 #include "webkit/default_plugin/plugin_impl.h" |
17 #include "webkit/glue/glue_util.h" | 18 #include "webkit/glue/glue_util.h" |
18 #include "webkit/glue/webplugin.h" | 19 #include "webkit/glue/webplugin.h" |
19 #include "webkit/glue/plugins/plugin_constants_win.h" | 20 #include "webkit/glue/plugins/plugin_constants_win.h" |
20 #include "webkit/glue/plugins/plugin_instance.h" | 21 #include "webkit/glue/plugins/plugin_instance.h" |
21 #include "webkit/glue/plugins/plugin_lib.h" | 22 #include "webkit/glue/plugins/plugin_lib.h" |
22 #include "webkit/glue/plugins/plugin_list.h" | 23 #include "webkit/glue/plugins/plugin_list.h" |
23 #include "webkit/glue/plugins/plugin_stream_url.h" | 24 #include "webkit/glue/plugins/plugin_stream_url.h" |
24 #include "webkit/glue/webkit_glue.h" | 25 #include "webkit/glue/webkit_glue.h" |
25 | 26 |
| 27 using WebKit::WebKeyboardEvent; |
| 28 using WebKit::WebInputEvent; |
| 29 using WebKit::WebMouseEvent; |
| 30 |
26 namespace { | 31 namespace { |
27 | 32 |
28 const wchar_t kWebPluginDelegateProperty[] = L"WebPluginDelegateProperty"; | 33 const wchar_t kWebPluginDelegateProperty[] = L"WebPluginDelegateProperty"; |
29 const wchar_t kPluginNameAtomProperty[] = L"PluginNameAtom"; | 34 const wchar_t kPluginNameAtomProperty[] = L"PluginNameAtom"; |
30 const wchar_t kDummyActivationWindowName[] = L"DummyWindowForActivation"; | 35 const wchar_t kDummyActivationWindowName[] = L"DummyWindowForActivation"; |
31 const wchar_t kPluginOrigProc[] = L"OriginalPtr"; | 36 const wchar_t kPluginOrigProc[] = L"OriginalPtr"; |
32 const wchar_t kPluginFlashThrottle[] = L"FlashThrottle"; | 37 const wchar_t kPluginFlashThrottle[] = L"FlashThrottle"; |
33 | 38 |
34 // The fastest we are willing to process WM_USER+1 events for Flash. | 39 // The fastest we are willing to process WM_USER+1 events for Flash. |
35 // Flash can easily exceed the limits of our CPU if we don't throttle it. | 40 // Flash can easily exceed the limits of our CPU if we don't throttle it. |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 } | 411 } |
407 | 412 |
408 void WebPluginDelegateImpl::SetFocus() { | 413 void WebPluginDelegateImpl::SetFocus() { |
409 DCHECK(instance()->windowless()); | 414 DCHECK(instance()->windowless()); |
410 | 415 |
411 NPEvent focus_event; | 416 NPEvent focus_event; |
412 | 417 |
413 instance()->NPP_HandleEvent(&focus_event); | 418 instance()->NPP_HandleEvent(&focus_event); |
414 } | 419 } |
415 | 420 |
416 bool WebPluginDelegateImpl::HandleEvent(NPEvent* event, | 421 bool WebPluginDelegateImpl::HandleInputEvent(const WebInputEvent& event, |
417 WebCursor* cursor) { | 422 WebCursor* cursor) { |
418 DCHECK(windowless_) << "events should only be received in windowless mode"; | 423 DCHECK(windowless_) << "events should only be received in windowless mode"; |
419 DCHECK(cursor != NULL); | 424 DCHECK(cursor != NULL); |
| 425 // TODO: convert event into a NPEvent, and call NPP_HandleEvent(np_event). |
420 | 426 |
421 return true; | 427 return true; |
422 } | 428 } |
423 | 429 |
424 WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( | 430 WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( |
425 int resource_id, const std::string &url, bool notify_needed, | 431 int resource_id, const std::string &url, bool notify_needed, |
426 intptr_t notify_data, intptr_t existing_stream) { | 432 intptr_t notify_data, intptr_t existing_stream) { |
427 // Stream already exists. This typically happens for range requests | 433 // Stream already exists. This typically happens for range requests |
428 // initiated via NPN_RequestRead. | 434 // initiated via NPN_RequestRead. |
429 if (existing_stream) { | 435 if (existing_stream) { |
(...skipping 15 matching lines...) Expand all Loading... |
445 return stream; | 451 return stream; |
446 } | 452 } |
447 | 453 |
448 void WebPluginDelegateImpl::URLRequestRouted(const std::string&url, | 454 void WebPluginDelegateImpl::URLRequestRouted(const std::string&url, |
449 bool notify_needed, | 455 bool notify_needed, |
450 intptr_t notify_data) { | 456 intptr_t notify_data) { |
451 if (notify_needed) { | 457 if (notify_needed) { |
452 instance()->SetURLLoadData(GURL(url.c_str()), notify_data); | 458 instance()->SetURLLoadData(GURL(url.c_str()), notify_data); |
453 } | 459 } |
454 } | 460 } |
OLD | NEW |