OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tabs/tab_controller.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/mac/bundle_locations.h" | 11 #include "base/mac/bundle_locations.h" |
| 12 #include "base/metrics/user_metrics.h" |
12 #import "chrome/browser/themes/theme_properties.h" | 13 #import "chrome/browser/themes/theme_properties.h" |
13 #import "chrome/browser/themes/theme_service.h" | 14 #import "chrome/browser/themes/theme_service.h" |
14 #include "chrome/browser/ui/cocoa/l10n_util.h" | 15 #include "chrome/browser/ui/cocoa/l10n_util.h" |
15 #import "chrome/browser/ui/cocoa/sprite_view.h" | 16 #import "chrome/browser/ui/cocoa/sprite_view.h" |
16 #import "chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.h" | 17 #import "chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.h" |
17 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h" | 18 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h" |
18 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" | 19 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" |
19 #import "chrome/browser/ui/cocoa/themed_window.h" | 20 #import "chrome/browser/ui/cocoa/themed_window.h" |
20 #include "content/public/browser/user_metrics.h" | |
21 #import "extensions/common/extension.h" | 21 #import "extensions/common/extension.h" |
22 #import "ui/base/cocoa/menu_controller.h" | 22 #import "ui/base/cocoa/menu_controller.h" |
23 #include "ui/base/material_design/material_design_controller.h" | 23 #include "ui/base/material_design/material_design_controller.h" |
24 | 24 |
25 @implementation TabController | 25 @implementation TabController |
26 | 26 |
27 @synthesize action = action_; | 27 @synthesize action = action_; |
28 @synthesize loadingState = loadingState_; | 28 @synthesize loadingState = loadingState_; |
29 @synthesize pinned = pinned_; | 29 @synthesize pinned = pinned_; |
30 @synthesize target = target_; | 30 @synthesize target = target_; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 [[self target] performSelector:@selector(toggleMute:) | 193 [[self target] performSelector:@selector(toggleMute:) |
194 withObject:[self view]]; | 194 withObject:[self view]]; |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 - (void)closeTab:(id)sender { | 198 - (void)closeTab:(id)sender { |
199 using base::UserMetricsAction; | 199 using base::UserMetricsAction; |
200 | 200 |
201 if (alertIndicatorButton_ && ![alertIndicatorButton_ isHidden]) { | 201 if (alertIndicatorButton_ && ![alertIndicatorButton_ isHidden]) { |
202 if ([alertIndicatorButton_ isEnabled]) { | 202 if ([alertIndicatorButton_ isEnabled]) { |
203 content::RecordAction(UserMetricsAction("CloseTab_MuteToggleAvailable")); | 203 base::RecordAction(UserMetricsAction("CloseTab_MuteToggleAvailable")); |
204 } else if ([alertIndicatorButton_ showingAlertState] == | 204 } else if ([alertIndicatorButton_ showingAlertState] == |
205 TabAlertState::AUDIO_PLAYING) { | 205 TabAlertState::AUDIO_PLAYING) { |
206 content::RecordAction(UserMetricsAction("CloseTab_AudioIndicator")); | 206 base::RecordAction(UserMetricsAction("CloseTab_AudioIndicator")); |
207 } else { | 207 } else { |
208 content::RecordAction(UserMetricsAction("CloseTab_RecordingIndicator")); | 208 base::RecordAction(UserMetricsAction("CloseTab_RecordingIndicator")); |
209 } | 209 } |
210 } else { | 210 } else { |
211 content::RecordAction(UserMetricsAction("CloseTab_NoAlertIndicator")); | 211 base::RecordAction(UserMetricsAction("CloseTab_NoAlertIndicator")); |
212 } | 212 } |
213 | 213 |
214 if ([[self target] respondsToSelector:@selector(closeTab:)]) { | 214 if ([[self target] respondsToSelector:@selector(closeTab:)]) { |
215 [[self target] performSelector:@selector(closeTab:) | 215 [[self target] performSelector:@selector(closeTab:) |
216 withObject:[self view]]; | 216 withObject:[self view]]; |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 - (void)selectTab:(id)sender { | 220 - (void)selectTab:(id)sender { |
221 if ([[self tabView] isClosing]) | 221 if ([[self tabView] isClosing]) |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 [[target_ dragController] maybeStartDrag:event forTab:tab]; | 490 [[target_ dragController] maybeStartDrag:event forTab:tab]; |
491 } | 491 } |
492 | 492 |
493 - (void)keyUp:(NSEvent*)event { | 493 - (void)keyUp:(NSEvent*)event { |
494 unichar keyChar = [[event characters] characterAtIndex:0]; | 494 unichar keyChar = [[event characters] characterAtIndex:0]; |
495 if (keyChar == '\r' || keyChar == '\n') | 495 if (keyChar == '\r' || keyChar == '\n') |
496 [self selectTab:self]; | 496 [self selectTab:self]; |
497 } | 497 } |
498 | 498 |
499 @end | 499 @end |
OLD | NEW |