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/plugins/npapi/plugin_host.h" | 5 #include "webkit/glue/plugins/plugin_host.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #if defined(OS_MACOSX) |
| 13 #include "base/sys_info.h" |
| 14 #endif |
12 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
13 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
14 #include "build/build_config.h" | |
15 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
16 #include "third_party/npapi/bindings/npapi_extensions.h" | 18 #include "third_party/npapi/bindings/npapi_extensions.h" |
17 #include "third_party/npapi/bindings/npruntime.h" | 19 #include "third_party/npapi/bindings/npruntime.h" |
18 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" | 20 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" |
19 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 21 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
20 #include "webkit/glue/webkit_glue.h" | 22 #include "webkit/glue/webkit_glue.h" |
21 #include "webkit/plugins/npapi/default_plugin_shared.h" | 23 #include "webkit/glue/plugins/default_plugin_shared.h" |
22 #include "webkit/plugins/npapi/npapi_extension_thunk.h" | 24 #include "webkit/glue/plugins/npapi_extension_thunk.h" |
23 #include "webkit/plugins/npapi/plugin_instance.h" | 25 #include "webkit/glue/plugins/plugin_instance.h" |
24 #include "webkit/plugins/npapi/plugin_lib.h" | 26 #include "webkit/glue/plugins/plugin_lib.h" |
25 #include "webkit/plugins/npapi/plugin_list.h" | 27 #include "webkit/glue/plugins/plugin_list.h" |
26 #include "webkit/plugins/npapi/plugin_stream_url.h" | 28 #include "webkit/glue/plugins/plugin_stream_url.h" |
27 #include "webkit/plugins/npapi/webplugin_delegate.h" | 29 #include "webkit/glue/plugins/webplugin_delegate.h" |
28 #include "webkit/plugins/npapi/webplugininfo.h" | 30 #include "webkit/glue/plugins/webplugininfo.h" |
29 | |
30 #if defined(OS_MACOSX) | |
31 #include "base/sys_info.h" | |
32 #endif | |
33 | 31 |
34 using WebKit::WebBindings; | 32 using WebKit::WebBindings; |
35 | 33 |
36 namespace webkit { | |
37 namespace npapi { | |
38 | |
39 // Finds a PluginInstance from an NPP. | 34 // Finds a PluginInstance from an NPP. |
40 // The caller must take a reference if needed. | 35 // The caller must take a reference if needed. |
41 static PluginInstance* FindInstance(NPP id) { | 36 static NPAPI::PluginInstance* FindInstance(NPP id) { |
42 if (id == NULL) { | 37 if (id == NULL) { |
43 return NULL; | 38 return NULL; |
44 } | 39 } |
45 return reinterpret_cast<PluginInstance*>(id->ndata); | 40 return reinterpret_cast<NPAPI::PluginInstance*>(id->ndata); |
46 } | 41 } |
47 | 42 |
48 #if defined(OS_MACOSX) | 43 #if defined(OS_MACOSX) |
49 // Returns true if the OS supports shared accelerated surfaces via IOSurface. | 44 // Returns true if the OS supports shared accelerated surfaces via IOSurface. |
50 // This is true on Snow Leopard and higher. | 45 // This is true on Snow Leopard and higher. |
51 static bool SupportsSharingAcceleratedSurfaces() { | 46 static bool SupportsSharingAcceleratedSurfaces() { |
52 int32 major, minor, bugfix; | 47 int32 major, minor, bugfix; |
53 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); | 48 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); |
54 return major > 10 || (major == 10 && minor > 5); | 49 return major > 10 || (major == 10 && minor > 5); |
55 } | 50 } |
56 #endif | 51 #endif |
57 | 52 |
| 53 namespace NPAPI { |
| 54 |
58 scoped_refptr<PluginHost> PluginHost::singleton_; | 55 scoped_refptr<PluginHost> PluginHost::singleton_; |
59 | 56 |
60 PluginHost::PluginHost() { | 57 PluginHost::PluginHost() { |
61 InitializeHostFuncs(); | 58 InitializeHostFuncs(); |
62 } | 59 } |
63 | 60 |
64 PluginHost::~PluginHost() { | 61 PluginHost::~PluginHost() { |
65 } | 62 } |
66 | 63 |
67 PluginHost *PluginHost::Singleton() { | 64 PluginHost *PluginHost::Singleton() { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 break; | 270 break; |
274 } | 271 } |
275 } | 272 } |
276 state = newstate; | 273 state = newstate; |
277 ptr++; | 274 ptr++; |
278 } while (!done); | 275 } while (!done); |
279 | 276 |
280 return !err; | 277 return !err; |
281 } | 278 } |
282 | 279 |
283 } // namespace npapi | 280 } // namespace NPAPI |
284 } // namespace webkit | |
285 | 281 |
286 extern "C" { | 282 extern "C" { |
287 | 283 |
288 using webkit::npapi::FindInstance; | |
289 using webkit::npapi::PluginHost; | |
290 using webkit::npapi::PluginInstance; | |
291 using webkit::npapi::WebPlugin; | |
292 | |
293 // Allocates memory from the host's memory space. | 284 // Allocates memory from the host's memory space. |
294 void* NPN_MemAlloc(uint32_t size) { | 285 void* NPN_MemAlloc(uint32_t size) { |
295 scoped_refptr<PluginHost> host(PluginHost::Singleton()); | 286 scoped_refptr<NPAPI::PluginHost> host(NPAPI::PluginHost::Singleton()); |
296 if (host != NULL) { | 287 if (host != NULL) { |
297 // Note: We must use the same allocator/deallocator | 288 // Note: We must use the same allocator/deallocator |
298 // that is used by the javascript library, as some of the | 289 // that is used by the javascript library, as some of the |
299 // JS APIs will pass memory to the plugin which the plugin | 290 // JS APIs will pass memory to the plugin which the plugin |
300 // will attempt to free. | 291 // will attempt to free. |
301 return malloc(size); | 292 return malloc(size); |
302 } | 293 } |
303 return NULL; | 294 return NULL; |
304 } | 295 } |
305 | 296 |
306 // Deallocates memory from the host's memory space | 297 // Deallocates memory from the host's memory space |
307 void NPN_MemFree(void* ptr) { | 298 void NPN_MemFree(void* ptr) { |
308 scoped_refptr<PluginHost> host(PluginHost::Singleton()); | 299 scoped_refptr<NPAPI::PluginHost> host(NPAPI::PluginHost::Singleton()); |
309 if (host != NULL) { | 300 if (host != NULL) { |
310 if (ptr != NULL && ptr != reinterpret_cast<void*>(-1)) | 301 if (ptr != NULL && ptr != reinterpret_cast<void*>(-1)) |
311 free(ptr); | 302 free(ptr); |
312 } | 303 } |
313 } | 304 } |
314 | 305 |
315 // Requests that the host free a specified amount of memory. | 306 // Requests that the host free a specified amount of memory. |
316 uint32_t NPN_MemFlush(uint32_t size) { | 307 uint32_t NPN_MemFlush(uint32_t size) { |
317 // This is not relevant on Windows; MAC specific | 308 // This is not relevant on Windows; MAC specific |
318 return size; | 309 return size; |
319 } | 310 } |
320 | 311 |
321 // This is for dynamic discovery of new plugins. | 312 // This is for dynamic discovery of new plugins. |
322 // Should force a re-scan of the plugins directory to load new ones. | 313 // Should force a re-scan of the plugins directory to load new ones. |
323 void NPN_ReloadPlugins(NPBool reload_pages) { | 314 void NPN_ReloadPlugins(NPBool reload_pages) { |
324 WebKit::resetPluginCache(reload_pages ? true : false); | 315 WebKit::resetPluginCache(reload_pages ? true : false); |
325 } | 316 } |
326 | 317 |
327 // Requests a range of bytes for a seekable stream. | 318 // Requests a range of bytes for a seekable stream. |
328 NPError NPN_RequestRead(NPStream* stream, NPByteRange* range_list) { | 319 NPError NPN_RequestRead(NPStream* stream, NPByteRange* range_list) { |
329 if (!stream || !range_list) | 320 if (!stream || !range_list) |
330 return NPERR_GENERIC_ERROR; | 321 return NPERR_GENERIC_ERROR; |
331 | 322 |
332 scoped_refptr<PluginInstance> plugin( | 323 scoped_refptr<NPAPI::PluginInstance> plugin( |
333 reinterpret_cast<PluginInstance*>(stream->ndata)); | 324 reinterpret_cast<NPAPI::PluginInstance*>(stream->ndata)); |
334 if (!plugin.get()) | 325 if (!plugin.get()) |
335 return NPERR_GENERIC_ERROR; | 326 return NPERR_GENERIC_ERROR; |
336 | 327 |
337 plugin->RequestRead(stream, range_list); | 328 plugin->RequestRead(stream, range_list); |
338 return NPERR_NO_ERROR; | 329 return NPERR_NO_ERROR; |
339 } | 330 } |
340 | 331 |
341 // Generic form of GetURL for common code between GetURL and GetURLNotify. | 332 // Generic form of GetURL for common code between GetURL and GetURLNotify. |
342 static NPError GetURLNotify(NPP id, | 333 static NPError GetURLNotify(NPP id, |
343 const char* url, | 334 const char* url, |
344 const char* target, | 335 const char* target, |
345 bool notify, | 336 bool notify, |
346 void* notify_data) { | 337 void* notify_data) { |
347 if (!url) | 338 if (!url) |
348 return NPERR_INVALID_URL; | 339 return NPERR_INVALID_URL; |
349 | 340 |
350 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 341 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
351 if (!plugin.get()) { | 342 if (!plugin.get()) { |
352 return NPERR_GENERIC_ERROR; | 343 return NPERR_GENERIC_ERROR; |
353 } | 344 } |
354 | 345 |
355 plugin->RequestURL(url, "GET", target, NULL, 0, notify, notify_data); | 346 plugin->RequestURL(url, "GET", target, NULL, 0, notify, notify_data); |
356 return NPERR_NO_ERROR; | 347 return NPERR_NO_ERROR; |
357 } | 348 } |
358 | 349 |
359 // Requests creation of a new stream with the contents of the | 350 // Requests creation of a new stream with the contents of the |
360 // specified URL; gets notification of the result. | 351 // specified URL; gets notification of the result. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 const char* url, | 395 const char* url, |
405 const char* target, | 396 const char* target, |
406 uint32_t len, | 397 uint32_t len, |
407 const char* buf, | 398 const char* buf, |
408 NPBool file, | 399 NPBool file, |
409 bool notify, | 400 bool notify, |
410 void* notify_data) { | 401 void* notify_data) { |
411 if (!url) | 402 if (!url) |
412 return NPERR_INVALID_URL; | 403 return NPERR_INVALID_URL; |
413 | 404 |
414 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 405 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
415 if (!plugin.get()) { | 406 if (!plugin.get()) { |
416 NOTREACHED(); | 407 NOTREACHED(); |
417 return NPERR_GENERIC_ERROR; | 408 return NPERR_GENERIC_ERROR; |
418 } | 409 } |
419 | 410 |
420 std::string post_file_contents; | 411 std::string post_file_contents; |
421 | 412 |
422 if (file) { | 413 if (file) { |
423 // Post data to be uploaded from a file. This can be handled in two | 414 // Post data to be uploaded from a file. This can be handled in two |
424 // ways. | 415 // ways. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 NPError NPN_DestroyStream(NPP id, NPStream* stream, NPReason reason) { | 542 NPError NPN_DestroyStream(NPP id, NPStream* stream, NPReason reason) { |
552 // Destroys a stream (could be created by plugin or browser). | 543 // Destroys a stream (could be created by plugin or browser). |
553 // | 544 // |
554 // Reasons: | 545 // Reasons: |
555 // NPRES_DONE - normal completion | 546 // NPRES_DONE - normal completion |
556 // NPRES_USER_BREAK - user terminated | 547 // NPRES_USER_BREAK - user terminated |
557 // NPRES_NETWORK_ERROR - network error (all errors fit here?) | 548 // NPRES_NETWORK_ERROR - network error (all errors fit here?) |
558 // | 549 // |
559 // | 550 // |
560 | 551 |
561 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 552 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
562 if (plugin.get() == NULL) { | 553 if (plugin.get() == NULL) { |
563 NOTREACHED(); | 554 NOTREACHED(); |
564 return NPERR_GENERIC_ERROR; | 555 return NPERR_GENERIC_ERROR; |
565 } | 556 } |
566 | 557 |
567 return plugin->NPP_DestroyStream(stream, reason); | 558 return plugin->NPP_DestroyStream(stream, reason); |
568 } | 559 } |
569 | 560 |
570 const char* NPN_UserAgent(NPP id) { | 561 const char* NPN_UserAgent(NPP id) { |
571 #if defined(OS_WIN) | 562 #if defined(OS_WIN) |
572 // Flash passes in a null id during the NP_initialize call. We need to | 563 // Flash passes in a null id during the NP_initialize call. We need to |
573 // default to the Mozilla user agent if we don't have an NPP instance or | 564 // default to the Mozilla user agent if we don't have an NPP instance or |
574 // else Flash won't request windowless mode. | 565 // else Flash won't request windowless mode. |
575 bool use_mozilla_user_agent = true; | 566 bool use_mozilla_user_agent = true; |
576 if (id) { | 567 if (id) { |
577 scoped_refptr<PluginInstance> plugin = FindInstance(id); | 568 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
578 if (plugin.get() && !plugin->use_mozilla_user_agent()) | 569 if (plugin.get() && !plugin->use_mozilla_user_agent()) |
579 use_mozilla_user_agent = false; | 570 use_mozilla_user_agent = false; |
580 } | 571 } |
581 | 572 |
582 if (use_mozilla_user_agent) | 573 if (use_mozilla_user_agent) |
583 return "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) " | 574 return "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) " |
584 "Gecko/20061103 Firefox/2.0a1"; | 575 "Gecko/20061103 Firefox/2.0a1"; |
585 #elif defined(OS_MACOSX) | 576 #elif defined(OS_MACOSX) |
586 // Silverlight 4 doesn't handle events correctly unless we claim to be Safari. | 577 // Silverlight 4 doesn't handle events correctly unless we claim to be Safari. |
587 scoped_refptr<PluginInstance> plugin; | 578 scoped_refptr<NPAPI::PluginInstance> plugin; |
588 if (id) | 579 if (id) |
589 plugin = FindInstance(id); | 580 plugin = FindInstance(id); |
590 if (plugin.get()) { | 581 if (plugin.get()) { |
591 webkit::npapi::WebPluginInfo plugin_info = | 582 WebPluginInfo plugin_info = plugin->plugin_lib()->plugin_info(); |
592 plugin->plugin_lib()->plugin_info(); | |
593 if (plugin_info.name == ASCIIToUTF16("Silverlight Plug-In") && | 583 if (plugin_info.name == ASCIIToUTF16("Silverlight Plug-In") && |
594 StartsWith(plugin_info.version, ASCIIToUTF16("4."), false)) { | 584 StartsWith(plugin_info.version, ASCIIToUTF16("4."), false)) { |
595 return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) " | 585 return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) " |
596 "AppleWebKit/534.1+ (KHTML, like Gecko) Version/5.0 Safari/533.16"; | 586 "AppleWebKit/534.1+ (KHTML, like Gecko) Version/5.0 Safari/533.16"; |
597 } | 587 } |
598 } | 588 } |
599 #endif | 589 #endif |
600 | 590 |
601 return webkit_glue::GetUserAgent(GURL()).c_str(); | 591 return webkit_glue::GetUserAgent(GURL()).c_str(); |
602 } | 592 } |
(...skipping 11 matching lines...) Expand all Loading... |
614 | 604 |
615 // Before a windowless plugin can refresh part of its drawing area, it must | 605 // Before a windowless plugin can refresh part of its drawing area, it must |
616 // first invalidate it. This function causes the NPP_HandleEvent method to | 606 // first invalidate it. This function causes the NPP_HandleEvent method to |
617 // pass an update event or a paint message to the plug-in. After calling | 607 // pass an update event or a paint message to the plug-in. After calling |
618 // this method, the plug-in recieves a paint message asynchronously. | 608 // this method, the plug-in recieves a paint message asynchronously. |
619 | 609 |
620 // The browser redraws invalid areas of the document and any windowless | 610 // The browser redraws invalid areas of the document and any windowless |
621 // plug-ins at regularly timed intervals. To force a paint message, the | 611 // plug-ins at regularly timed intervals. To force a paint message, the |
622 // plug-in can call NPN_ForceRedraw after calling this method. | 612 // plug-in can call NPN_ForceRedraw after calling this method. |
623 | 613 |
624 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 614 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
625 if (plugin.get() && plugin->webplugin()) { | 615 if (plugin.get() && plugin->webplugin()) { |
626 if (invalidRect) { | 616 if (invalidRect) { |
627 #if defined(OS_WIN) | 617 #if defined(OS_WIN) |
628 if (!plugin->windowless()) { | 618 if (!plugin->windowless()) { |
629 RECT rect = {0}; | 619 RECT rect = {0}; |
630 rect.left = invalidRect->left; | 620 rect.left = invalidRect->left; |
631 rect.right = invalidRect->right; | 621 rect.right = invalidRect->right; |
632 rect.top = invalidRect->top; | 622 rect.top = invalidRect->top; |
633 rect.bottom = invalidRect->bottom; | 623 rect.bottom = invalidRect->bottom; |
634 ::InvalidateRect(plugin->window_handle(), &rect, false); | 624 ::InvalidateRect(plugin->window_handle(), &rect, false); |
(...skipping 12 matching lines...) Expand all Loading... |
647 } | 637 } |
648 | 638 |
649 void NPN_InvalidateRegion(NPP id, NPRegion invalidRegion) { | 639 void NPN_InvalidateRegion(NPP id, NPRegion invalidRegion) { |
650 // Invalidates a specified drawing region prior to repainting | 640 // Invalidates a specified drawing region prior to repainting |
651 // or refreshing a window-less plugin. | 641 // or refreshing a window-less plugin. |
652 // | 642 // |
653 // Similar to NPN_InvalidateRect. | 643 // Similar to NPN_InvalidateRect. |
654 | 644 |
655 // TODO: this is overkill--add platform-specific region handling (at the | 645 // TODO: this is overkill--add platform-specific region handling (at the |
656 // very least, fetch the region's bounding box and pass it to InvalidateRect). | 646 // very least, fetch the region's bounding box and pass it to InvalidateRect). |
657 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 647 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
658 DCHECK(plugin.get() != NULL); | 648 DCHECK(plugin.get() != NULL); |
659 if (plugin.get() && plugin->webplugin()) | 649 if (plugin.get() && plugin->webplugin()) |
660 plugin->webplugin()->Invalidate(); | 650 plugin->webplugin()->Invalidate(); |
661 } | 651 } |
662 | 652 |
663 void NPN_ForceRedraw(NPP id) { | 653 void NPN_ForceRedraw(NPP id) { |
664 // Forces repaint for a windowless plug-in. | 654 // Forces repaint for a windowless plug-in. |
665 // | 655 // |
666 // We deliberately do not implement this; we don't want plugins forcing | 656 // We deliberately do not implement this; we don't want plugins forcing |
667 // synchronous paints. | 657 // synchronous paints. |
668 } | 658 } |
669 | 659 |
670 NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { | 660 NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { |
671 // Allows the plugin to query the browser for information | 661 // Allows the plugin to query the browser for information |
672 // | 662 // |
673 // Variables: | 663 // Variables: |
674 // NPNVxDisplay (unix only) | 664 // NPNVxDisplay (unix only) |
675 // NPNVxtAppContext (unix only) | 665 // NPNVxtAppContext (unix only) |
676 // NPNVnetscapeWindow (win only) - Gets the native window on which the | 666 // NPNVnetscapeWindow (win only) - Gets the native window on which the |
677 // plug-in drawing occurs, returns HWND | 667 // plug-in drawing occurs, returns HWND |
678 // NPNVjavascriptEnabledBool: tells whether Javascript is enabled | 668 // NPNVjavascriptEnabledBool: tells whether Javascript is enabled |
679 // NPNVasdEnabledBool: tells whether SmartUpdate is enabled | 669 // NPNVasdEnabledBool: tells whether SmartUpdate is enabled |
680 // NPNVOfflineBool: tells whether offline-mode is enabled | 670 // NPNVOfflineBool: tells whether offline-mode is enabled |
681 | 671 |
682 NPError rv = NPERR_GENERIC_ERROR; | 672 NPError rv = NPERR_GENERIC_ERROR; |
683 | 673 |
684 switch (static_cast<int>(variable)) { | 674 switch (static_cast<int>(variable)) { |
685 case NPNVWindowNPObject: { | 675 case NPNVWindowNPObject: { |
686 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 676 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
687 NPObject *np_object = plugin->webplugin()->GetWindowScriptNPObject(); | 677 NPObject *np_object = plugin->webplugin()->GetWindowScriptNPObject(); |
688 // Return value is expected to be retained, as | 678 // Return value is expected to be retained, as |
689 // described here: | 679 // described here: |
690 // <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess> | 680 // <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess> |
691 if (np_object) { | 681 if (np_object) { |
692 WebBindings::retainObject(np_object); | 682 WebBindings::retainObject(np_object); |
693 void **v = (void **)value; | 683 void **v = (void **)value; |
694 *v = np_object; | 684 *v = np_object; |
695 rv = NPERR_NO_ERROR; | 685 rv = NPERR_NO_ERROR; |
696 } else { | 686 } else { |
697 NOTREACHED(); | 687 NOTREACHED(); |
698 } | 688 } |
699 break; | 689 break; |
700 } | 690 } |
701 case NPNVPluginElementNPObject: { | 691 case NPNVPluginElementNPObject: { |
702 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 692 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
703 NPObject *np_object = plugin->webplugin()->GetPluginElement(); | 693 NPObject *np_object = plugin->webplugin()->GetPluginElement(); |
704 // Return value is expected to be retained, as | 694 // Return value is expected to be retained, as |
705 // described here: | 695 // described here: |
706 // <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess> | 696 // <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess> |
707 if (np_object) { | 697 if (np_object) { |
708 WebBindings::retainObject(np_object); | 698 WebBindings::retainObject(np_object); |
709 void** v = static_cast<void**>(value); | 699 void** v = static_cast<void**>(value); |
710 *v = np_object; | 700 *v = np_object; |
711 rv = NPERR_NO_ERROR; | 701 rv = NPERR_NO_ERROR; |
712 } else { | 702 } else { |
713 NOTREACHED(); | 703 NOTREACHED(); |
714 } | 704 } |
715 break; | 705 break; |
716 } | 706 } |
717 #if !defined(OS_MACOSX) // OS X doesn't have windowed plugins. | 707 #if !defined(OS_MACOSX) // OS X doesn't have windowed plugins. |
718 case NPNVnetscapeWindow: { | 708 case NPNVnetscapeWindow: { |
719 scoped_refptr<PluginInstance> plugin = FindInstance(id); | 709 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
720 if (!plugin.get()) { | 710 if (!plugin.get()) { |
721 NOTREACHED(); | 711 NOTREACHED(); |
722 return NPERR_GENERIC_ERROR; | 712 return NPERR_GENERIC_ERROR; |
723 } | 713 } |
724 gfx::PluginWindowHandle handle = plugin->window_handle(); | 714 gfx::PluginWindowHandle handle = plugin->window_handle(); |
725 *((void**)value) = (void*)handle; | 715 *((void**)value) = (void*)handle; |
726 rv = NPERR_NO_ERROR; | 716 rv = NPERR_NO_ERROR; |
727 break; | 717 break; |
728 } | 718 } |
729 #endif | 719 #endif |
(...skipping 16 matching lines...) Expand all Loading... |
746 break; | 736 break; |
747 #endif | 737 #endif |
748 case NPNVSupportsWindowless: { | 738 case NPNVSupportsWindowless: { |
749 NPBool* supports_windowless = reinterpret_cast<NPBool*>(value); | 739 NPBool* supports_windowless = reinterpret_cast<NPBool*>(value); |
750 *supports_windowless = true; | 740 *supports_windowless = true; |
751 rv = NPERR_NO_ERROR; | 741 rv = NPERR_NO_ERROR; |
752 break; | 742 break; |
753 } | 743 } |
754 case NPNVprivateModeBool: { | 744 case NPNVprivateModeBool: { |
755 NPBool* private_mode = reinterpret_cast<NPBool*>(value); | 745 NPBool* private_mode = reinterpret_cast<NPBool*>(value); |
756 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 746 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
757 *private_mode = plugin->webplugin()->IsOffTheRecord(); | 747 *private_mode = plugin->webplugin()->IsOffTheRecord(); |
758 rv = NPERR_NO_ERROR; | 748 rv = NPERR_NO_ERROR; |
759 break; | 749 break; |
760 } | 750 } |
761 case webkit::npapi::default_plugin::kMissingPluginStatusStart + | 751 case default_plugin::kMissingPluginStatusStart + |
762 webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE: | 752 default_plugin::MISSING_PLUGIN_AVAILABLE: |
763 // fall through | 753 // fall through |
764 case webkit::npapi::default_plugin::kMissingPluginStatusStart + | 754 case default_plugin::kMissingPluginStatusStart + |
765 webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD: { | 755 default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD: { |
766 // This is a hack for the default plugin to send notification to | 756 // This is a hack for the default plugin to send notification to |
767 // renderer. Even though we check if the plugin is the default plugin, | 757 // renderer. Even though we check if the plugin is the default plugin, |
768 // we still need to worry about future standard change that may conflict | 758 // we still need to worry about future standard change that may conflict |
769 // with the variable definition, in order to avoid duplicate case clauses | 759 // with the variable definition, in order to avoid duplicate case clauses |
770 // in this big switch statement. | 760 // in this big switch statement. |
771 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 761 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
772 if (plugin->plugin_lib()->plugin_info().path.value() == | 762 if (plugin->plugin_lib()->plugin_info().path.value() == |
773 webkit::npapi::kDefaultPluginLibraryName) { | 763 kDefaultPluginLibraryName) { |
774 plugin->webplugin()->OnMissingPluginStatus(variable - | 764 plugin->webplugin()->OnMissingPluginStatus( |
775 webkit::npapi::default_plugin::kMissingPluginStatusStart); | 765 variable - default_plugin::kMissingPluginStatusStart); |
776 } | 766 } |
777 break; | 767 break; |
778 } | 768 } |
779 #if defined(OS_MACOSX) | 769 #if defined(OS_MACOSX) |
780 case NPNVpluginDrawingModel: { | 770 case NPNVpluginDrawingModel: { |
781 // return the drawing model that was negotiated when we initialized. | 771 // return the drawing model that was negotiated when we initialized. |
782 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 772 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
783 *reinterpret_cast<int*>(value) = plugin->drawing_model(); | 773 *reinterpret_cast<int*>(value) = plugin->drawing_model(); |
784 rv = NPERR_NO_ERROR; | 774 rv = NPERR_NO_ERROR; |
785 break; | 775 break; |
786 } | 776 } |
787 #ifndef NP_NO_QUICKDRAW | 777 #ifndef NP_NO_QUICKDRAW |
788 case NPNVsupportsQuickDrawBool: { | 778 case NPNVsupportsQuickDrawBool: { |
789 // We do not admit to supporting the QuickDraw drawing model. The logic | 779 // We do not admit to supporting the QuickDraw drawing model. The logic |
790 // here is that our QuickDraw plugin support is so rudimentary that we | 780 // here is that our QuickDraw plugin support is so rudimentary that we |
791 // only want to use it as a fallback to keep plugins from crashing: if a | 781 // only want to use it as a fallback to keep plugins from crashing: if a |
792 // plugin knows enough to ask, we want them to use CoreGraphics. | 782 // plugin knows enough to ask, we want them to use CoreGraphics. |
(...skipping 12 matching lines...) Expand all Loading... |
805 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 795 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
806 *supports_model = true; | 796 *supports_model = true; |
807 rv = NPERR_NO_ERROR; | 797 rv = NPERR_NO_ERROR; |
808 break; | 798 break; |
809 } | 799 } |
810 case NPNVsupportsCoreAnimationBool: { | 800 case NPNVsupportsCoreAnimationBool: { |
811 // We only support the Core Animation model on 10.6 and higher | 801 // We only support the Core Animation model on 10.6 and higher |
812 // TODO(stuartmorgan): Once existing CA plugins have implemented the | 802 // TODO(stuartmorgan): Once existing CA plugins have implemented the |
813 // invalidating version, remove support for this one. | 803 // invalidating version, remove support for this one. |
814 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 804 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
815 *supports_model = webkit::npapi::SupportsSharingAcceleratedSurfaces() ? | 805 *supports_model = SupportsSharingAcceleratedSurfaces() ? true : false; |
816 true : false; | |
817 rv = NPERR_NO_ERROR; | 806 rv = NPERR_NO_ERROR; |
818 break; | 807 break; |
819 } | 808 } |
820 case NPNVsupportsInvalidatingCoreAnimationBool: { | 809 case NPNVsupportsInvalidatingCoreAnimationBool: { |
821 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 810 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
822 *supports_model = true; | 811 *supports_model = true; |
823 rv = NPERR_NO_ERROR; | 812 rv = NPERR_NO_ERROR; |
824 break; | 813 break; |
825 } | 814 } |
826 case NPNVsupportsOpenGLBool: { | 815 case NPNVsupportsOpenGLBool: { |
827 // This drawing model was never widely supported, and we don't plan to | 816 // This drawing model was never widely supported, and we don't plan to |
828 // support it. | 817 // support it. |
829 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 818 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
830 *supports_model = false; | 819 *supports_model = false; |
831 rv = NPERR_NO_ERROR; | 820 rv = NPERR_NO_ERROR; |
832 break; | 821 break; |
833 } | 822 } |
834 #endif // OS_MACOSX | 823 #endif // OS_MACOSX |
835 case NPNVPepperExtensions: | 824 case NPNVPepperExtensions: |
836 // Available for any plugin that attempts to get it. | 825 // Available for any plugin that attempts to get it. |
837 // If the plugin is not started in a Pepper implementation, it | 826 // If the plugin is not started in a Pepper implementation, it |
838 // will likely fail when it tries to use any of the functions | 827 // will likely fail when it tries to use any of the functions |
839 // attached to the extension vector. | 828 // attached to the extension vector. |
840 rv = webkit::npapi::GetPepperExtensionsFunctions(value); | 829 rv = NPAPI::GetPepperExtensionsFunctions(value); |
841 break; | 830 break; |
842 default: | 831 default: |
843 DVLOG(1) << "NPN_GetValue(" << variable << ") is not implemented yet."; | 832 DVLOG(1) << "NPN_GetValue(" << variable << ") is not implemented yet."; |
844 break; | 833 break; |
845 } | 834 } |
846 return rv; | 835 return rv; |
847 } | 836 } |
848 | 837 |
849 NPError NPN_SetValue(NPP id, NPPVariable variable, void* value) { | 838 NPError NPN_SetValue(NPP id, NPPVariable variable, void* value) { |
850 // Allows the plugin to set various modes | 839 // Allows the plugin to set various modes |
851 | 840 |
852 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 841 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
853 switch(variable) { | 842 switch(variable) { |
854 case NPPVpluginWindowBool: { | 843 case NPPVpluginWindowBool: { |
855 // Sets windowless mode for display of the plugin | 844 // Sets windowless mode for display of the plugin |
856 // Note: the documentation at | 845 // Note: the documentation at |
857 // http://developer.mozilla.org/en/docs/NPN_SetValue is wrong. When | 846 // http://developer.mozilla.org/en/docs/NPN_SetValue is wrong. When |
858 // value is NULL, the mode is set to true. This is the same way Mozilla | 847 // value is NULL, the mode is set to true. This is the same way Mozilla |
859 // works. | 848 // works. |
860 plugin->set_windowless(value == 0); | 849 plugin->set_windowless(value == 0); |
861 return NPERR_NO_ERROR; | 850 return NPERR_NO_ERROR; |
862 } | 851 } |
(...skipping 20 matching lines...) Expand all Loading... |
883 // TODO: implement me | 872 // TODO: implement me |
884 DVLOG(1) << "NPN_SetValue(NPPVpluginKeepLibraryInMemory) is not " | 873 DVLOG(1) << "NPN_SetValue(NPPVpluginKeepLibraryInMemory) is not " |
885 "implemented."; | 874 "implemented."; |
886 return NPERR_GENERIC_ERROR; | 875 return NPERR_GENERIC_ERROR; |
887 #if defined(OS_MACOSX) | 876 #if defined(OS_MACOSX) |
888 case NPPVpluginDrawingModel: { | 877 case NPPVpluginDrawingModel: { |
889 int model = reinterpret_cast<int>(value); | 878 int model = reinterpret_cast<int>(value); |
890 if (model == NPDrawingModelCoreGraphics || | 879 if (model == NPDrawingModelCoreGraphics || |
891 model == NPDrawingModelInvalidatingCoreAnimation || | 880 model == NPDrawingModelInvalidatingCoreAnimation || |
892 (model == NPDrawingModelCoreAnimation && | 881 (model == NPDrawingModelCoreAnimation && |
893 webkit::npapi::SupportsSharingAcceleratedSurfaces())) { | 882 SupportsSharingAcceleratedSurfaces())) { |
894 plugin->set_drawing_model(static_cast<NPDrawingModel>(model)); | 883 plugin->set_drawing_model(static_cast<NPDrawingModel>(model)); |
895 return NPERR_NO_ERROR; | 884 return NPERR_NO_ERROR; |
896 } | 885 } |
897 return NPERR_GENERIC_ERROR; | 886 return NPERR_GENERIC_ERROR; |
898 } | 887 } |
899 case NPPVpluginEventModel: { | 888 case NPPVpluginEventModel: { |
900 // we support Carbon and Cocoa event models | 889 // we support Carbon and Cocoa event models |
901 int model = reinterpret_cast<int>(value); | 890 int model = reinterpret_cast<int>(value); |
902 switch (model) { | 891 switch (model) { |
903 #ifndef NP_NO_CARBON | 892 #ifndef NP_NO_CARBON |
(...skipping 23 matching lines...) Expand all Loading... |
927 return NULL; | 916 return NULL; |
928 } | 917 } |
929 | 918 |
930 void* NPN_GetJavaPeer(NPP) { | 919 void* NPN_GetJavaPeer(NPP) { |
931 // TODO: implement me | 920 // TODO: implement me |
932 DVLOG(1) << "NPN_GetJavaPeer is not implemented."; | 921 DVLOG(1) << "NPN_GetJavaPeer is not implemented."; |
933 return NULL; | 922 return NULL; |
934 } | 923 } |
935 | 924 |
936 void NPN_PushPopupsEnabledState(NPP id, NPBool enabled) { | 925 void NPN_PushPopupsEnabledState(NPP id, NPBool enabled) { |
937 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 926 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
938 if (plugin) | 927 if (plugin) |
939 plugin->PushPopupsEnabledState(enabled ? true : false); | 928 plugin->PushPopupsEnabledState(enabled ? true : false); |
940 } | 929 } |
941 | 930 |
942 void NPN_PopPopupsEnabledState(NPP id) { | 931 void NPN_PopPopupsEnabledState(NPP id) { |
943 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 932 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
944 if (plugin) | 933 if (plugin) |
945 plugin->PopPopupsEnabledState(); | 934 plugin->PopPopupsEnabledState(); |
946 } | 935 } |
947 | 936 |
948 void NPN_PluginThreadAsyncCall(NPP id, | 937 void NPN_PluginThreadAsyncCall(NPP id, |
949 void (*func)(void*), | 938 void (*func)(void*), |
950 void* user_data) { | 939 void* user_data) { |
951 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 940 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
952 if (plugin) | 941 if (plugin) |
953 plugin->PluginThreadAsyncCall(func, user_data); | 942 plugin->PluginThreadAsyncCall(func, user_data); |
954 } | 943 } |
955 | 944 |
956 NPError NPN_GetValueForURL(NPP id, | 945 NPError NPN_GetValueForURL(NPP id, |
957 NPNURLVariable variable, | 946 NPNURLVariable variable, |
958 const char* url, | 947 const char* url, |
959 char** value, | 948 char** value, |
960 uint32_t* len) { | 949 uint32_t* len) { |
961 if (!id) | 950 if (!id) |
962 return NPERR_INVALID_PARAM; | 951 return NPERR_INVALID_PARAM; |
963 | 952 |
964 if (!url || !*url || !len) | 953 if (!url || !*url || !len) |
965 return NPERR_INVALID_URL; | 954 return NPERR_INVALID_URL; |
966 | 955 |
967 *len = 0; | 956 *len = 0; |
968 std::string result; | 957 std::string result; |
969 | 958 |
970 switch (variable) { | 959 switch (variable) { |
971 case NPNURLVProxy: { | 960 case NPNURLVProxy: { |
972 result = "DIRECT"; | 961 result = "DIRECT"; |
973 if (!webkit_glue::FindProxyForUrl(GURL((std::string(url))), &result)) | 962 if (!webkit_glue::FindProxyForUrl(GURL((std::string(url))), &result)) |
974 return NPERR_GENERIC_ERROR; | 963 return NPERR_GENERIC_ERROR; |
975 | 964 |
976 break; | 965 break; |
977 } | 966 } |
978 case NPNURLVCookie: { | 967 case NPNURLVCookie: { |
979 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 968 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
980 if (!plugin) | 969 if (!plugin) |
981 return NPERR_GENERIC_ERROR; | 970 return NPERR_GENERIC_ERROR; |
982 | 971 |
983 WebPlugin* webplugin = plugin->webplugin(); | 972 webkit_glue::WebPlugin* webplugin = plugin->webplugin(); |
984 if (!webplugin) | 973 if (!webplugin) |
985 return NPERR_GENERIC_ERROR; | 974 return NPERR_GENERIC_ERROR; |
986 | 975 |
987 // Bypass third-party cookie blocking by using the url as the | 976 // Bypass third-party cookie blocking by using the url as the |
988 // first_party_for_cookies. | 977 // first_party_for_cookies. |
989 GURL cookies_url((std::string(url))); | 978 GURL cookies_url((std::string(url))); |
990 result = webplugin->GetCookies(cookies_url, cookies_url); | 979 result = webplugin->GetCookies(cookies_url, cookies_url); |
991 break; | 980 break; |
992 } | 981 } |
993 default: | 982 default: |
(...skipping 15 matching lines...) Expand all Loading... |
1009 const char* value, | 998 const char* value, |
1010 uint32_t len) { | 999 uint32_t len) { |
1011 if (!id) | 1000 if (!id) |
1012 return NPERR_INVALID_PARAM; | 1001 return NPERR_INVALID_PARAM; |
1013 | 1002 |
1014 if (!url || !*url) | 1003 if (!url || !*url) |
1015 return NPERR_INVALID_URL; | 1004 return NPERR_INVALID_URL; |
1016 | 1005 |
1017 switch (variable) { | 1006 switch (variable) { |
1018 case NPNURLVCookie: { | 1007 case NPNURLVCookie: { |
1019 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 1008 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
1020 if (!plugin) | 1009 if (!plugin) |
1021 return NPERR_GENERIC_ERROR; | 1010 return NPERR_GENERIC_ERROR; |
1022 | 1011 |
1023 WebPlugin* webplugin = plugin->webplugin(); | 1012 webkit_glue::WebPlugin* webplugin = plugin->webplugin(); |
1024 if (!webplugin) | 1013 if (!webplugin) |
1025 return NPERR_GENERIC_ERROR; | 1014 return NPERR_GENERIC_ERROR; |
1026 | 1015 |
1027 std::string cookie(value, len); | 1016 std::string cookie(value, len); |
1028 GURL cookies_url((std::string(url))); | 1017 GURL cookies_url((std::string(url))); |
1029 webplugin->SetCookie(cookies_url, cookies_url, cookie); | 1018 webplugin->SetCookie(cookies_url, cookies_url, cookie); |
1030 return NPERR_NO_ERROR; | 1019 return NPERR_NO_ERROR; |
1031 } | 1020 } |
1032 case NPNURLVProxy: | 1021 case NPNURLVProxy: |
1033 // We don't support setting proxy values, fall through... | 1022 // We don't support setting proxy values, fall through... |
(...skipping 21 matching lines...) Expand all Loading... |
1055 return NPERR_INVALID_PARAM; | 1044 return NPERR_INVALID_PARAM; |
1056 | 1045 |
1057 // TODO: implement me (bug 23928) | 1046 // TODO: implement me (bug 23928) |
1058 return NPERR_GENERIC_ERROR; | 1047 return NPERR_GENERIC_ERROR; |
1059 } | 1048 } |
1060 | 1049 |
1061 uint32_t NPN_ScheduleTimer(NPP id, | 1050 uint32_t NPN_ScheduleTimer(NPP id, |
1062 uint32_t interval, | 1051 uint32_t interval, |
1063 NPBool repeat, | 1052 NPBool repeat, |
1064 void (*func)(NPP id, uint32_t timer_id)) { | 1053 void (*func)(NPP id, uint32_t timer_id)) { |
1065 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 1054 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
1066 if (!plugin) | 1055 if (!plugin) |
1067 return 0; | 1056 return 0; |
1068 | 1057 |
1069 return plugin->ScheduleTimer(interval, repeat, func); | 1058 return plugin->ScheduleTimer(interval, repeat, func); |
1070 } | 1059 } |
1071 | 1060 |
1072 void NPN_UnscheduleTimer(NPP id, uint32_t timer_id) { | 1061 void NPN_UnscheduleTimer(NPP id, uint32_t timer_id) { |
1073 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 1062 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
1074 if (plugin) | 1063 if (plugin) |
1075 plugin->UnscheduleTimer(timer_id); | 1064 plugin->UnscheduleTimer(timer_id); |
1076 } | 1065 } |
1077 | 1066 |
1078 NPError NPN_PopUpContextMenu(NPP id, NPMenu* menu) { | 1067 NPError NPN_PopUpContextMenu(NPP id, NPMenu* menu) { |
1079 if (!menu) | 1068 if (!menu) |
1080 return NPERR_INVALID_PARAM; | 1069 return NPERR_INVALID_PARAM; |
1081 | 1070 |
1082 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 1071 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
1083 if (plugin.get()) { | 1072 if (plugin.get()) { |
1084 return plugin->PopUpContextMenu(menu); | 1073 return plugin->PopUpContextMenu(menu); |
1085 } | 1074 } |
1086 NOTREACHED(); | 1075 NOTREACHED(); |
1087 return NPERR_GENERIC_ERROR; | 1076 return NPERR_GENERIC_ERROR; |
1088 } | 1077 } |
1089 | 1078 |
1090 NPBool NPN_ConvertPoint(NPP id, double sourceX, double sourceY, | 1079 NPBool NPN_ConvertPoint(NPP id, double sourceX, double sourceY, |
1091 NPCoordinateSpace sourceSpace, | 1080 NPCoordinateSpace sourceSpace, |
1092 double *destX, double *destY, | 1081 double *destX, double *destY, |
1093 NPCoordinateSpace destSpace) { | 1082 NPCoordinateSpace destSpace) { |
1094 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 1083 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); |
1095 if (plugin.get()) { | 1084 if (plugin.get()) { |
1096 return plugin->ConvertPoint(sourceX, sourceY, sourceSpace, | 1085 return plugin->ConvertPoint(sourceX, sourceY, sourceSpace, |
1097 destX, destY, destSpace); | 1086 destX, destY, destSpace); |
1098 } | 1087 } |
1099 NOTREACHED(); | 1088 NOTREACHED(); |
1100 return false; | 1089 return false; |
1101 } | 1090 } |
1102 | 1091 |
1103 NPBool NPN_HandleEvent(NPP id, void *event, NPBool handled) { | 1092 NPBool NPN_HandleEvent(NPP id, void *event, NPBool handled) { |
1104 // TODO: Implement advanced key handling: http://crbug.com/46578 | 1093 // TODO: Implement advanced key handling: http://crbug.com/46578 |
1105 NOTIMPLEMENTED(); | 1094 NOTIMPLEMENTED(); |
1106 return false; | 1095 return false; |
1107 } | 1096 } |
1108 | 1097 |
1109 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { | 1098 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { |
1110 // TODO: Implement advanced key handling: http://crbug.com/46578 | 1099 // TODO: Implement advanced key handling: http://crbug.com/46578 |
1111 NOTIMPLEMENTED(); | 1100 NOTIMPLEMENTED(); |
1112 return false; | 1101 return false; |
1113 } | 1102 } |
1114 | 1103 |
1115 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 1104 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
1116 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); | 1105 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(instance)); |
1117 if (plugin.get()) { | 1106 if (plugin.get()) { |
1118 plugin->URLRedirectResponse(!!allow, notify_data); | 1107 plugin->URLRedirectResponse(!!allow, notify_data); |
1119 } | 1108 } |
1120 } | 1109 } |
1121 | 1110 |
1122 } // extern "C" | 1111 } // extern "C" |
OLD | NEW |