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; |
} |