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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/host_plugin.cc
diff --git a/remoting/host/host_plugin.cc b/remoting/host/host_plugin.cc
index 371d91f7e7e71786dfa0946e9508679a386a1435..894d1423b34e9f8c34d105ae6295ecd6fb190072 100644
--- a/remoting/host/host_plugin.cc
+++ b/remoting/host/host_plugin.cc
@@ -595,6 +595,44 @@ class HostNPPlugin {
}
bool Init(int16 argc, char** argn, char** argv, NPSavedData* saved) {
+#if defined(OS_MACOSX)
+ // Use the modern CoreGraphics and Cocoa models when available, since
+ // QuickDraw and Carbon are deprecated.
+ // The drawing and event models don't change anything for this plugin, since
+ // none of the functions affected by the models actually do anything.
+ // This does however keep the plugin from breaking when Chromium eventually
+ // drops support for QuickDraw and Carbon, and it also keeps the browser
+ // from sending Null Events once a second to support old Carbon based
+ // timers.
+ // Chromium should always be supporting the newer models.
+
+ // Bozo check to see if Chromium supports the CoreGraphics drawing model.
+ NPBool supports_core_graphics = false;
+ NPError err = g_npnetscape_funcs->getvalue(instance_,
+ NPNVsupportsCoreGraphicsBool,
+ &supports_core_graphics);
+ 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
+ // Switch to CoreGraphics drawing model.
+ g_npnetscape_funcs->setvalue(instance_, NPPVpluginDrawingModel,
+ reinterpret_cast<void*>(NPDrawingModelCoreGraphics));
+ } else {
+ LOG(ERROR) << "No Core Graphics support";
+ return false;
+ }
+
+ // Bozo check to see if Chromium supports the Cocoa event model.
+ NPBool supports_cocoa = false;
+ err = g_npnetscape_funcs->getvalue(instance_, NPNVsupportsCocoaBool,
+ &supports_cocoa);
awong 2011/05/24 20:22:36 nit: needs one more space.
+ if (err == NPERR_NO_ERROR && supports_cocoa) {
+ // Switch to Cocoa event model.
+ g_npnetscape_funcs->setvalue(instance_, NPPVpluginEventModel,
+ reinterpret_cast<void*>(NPEventModelCocoa));
+ } else {
+ LOG(ERROR) << "No Cocoa Event Model support";
+ return false;
+ }
+#endif // OS_MACOSX
return true;
}
« 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