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

Side by Side Diff: remoting/host/host_plugin.cc

Issue 6992033: Negotiate Mac event and drawing model support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <stdio.h> 5 #include <stdio.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 : instance_(instance), scriptable_object_(NULL) {} 588 : instance_(instance), scriptable_object_(NULL) {}
589 589
590 ~HostNPPlugin() { 590 ~HostNPPlugin() {
591 if (scriptable_object_) { 591 if (scriptable_object_) {
592 g_npnetscape_funcs->releaseobject(scriptable_object_); 592 g_npnetscape_funcs->releaseobject(scriptable_object_);
593 scriptable_object_ = NULL; 593 scriptable_object_ = NULL;
594 } 594 }
595 } 595 }
596 596
597 bool Init(int16 argc, char** argn, char** argv, NPSavedData* saved) { 597 bool Init(int16 argc, char** argn, char** argv, NPSavedData* saved) {
598 #if defined(OS_MACOSX)
599 // Use the modern CoreGraphics and Cocoa models when available, since
600 // QuickDraw and Carbon are deprecated.
601 // The drawing and event models don't change anything for this plugin, since
602 // none of the functions affected by the models actually do anything.
603 // This does however keep the plugin from breaking when Chromium eventually
604 // drops support for QuickDraw and Carbon, and it also keeps the browser
605 // from sending Null Events once a second to support old Carbon based
606 // timers.
607 // Chromium should always be supporting the newer models.
608
609 // Bozo check to see if Chromium supports the CoreGraphics drawing model.
610 NPBool supports_core_graphics = false;
611 NPError err = g_npnetscape_funcs->getvalue(instance_,
612 NPNVsupportsCoreGraphicsBool,
613 &supports_core_graphics);
614 if (err == NPERR_NO_ERROR && supports_core_graphics) {
Wez 2011/05/25 03:21:22 No need to do separate check for support prior to
615 // Switch to CoreGraphics drawing model.
616 g_npnetscape_funcs->setvalue(instance_, NPPVpluginDrawingModel,
617 reinterpret_cast<void*>(NPDrawingModelCoreGraphics));
618 } else {
619 LOG(ERROR) << "No Core Graphics support";
620 return false;
621 }
622
623 // Bozo check to see if Chromium supports the Cocoa event model.
624 NPBool supports_cocoa = false;
625 err = g_npnetscape_funcs->getvalue(instance_, NPNVsupportsCocoaBool,
626 &supports_cocoa);
awong 2011/05/24 20:22:36 nit: needs one more space.
627 if (err == NPERR_NO_ERROR && supports_cocoa) {
628 // Switch to Cocoa event model.
629 g_npnetscape_funcs->setvalue(instance_, NPPVpluginEventModel,
630 reinterpret_cast<void*>(NPEventModelCocoa));
631 } else {
632 LOG(ERROR) << "No Cocoa Event Model support";
633 return false;
634 }
635 #endif // OS_MACOSX
598 return true; 636 return true;
599 } 637 }
600 638
601 bool Save(NPSavedData** saved) { 639 bool Save(NPSavedData** saved) {
602 return true; 640 return true;
603 } 641 }
604 642
605 NPObject* GetScriptableObject() { 643 NPObject* GetScriptableObject() {
606 if (!scriptable_object_) { 644 if (!scriptable_object_) {
607 // Must be static. If it is a temporary, objects created by this 645 // Must be static. If it is a temporary, objects created by this
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 return STRINGIZE(HOST_PLUGIN_MIME_TYPE) ":" 939 return STRINGIZE(HOST_PLUGIN_MIME_TYPE) ":"
902 HOST_PLUGIN_NAME ":" 940 HOST_PLUGIN_NAME ":"
903 HOST_PLUGIN_DESCRIPTION; 941 HOST_PLUGIN_DESCRIPTION;
904 } 942 }
905 943
906 OSCALL NPError NP_GetValue(void* npp, NPPVariable variable, void* value) { 944 OSCALL NPError NP_GetValue(void* npp, NPPVariable variable, void* value) {
907 return GetValue((NPP)npp, variable, value); 945 return GetValue((NPP)npp, variable, value);
908 } 946 }
909 947
910 } // extern "C" 948 } // extern "C"
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698