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

Unified Diff: ui/base/cocoa/appkit_utils.mm

Issue 1888343002: Mac: Honour the user preference for triggering QuickLook with Force Click (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: be explicit Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/cocoa/appkit_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cocoa/appkit_utils.mm
diff --git a/ui/base/cocoa/appkit_utils.mm b/ui/base/cocoa/appkit_utils.mm
index ce672699f5d16a602aa511987a549b75a9967ddd..1b0a61b2060314e77da4814f97610fc8f9590ded 100644
--- a/ui/base/cocoa/appkit_utils.mm
+++ b/ui/base/cocoa/appkit_utils.mm
@@ -9,12 +9,6 @@
namespace {
-// Gets an NSImage given an image id.
-NSImage* GetImage(int image_id) {
- return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(image_id)
- .ToNSImage();
-}
-
// Double-click in window title bar actions.
enum class DoubleClickAction {
NONE,
@@ -22,6 +16,20 @@ enum class DoubleClickAction {
MAXIMIZE,
};
+// Values of com.apple.trackpad.forceClick corresponding to "Look up & data
+// detectors" in System Preferences -> Trackpad -> Point & Click.
+enum class ForceTouchAction {
+ NONE = 0, // Unchecked or set to "Tap with three fingers".
+ QUICK_LOOK = 1, // Set to "Force Click with one finger".
+};
+
+// Gets an NSImage given an image id.
+NSImage* GetImage(int image_id) {
+ return ui::ResourceBundle::GetSharedInstance()
+ .GetNativeImageNamed(image_id)
+ .ToNSImage();
+}
+
// The action to take when the user double-clicks in the window title bar.
DoubleClickAction WindowTitleBarDoubleClickAction() {
// El Capitan introduced a Dock preference to configure the window title bar
@@ -95,4 +103,10 @@ void WindowTitlebarReceivedDoubleClick(NSWindow* window, id sender) {
}
}
+bool ForceClickInvokesQuickLook() {
+ return [[NSUserDefaults standardUserDefaults]
+ integerForKey:@"com.apple.trackpad.forceClick"] ==
+ static_cast<NSInteger>(ForceTouchAction::QUICK_LOOK);
+}
+
} // namespace ui
« no previous file with comments | « ui/base/cocoa/appkit_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698