OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ui/cocoa/tab_strip_view.h" | 5 #import "chrome/browser/ui/cocoa/tab_strip_view.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "chrome/browser/themes/browser_theme_provider.h" | 9 #include "chrome/browser/themes/browser_theme_provider.h" |
10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
11 #import "chrome/browser/ui/cocoa/tab_strip_controller.h" | 11 #import "chrome/browser/ui/cocoa/tab_strip_controller.h" |
12 #import "chrome/browser/ui/cocoa/view_id_util.h" | 12 #import "chrome/browser/ui/cocoa/view_id_util.h" |
13 | 13 |
14 @implementation TabStripView | 14 @implementation TabStripView |
15 | 15 |
16 @synthesize newTabButton = newTabButton_; | 16 @synthesize newTabButton = newTabButton_; |
17 @synthesize dropArrowShown = dropArrowShown_; | 17 @synthesize dropArrowShown = dropArrowShown_; |
18 @synthesize dropArrowPosition = dropArrowPosition_; | 18 @synthesize dropArrowPosition = dropArrowPosition_; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Double-clicks on Zoom/Close/Mininiaturize buttons shouldn't cause | 149 // Double-clicks on Zoom/Close/Mininiaturize buttons shouldn't cause |
150 // miniaturization. For those, we miss the first click but get the second | 150 // miniaturization. For those, we miss the first click but get the second |
151 // (with clickCount == 2!). We thus check that we got a first click shortly | 151 // (with clickCount == 2!). We thus check that we got a first click shortly |
152 // before (measured up-to-up) a double-click. Cocoa doesn't have a documented | 152 // before (measured up-to-up) a double-click. Cocoa doesn't have a documented |
153 // way of getting the proper interval (= (double-click-threshold) + | 153 // way of getting the proper interval (= (double-click-threshold) + |
154 // (drag-threshold); the former is Carbon GetDblTime()/60.0 or | 154 // (drag-threshold); the former is Carbon GetDblTime()/60.0 or |
155 // com.apple.mouse.doubleClickThreshold [undocumented]). So we hard-code | 155 // com.apple.mouse.doubleClickThreshold [undocumented]). So we hard-code |
156 // "short" as 0.8 seconds. (Measuring up-to-up isn't enough to properly | 156 // "short" as 0.8 seconds. (Measuring up-to-up isn't enough to properly |
157 // detect double-clicks, but we're actually using Cocoa for that.) | 157 // detect double-clicks, but we're actually using Cocoa for that.) |
158 if (clickCount == 2 && (timestamp - lastMouseUp_) < 0.8) { | 158 if (clickCount == 2 && (timestamp - lastMouseUp_) < 0.8) { |
159 if (mac_util::ShouldWindowsMiniaturizeOnDoubleClick()) | 159 if (base::mac::ShouldWindowsMiniaturizeOnDoubleClick()) |
160 [[self window] performMiniaturize:self]; | 160 [[self window] performMiniaturize:self]; |
161 } else { | 161 } else { |
162 [super mouseUp:event]; | 162 [super mouseUp:event]; |
163 } | 163 } |
164 | 164 |
165 // If clickCount is 0, the drag threshold was passed. | 165 // If clickCount is 0, the drag threshold was passed. |
166 lastMouseUp_ = (clickCount == 1) ? timestamp : -1000.0; | 166 lastMouseUp_ = (clickCount == 1) ? timestamp : -1000.0; |
167 } | 167 } |
168 | 168 |
169 // (URLDropTarget protocol) | 169 // (URLDropTarget protocol) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 return NSAccessibilityGroupRole; | 202 return NSAccessibilityGroupRole; |
203 | 203 |
204 return [super accessibilityAttributeValue:attribute]; | 204 return [super accessibilityAttributeValue:attribute]; |
205 } | 205 } |
206 | 206 |
207 - (ViewID)viewID { | 207 - (ViewID)viewID { |
208 return VIEW_ID_TAB_STRIP; | 208 return VIEW_ID_TAB_STRIP; |
209 } | 209 } |
210 | 210 |
211 @end | 211 @end |
OLD | NEW |