diff options
author | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-24 20:37:58 +0000 |
---|---|---|
committer | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-24 20:37:58 +0000 |
commit | 13daa302c065ab83898204f98e0964127da0e551 (patch) | |
tree | 097c7adc61dd4a75ce8fe9864ad6542e32fb346a /remoting | |
parent | 2c9516b0a6be36ab3d1cf6a4a4b23916b744f327 (diff) | |
download | chromium_src-13daa302c065ab83898204f98e0964127da0e551.zip chromium_src-13daa302c065ab83898204f98e0964127da0e551.tar.gz chromium_src-13daa302c065ab83898204f98e0964127da0e551.tar.bz2 |
Negotiate Mac event and drawing model support
This will help performance on our main thread, and will future proof us.
BUG=NONE
TEST=BUILD
Review URL: http://codereview.chromium.org/6992033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86478 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/host/host_plugin.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/remoting/host/host_plugin.cc b/remoting/host/host_plugin.cc index 371d91f..4713d6b 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. + + // Sanity 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) { + // Switch to CoreGraphics drawing model. + g_npnetscape_funcs->setvalue(instance_, NPPVpluginDrawingModel, + reinterpret_cast<void*>(NPDrawingModelCoreGraphics)); + } else { + LOG(ERROR) << "No Core Graphics support"; + return false; + } + + // Sanity check to see if Chromium supports the Cocoa event model. + NPBool supports_cocoa = false; + err = g_npnetscape_funcs->getvalue(instance_, NPNVsupportsCocoaBool, + &supports_cocoa); + 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; } |