summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-22 15:46:36 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-22 15:46:36 +0000
commit0a4404da4b70927abe71662a0d968d9643646546 (patch)
treef798cee9610c27c45132adfb18a118f753b3027b /chrome
parente24be072268be5ca69f68b9fffdc872e3444c320 (diff)
downloadchromium_src-0a4404da4b70927abe71662a0d968d9643646546.zip
chromium_src-0a4404da4b70927abe71662a0d968d9643646546.tar.gz
chromium_src-0a4404da4b70927abe71662a0d968d9643646546.tar.bz2
Disable MultiClutchInputManager on Lion.
BUG=90075 TEST=Install that thing on Lion (good luck) and gesticulate. No crash. Review URL: http://codereview.chromium.org/7481015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93637 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chrome_browser_application_mac.mm62
1 files changed, 46 insertions, 16 deletions
diff --git a/chrome/browser/chrome_browser_application_mac.mm b/chrome/browser/chrome_browser_application_mac.mm
index 8c212cf..1488fa5 100644
--- a/chrome/browser/chrome_browser_application_mac.mm
+++ b/chrome/browser/chrome_browser_application_mac.mm
@@ -5,6 +5,7 @@
#import "chrome/browser/chrome_browser_application_mac.h"
#import "base/logging.h"
+#import "base/mac/mac_util.h"
#import "base/mac/scoped_nsexception_enabler.h"
#import "base/metrics/histogram.h"
#import "base/memory/scoped_nsobject.h"
@@ -24,18 +25,18 @@
// the debugger when an exception is raised. -raise sounds more
// obvious to intercept, but it doesn't catch the original throw
// because the objc runtime doesn't use it.
-@interface NSException (NSExceptionSwizzle)
-- (id)chromeInitWithName:(NSString*)aName
- reason:(NSString*)aReason
- userInfo:(NSDictionary *)someUserInfo;
+@interface NSException (CrNSExceptionSwizzle)
+- (id)crInitWithName:(NSString*)aName
+ reason:(NSString*)aReason
+ userInfo:(NSDictionary*)someUserInfo;
@end
static IMP gOriginalInitIMP = NULL;
-@implementation NSException (NSExceptionSwizzle)
-- (id)chromeInitWithName:(NSString*)aName
- reason:(NSString*)aReason
- userInfo:(NSDictionary *)someUserInfo {
+@implementation NSException (CrNSExceptionSwizzle)
+- (id)crInitWithName:(NSString*)aName
+ reason:(NSString*)aReason
+ userInfo:(NSDictionary*)someUserInfo {
// Method only called when swizzled.
DCHECK(_cmd == @selector(initWithName:reason:userInfo:));
@@ -121,6 +122,29 @@ static IMP gOriginalInitIMP = NULL;
}
@end
+static IMP gOriginalNSBundleLoadIMP = NULL;
+
+@interface NSBundle (CrNSBundleSwizzle)
+- (BOOL)crLoad;
+@end
+
+@implementation NSBundle (CrNSBundleSwizzle)
+- (BOOL)crLoad {
+ // Method only called when swizzled.
+ DCHECK(_cmd == @selector(load));
+
+ // MultiClutchInputManager is broken in Chrome on Lion.
+ // http://crbug.com/90075.
+ if (base::mac::IsOSLionOrLater() &&
+ [[self bundleIdentifier]
+ isEqualToString:@"net.wonderboots.multiclutchinputmanager"]) {
+ return NO;
+ }
+
+ return gOriginalNSBundleLoadIMP(self, _cmd) != nil;
+}
+@end
+
namespace chrome_browser_application_mac {
// Maximum number of known named exceptions we'll support. There is
@@ -193,15 +217,21 @@ void CancelTerminate() {
namespace {
-// Do-nothing wrapper so that we can arrange to only swizzle
-// -[NSException raise] when DCHECK() is turned on (as opposed to
-// replicating the preprocess logic which turns DCHECK() on).
-BOOL SwizzleNSExceptionInit() {
+void SwizzleInit() {
+ // Do-nothing wrapper so that we can arrange to only swizzle
+ // -[NSException raise] when DCHECK() is turned on (as opposed to
+ // replicating the preprocess logic which turns DCHECK() on).
gOriginalInitIMP = ObjcEvilDoers::SwizzleImplementedInstanceMethods(
[NSException class],
@selector(initWithName:reason:userInfo:),
- @selector(chromeInitWithName:reason:userInfo:));
- return YES;
+ @selector(crInitWithName:reason:userInfo:));
+
+ // Avoid loading broken input managers.
+ gOriginalNSBundleLoadIMP =
+ ObjcEvilDoers::SwizzleImplementedInstanceMethods(
+ [NSBundle class],
+ @selector(load),
+ @selector(crLoad));
}
} // namespace
@@ -214,8 +244,8 @@ BOOL SwizzleNSExceptionInit() {
ObjcEvilDoers::ZombieEnable(YES, 10000);
}
-- init {
- CHECK(SwizzleNSExceptionInit());
+- (id)init {
+ SwizzleInit();
return [super init];
}