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

Side by Side Diff: chrome/browser/chrome_browser_application_mac.mm

Issue 7748042: Merge trunk r97497 and its many dependents to the 14.0.835 branch. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/chrome_main.cc ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/chrome_browser_application_mac.h" 5 #import "chrome/browser/chrome_browser_application_mac.h"
6 6
7 #import "base/logging.h" 7 #import "base/logging.h"
8 #import "base/mac/mac_util.h"
9 #import "base/mac/scoped_nsexception_enabler.h" 8 #import "base/mac/scoped_nsexception_enabler.h"
10 #import "base/metrics/histogram.h" 9 #import "base/metrics/histogram.h"
11 #import "base/memory/scoped_nsobject.h" 10 #import "base/memory/scoped_nsobject.h"
12 #import "base/sys_string_conversions.h" 11 #import "base/sys_string_conversions.h"
13 #import "chrome/app/breakpad_mac.h" 12 #import "chrome/app/breakpad_mac.h"
14 #import "chrome/browser/app_controller_mac.h" 13 #import "chrome/browser/app_controller_mac.h"
15 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_list.h"
16 #import "chrome/browser/ui/cocoa/objc_method_swizzle.h" 15 #import "chrome/browser/ui/cocoa/objc_method_swizzle.h"
17 #import "chrome/browser/ui/cocoa/objc_zombie.h" 16 #import "chrome/browser/ui/cocoa/objc_zombie.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 << base::SysNSStringToUTF8(value); 114 << base::SysNSStringToUTF8(value);
116 DCHECK(allow); 115 DCHECK(allow);
117 } 116 }
118 } 117 }
119 118
120 // Forward to the original version. 119 // Forward to the original version.
121 return gOriginalInitIMP(self, _cmd, aName, aReason, someUserInfo); 120 return gOriginalInitIMP(self, _cmd, aName, aReason, someUserInfo);
122 } 121 }
123 @end 122 @end
124 123
125 static IMP gOriginalNSBundleLoadIMP = NULL;
126
127 @interface NSBundle (CrNSBundleSwizzle)
128 - (BOOL)crLoad;
129 @end
130
131 @implementation NSBundle (CrNSBundleSwizzle)
132 - (BOOL)crLoad {
133 // Method only called when swizzled.
134 DCHECK(_cmd == @selector(load));
135
136 // MultiClutchInputManager is broken in Chrome on Lion.
137 // http://crbug.com/90075.
138 if (base::mac::IsOSLionOrLater() &&
139 [[self bundleIdentifier]
140 isEqualToString:@"net.wonderboots.multiclutchinputmanager"]) {
141 return NO;
142 }
143
144 return gOriginalNSBundleLoadIMP(self, _cmd) != nil;
145 }
146 @end
147
148 namespace chrome_browser_application_mac { 124 namespace chrome_browser_application_mac {
149 125
150 // Maximum number of known named exceptions we'll support. There is 126 // Maximum number of known named exceptions we'll support. There is
151 // no central registration, but I only find about 75 possibilities in 127 // no central registration, but I only find about 75 possibilities in
152 // the system frameworks, and many of them are probably not 128 // the system frameworks, and many of them are probably not
153 // interesting to track in aggregate (those relating to distributed 129 // interesting to track in aggregate (those relating to distributed
154 // objects, for instance). 130 // objects, for instance).
155 const size_t kKnownNSExceptionCount = 25; 131 const size_t kKnownNSExceptionCount = 25;
156 132
157 const size_t kUnknownNSException = kKnownNSExceptionCount; 133 const size_t kUnknownNSException = kKnownNSExceptionCount;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 namespace { 194 namespace {
219 195
220 void SwizzleInit() { 196 void SwizzleInit() {
221 // Do-nothing wrapper so that we can arrange to only swizzle 197 // Do-nothing wrapper so that we can arrange to only swizzle
222 // -[NSException raise] when DCHECK() is turned on (as opposed to 198 // -[NSException raise] when DCHECK() is turned on (as opposed to
223 // replicating the preprocess logic which turns DCHECK() on). 199 // replicating the preprocess logic which turns DCHECK() on).
224 gOriginalInitIMP = ObjcEvilDoers::SwizzleImplementedInstanceMethods( 200 gOriginalInitIMP = ObjcEvilDoers::SwizzleImplementedInstanceMethods(
225 [NSException class], 201 [NSException class],
226 @selector(initWithName:reason:userInfo:), 202 @selector(initWithName:reason:userInfo:),
227 @selector(crInitWithName:reason:userInfo:)); 203 @selector(crInitWithName:reason:userInfo:));
228
229 // Avoid loading broken input managers.
230 gOriginalNSBundleLoadIMP =
231 ObjcEvilDoers::SwizzleImplementedInstanceMethods(
232 [NSBundle class],
233 @selector(load),
234 @selector(crLoad));
235 } 204 }
236 205
237 } // namespace 206 } // namespace
238 207
239 @implementation BrowserCrApplication 208 @implementation BrowserCrApplication
240 209
241 + (void)initialize { 210 + (void)initialize {
242 // Turn all deallocated Objective-C objects into zombies, keeping 211 // Turn all deallocated Objective-C objects into zombies, keeping
243 // the most recent 10,000 of them on the treadmill. 212 // the most recent 10,000 of them on the treadmill.
244 ObjcEvilDoers::ZombieEnable(YES, 10000); 213 ObjcEvilDoers::ZombieEnable(YES, 10000);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 if (RenderViewHost* rvh = contents->render_view_host()) { 429 if (RenderViewHost* rvh = contents->render_view_host()) {
461 rvh->EnableRendererAccessibility(); 430 rvh->EnableRendererAccessibility();
462 } 431 }
463 } 432 }
464 } 433 }
465 } 434 }
466 return [super accessibilitySetValue:value forAttribute:attribute]; 435 return [super accessibilitySetValue:value forAttribute:attribute];
467 } 436 }
468 437
469 @end 438 @end
OLDNEW
« no previous file with comments | « chrome/app/chrome_main.cc ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698