Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: content/child/npapi/plugin_host.cc

Issue 1483733002: Remove support for NPObjects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/child/npapi/plugin_host.h" 5 #include "content/child/npapi/plugin_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { 510 NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) {
511 // Allows the plugin to query the browser for information 511 // Allows the plugin to query the browser for information
512 // 512 //
513 // Variables: 513 // Variables:
514 // NPNVxDisplay (unix only) 514 // NPNVxDisplay (unix only)
515 // NPNVxtAppContext (unix only) 515 // NPNVxtAppContext (unix only)
516 // NPNVnetscapeWindow (win only) - Gets the native window on which the 516 // NPNVnetscapeWindow (win only) - Gets the native window on which the
517 // plugin drawing occurs, returns HWND 517 // plugin drawing occurs, returns HWND
518 // NPNVjavascriptEnabledBool: tells whether Javascript is enabled 518 // NPNVjavascriptEnabledBool: tells whether Javascript is enabled
519 // NPNVasdEnabledBool: tells whether SmartUpdate is enabled 519 // NPNVasdEnabledBool: tells whether SmartUpdate is enabled
520 // NPNVOfflineBool: tells whether offline-mode is enabled 520 // NPNVOfflineBool: tells whether offline-mode is enabled
Wez 2016/01/14 21:57:08 nit: While you're here... this comment seems almos
dcheng 2016/01/14 22:05:50 It's probably wrong, but given the size of this pa
521 521
522 NPError rv = NPERR_GENERIC_ERROR; 522 NPError rv = NPERR_GENERIC_ERROR;
523 523
524 switch (static_cast<int>(variable)) { 524 switch (static_cast<int>(variable)) {
525 case NPNVWindowNPObject: { 525 case NPNVWindowNPObject:
526 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 526 case NPNVPluginElementNPObject:
527 if (!plugin.get()) { 527 return NPERR_INVALID_INSTANCE_ERROR;
Wez 2016/01/14 21:57:08 You're not failing here because the plugin instanc
dcheng 2016/01/14 22:05:50 I'll update this in the next rebasing + update pat
Wez 2016/01/19 17:58:28 ACK
528 NOTREACHED();
529 return NPERR_INVALID_INSTANCE_ERROR;
530 }
531 NPObject *np_object = plugin->webplugin()->GetWindowScriptNPObject();
532 // Return value is expected to be retained, as
533 // described here:
534 // <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess>
535 if (np_object) {
536 WebBindings::retainObject(np_object);
537 void **v = (void **)value;
538 *v = np_object;
539 rv = NPERR_NO_ERROR;
540 } else {
541 NOTREACHED();
542 }
543 break;
544 }
545 case NPNVPluginElementNPObject: {
546 scoped_refptr<PluginInstance> plugin(FindInstance(id));
547 if (!plugin.get()) {
548 NOTREACHED();
549 return NPERR_INVALID_INSTANCE_ERROR;
550 }
551 NPObject *np_object = plugin->webplugin()->GetPluginElement();
552 // Return value is expected to be retained, as
553 // described here:
554 // <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess>
555 if (np_object) {
556 WebBindings::retainObject(np_object);
557 void** v = static_cast<void**>(value);
558 *v = np_object;
559 rv = NPERR_NO_ERROR;
560 } else {
561 NOTREACHED();
562 }
563 break;
564 }
565 #if !defined(OS_MACOSX) // OS X doesn't have windowed plugins. 528 #if !defined(OS_MACOSX) // OS X doesn't have windowed plugins.
566 case NPNVnetscapeWindow: { 529 case NPNVnetscapeWindow: {
567 scoped_refptr<PluginInstance> plugin = FindInstance(id); 530 scoped_refptr<PluginInstance> plugin = FindInstance(id);
568 if (!plugin.get()) { 531 if (!plugin.get()) {
569 NOTREACHED(); 532 NOTREACHED();
570 return NPERR_INVALID_INSTANCE_ERROR; 533 return NPERR_INVALID_INSTANCE_ERROR;
571 } 534 }
572 gfx::PluginWindowHandle handle = plugin->window_handle(); 535 gfx::PluginWindowHandle handle = plugin->window_handle();
573 *((void**)value) = (void*)handle; 536 *((void**)value) = (void*)handle;
574 rv = NPERR_NO_ERROR; 537 rv = NPERR_NO_ERROR;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { 892 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) {
930 // TODO: Implement advanced key handling: http://crbug.com/46578 893 // TODO: Implement advanced key handling: http://crbug.com/46578
931 NOTIMPLEMENTED(); 894 NOTIMPLEMENTED();
932 return false; 895 return false;
933 } 896 }
934 897
935 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { 898 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) {
936 } 899 }
937 900
938 } // extern "C" 901 } // extern "C"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698