summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/mac/sdk_forward_declarations.h21
-rw-r--r--chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm16
2 files changed, 37 insertions, 0 deletions
diff --git a/base/mac/sdk_forward_declarations.h b/base/mac/sdk_forward_declarations.h
index bee324a..a6bf588 100644
--- a/base/mac/sdk_forward_declarations.h
+++ b/base/mac/sdk_forward_declarations.h
@@ -496,6 +496,27 @@ BASE_EXPORT extern NSString* const NSAppearanceNameVibrantDark;
- (void)viewDidLoad;
@end
+enum {
+ NSPressureBehaviorUnknown = -1,
+ NSPressureBehaviorPrimaryDefault = 0,
+ NSPressureBehaviorPrimaryClick = 1,
+ NSPressureBehaviorPrimaryGeneric = 2,
+ NSPressureBehaviorPrimaryAccelerator = 3,
+ NSPressureBehaviorPrimaryDeepClick = 5,
+ NSPressureBehaviorPrimaryDeepDrag = 6
+};
+typedef NSInteger NSPressureBehavior;
+
+@interface NSPressureConfiguration : NSObject
+- (instancetype)initWithPressureBehavior:(NSPressureBehavior)pressureBehavior;
+@end
+
+@class NSPressureConfiguration;
+
+@interface NSView (YosemiteSDK)
+- (void)setPressureConfiguration:(NSPressureConfiguration*)aConfiguration;
+@end
+
#endif // MAC_OS_X_VERSION_10_10
// ----------------------------------------------------------------------------
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
index 56532c0..7f2938c 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm
@@ -5,6 +5,8 @@
#import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
#include "base/logging.h"
+#import "base/mac/mac_util.h"
+#import "base/mac/sdk_forward_declarations.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
#import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
@@ -39,6 +41,20 @@ const CGFloat kAnimationDuration = 0.2;
resizeAnimation_.reset([[NSViewAnimation alloc] init]);
[resizeAnimation_ setDuration:kAnimationDuration];
[resizeAnimation_ setAnimationBlockingMode:NSAnimationNonblocking];
+
+ // Disable Force Touch in the Omnibox. Note that this API is defined in
+ // 10.10.3 and higher so have to check more than just isYosmiteOrLater().
+ // Also, because NSPressureConfiguration is not in the original 10.10 SDK,
+ // use NSClassFromString() to instantiate it (otherwise there's a
+ // linker error).
+ if (base::mac::IsOSYosemiteOrLater() &&
+ [self respondsToSelector:@selector(setPressureConfiguration:)]) {
+ NSPressureConfiguration* pressureConfiguration =
+ [[[NSClassFromString(@"NSPressureConfiguration") alloc]
+ initWithPressureBehavior:NSPressureBehaviorPrimaryClick]
+ autorelease];
+ [self setPressureConfiguration:pressureConfiguration];
+ }
}
- (void)flagsChanged:(NSEvent*)theEvent {