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

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

Issue 1815593002: Remove windowed NPAPI code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@make_test_plugin_windowless
Patch Set: rebase Created 4 years, 9 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // pass an update event or a paint message to the plugin. After calling 457 // pass an update event or a paint message to the plugin. After calling
458 // this method, the plugin receives a paint message asynchronously. 458 // this method, the plugin receives a paint message asynchronously.
459 459
460 // The browser redraws invalid areas of the document and any windowless 460 // The browser redraws invalid areas of the document and any windowless
461 // plugins at regularly timed intervals. To force a paint message, the 461 // plugins at regularly timed intervals. To force a paint message, the
462 // plugin can call NPN_ForceRedraw after calling this method. 462 // plugin can call NPN_ForceRedraw after calling this method.
463 463
464 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 464 scoped_refptr<PluginInstance> plugin(FindInstance(id));
465 if (plugin.get() && plugin->webplugin()) { 465 if (plugin.get() && plugin->webplugin()) {
466 if (invalidRect) { 466 if (invalidRect) {
467 #if defined(OS_WIN)
468 if (!plugin->windowless()) {
469 RECT rect = {0};
470 rect.left = invalidRect->left;
471 rect.right = invalidRect->right;
472 rect.top = invalidRect->top;
473 rect.bottom = invalidRect->bottom;
474 ::InvalidateRect(plugin->window_handle(), &rect, false);
475 return;
476 }
477 #endif
478 gfx::Rect rect(invalidRect->left, 467 gfx::Rect rect(invalidRect->left,
479 invalidRect->top, 468 invalidRect->top,
480 invalidRect->right - invalidRect->left, 469 invalidRect->right - invalidRect->left,
481 invalidRect->bottom - invalidRect->top); 470 invalidRect->bottom - invalidRect->top);
482 plugin->webplugin()->InvalidateRect(rect); 471 plugin->webplugin()->InvalidateRect(rect);
483 } else { 472 } else {
484 plugin->webplugin()->Invalidate(); 473 plugin->webplugin()->Invalidate();
485 } 474 }
486 } 475 }
487 } 476 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 651
663 NPError NPN_SetValue(NPP id, NPPVariable variable, void* value) { 652 NPError NPN_SetValue(NPP id, NPPVariable variable, void* value) {
664 // Allows the plugin to set various modes 653 // Allows the plugin to set various modes
665 654
666 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 655 scoped_refptr<PluginInstance> plugin(FindInstance(id));
667 if (!plugin.get()) { 656 if (!plugin.get()) {
668 NOTREACHED(); 657 NOTREACHED();
669 return NPERR_INVALID_INSTANCE_ERROR; 658 return NPERR_INVALID_INSTANCE_ERROR;
670 } 659 }
671 switch(variable) { 660 switch(variable) {
672 case NPPVpluginWindowBool: {
673 // Sets windowless mode for display of the plugin
674 // Note: the documentation at
675 // http://developer.mozilla.org/en/docs/NPN_SetValue is wrong. When
676 // value is NULL, the mode is set to true. This is the same way Mozilla
677 // works.
678 plugin->set_windowless(value == 0);
679 return NPERR_NO_ERROR;
680 }
681 case NPPVpluginTransparentBool: { 661 case NPPVpluginTransparentBool: {
682 // Sets transparent mode for display of the plugin 662 // Sets transparent mode for display of the plugin
683 // 663 //
684 // Transparent plugins require the browser to paint the background 664 // Transparent plugins require the browser to paint the background
685 // before having the plugin paint. By default, windowless plugins 665 // before having the plugin paint. By default, windowless plugins
686 // are transparent. Making a windowless plugin opaque means that 666 // are transparent. Making a windowless plugin opaque means that
687 // the plugin does not require the browser to paint the background. 667 // the plugin does not require the browser to paint the background.
688 bool mode = (value != 0); 668 bool mode = (value != 0);
689 plugin->set_transparent(mode); 669 plugin->set_transparent(mode);
690 return NPERR_NO_ERROR; 670 return NPERR_NO_ERROR;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { 909 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) {
930 // TODO: Implement advanced key handling: http://crbug.com/46578 910 // TODO: Implement advanced key handling: http://crbug.com/46578
931 NOTIMPLEMENTED(); 911 NOTIMPLEMENTED();
932 return false; 912 return false;
933 } 913 }
934 914
935 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { 915 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) {
936 } 916 }
937 917
938 } // extern "C" 918 } // extern "C"
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.cc ('k') | content/child/npapi/plugin_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698