summaryrefslogtreecommitdiffstats
path: root/o3d/plugin/mac
diff options
context:
space:
mode:
authormaf@google.com <maf@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-09 18:43:40 +0000
committermaf@google.com <maf@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-09 18:43:40 +0000
commitb72eb73e72040cdaaa8957ca7a7417f9b89843fe (patch)
tree97df990f1b550151d62ce696cf132ead1af8a51a /o3d/plugin/mac
parent9525f84d9793bfebe1a0918bb527a5a9bde3b4b0 (diff)
downloadchromium_src-b72eb73e72040cdaaa8957ca7a7417f9b89843fe.zip
chromium_src-b72eb73e72040cdaaa8957ca7a7417f9b89843fe.tar.gz
chromium_src-b72eb73e72040cdaaa8957ca7a7417f9b89843fe.tar.bz2
Fix crash in Safari 4.0 final by making the O3D plug-in default to the Carbon event model, rather than the Cocoa event model.
A recent change in the spec of the Cocoa event model for Mac OS X browser plug-ins means that essential window information is not supplied at NPP_SetWindow() time. Luckily we can use the Carbon event model while we work out what to do to operate in that environment (we really need to know what window to attach our AGL context to). Review URL: http://codereview.chromium.org/118434 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17961 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/plugin/mac')
-rw-r--r--o3d/plugin/mac/main_mac.mm28
1 files changed, 16 insertions, 12 deletions
diff --git a/o3d/plugin/mac/main_mac.mm b/o3d/plugin/mac/main_mac.mm
index 687f865..30f750c 100644
--- a/o3d/plugin/mac/main_mac.mm
+++ b/o3d/plugin/mac/main_mac.mm
@@ -673,6 +673,10 @@ extern "C" {
// We favor the newer Cocoa-based model, but can cope with browsers that
// only support the original event model, or indeed can't even understand
// what we are asking for.
+ // However, right at the minute, we shun the Cocoa event model because its
+ // NPP_SetWindow messages don't contain a WindowRef or NSWindow so we would
+ // not get enough info to create our AGL context. We'll go back to
+ // preferring Cocoa once we have worked out how to deal with that.
// Cannot actually fail -
static void Mac_SetBestEventModel(NPP instance, PluginObject* obj) {
NPError err = NPERR_NO_ERROR;
@@ -703,20 +707,20 @@ extern "C" {
// If we didn't successfully get TRUE for either question, the browser
// just does not know about the new switchable event models, so must only
// support the old Carbon event model.
- if (!(supportsCocoaEventModel || supportsCocoaEventModel)) {
+ if (!(supportsCocoaEventModel || supportsCarbonEventModel)) {
supportsCarbonEventModel = TRUE;
obj->event_model_ = NPEventModelCarbon;
}
- if (supportsCocoaEventModel) {
- NPN_SetValue(instance, NPPVpluginEventModel,
- reinterpret_cast<void*>(NPEventModelCocoa));
- obj->event_model_ = NPEventModelCocoa;
- } else {
- NPN_SetValue(instance, NPPVpluginEventModel,
- reinterpret_cast<void*>(NPEventModelCocoa));
- obj->event_model_ = NPEventModelCarbon;
- }
+ // Default to Carbon event model, because the new version of the
+ // Cocoa event model spec does not supply sufficient window
+ // information in its Cocoa NPP_SetWindow calls for us to bind an
+ // AGL context to the browser window.
+ NPEventModel model_to_use =
+ (supportsCarbonEventModel) ? NPEventModelCarbon : NPEventModelCocoa;
+ NPN_SetValue(instance, NPPVpluginEventModel,
+ reinterpret_cast<void*>(model_to_use));
+ obj->event_model_ = model_to_use;
}
@@ -1078,8 +1082,8 @@ extern "C" {
obj->client()->SetRenderOnDemandCallback(
new RenderOnDemandCallbackHandler(obj));
-
-
+
+
obj->renderer()->SetClientOriginOffset(gl_x_origin, gl_y_origin);
obj->Resize(window->width, window->height);