1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#import "ui/base/cocoa/appkit_utils.h"
6
7#include <cmath>
8
9#include "base/mac/mac_util.h"
10#include "ui/base/resource/resource_bundle.h"
11
12namespace {
13
14// Double-click in window title bar actions.
15enum class DoubleClickAction {
16  NONE,
17  MINIMIZE,
18  MAXIMIZE,
19};
20
21// Values of com.apple.trackpad.forceClick corresponding to "Look up & data
22// detectors" in System Preferences -> Trackpad -> Point & Click.
23enum class ForceTouchAction {
24  NONE = 0,        // Unchecked or set to "Tap with three fingers".
25  QUICK_LOOK = 1,  // Set to "Force Click with one finger".
26};
27
28}  // namespace
29
30namespace ui {
31
32bool ForceClickInvokesQuickLook() {
33  return [[NSUserDefaults standardUserDefaults]
34             integerForKey:@"com.apple.trackpad.forceClick"] ==
35         static_cast<NSInteger>(ForceTouchAction::QUICK_LOOK);
36}
37
38bool IsCGFloatEqual(CGFloat a, CGFloat b) {
39  return std::fabs(a - b) <= std::numeric_limits<CGFloat>::epsilon();
40}
41
42}  // namespace ui
43