OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/mac/mac_util.h" | 5 #include "base/mac/mac_util.h" |
6 #import "chrome/browser/themes/theme_service.h" | 6 #import "chrome/browser/themes/theme_service.h" |
7 #import "chrome/browser/ui/cocoa/menu_controller.h" | 7 #import "chrome/browser/ui/cocoa/menu_controller.h" |
8 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" | 8 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" |
9 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h" | 9 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h" |
10 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" | 10 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" |
11 #import "chrome/browser/ui/cocoa/themed_window.h" | 11 #import "chrome/browser/ui/cocoa/themed_window.h" |
12 #import "chrome/common/extensions/extension.h" | 12 #import "chrome/common/extensions/extension.h" |
13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
14 #import "third_party/GTM/AppKit/GTMFadeTruncatingTextFieldCell.h" | 14 #import "third_party/GTM/AppKit/GTMFadeTruncatingTextFieldCell.h" |
15 #include "ui/base/l10n/l10n_util_mac.h" | 15 #include "ui/base/l10n/l10n_util_mac.h" |
16 | 16 |
17 @implementation TabController | 17 @implementation TabController |
18 | 18 |
19 @synthesize action = action_; | 19 @synthesize action = action_; |
20 @synthesize app = app_; | 20 @synthesize app = app_; |
21 @synthesize loadingState = loadingState_; | 21 @synthesize loadingState = loadingState_; |
22 @synthesize mini = mini_; | 22 @synthesize mini = mini_; |
23 @synthesize pinned = pinned_; | 23 @synthesize pinned = pinned_; |
24 @synthesize target = target_; | 24 @synthesize target = target_; |
25 @synthesize url = url_; | |
25 @synthesize iconView = iconView_; | 26 @synthesize iconView = iconView_; |
26 @synthesize titleView = titleView_; | 27 @synthesize titleView = titleView_; |
27 @synthesize closeButton = closeButton_; | 28 @synthesize closeButton = closeButton_; |
28 | 29 |
29 namespace TabControllerInternal { | 30 namespace TabControllerInternal { |
30 | 31 |
31 // A C++ delegate that handles enabling/disabling menu items and handling when | 32 // A C++ delegate that handles enabling/disabling menu items and handling when |
32 // a menu command is chosen. Also fixes up the menu item label for "pin/unpin | 33 // a menu command is chosen. Also fixes up the menu item label for "pin/unpin |
33 // tab". | 34 // tab". |
34 class MenuDelegate : public ui::SimpleMenuModel::Delegate { | 35 class MenuDelegate : public ui::SimpleMenuModel::Delegate { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 return [[self target] performSelector:@selector(inRapidClosureMode)] ? | 302 return [[self target] performSelector:@selector(inRapidClosureMode)] ? |
302 YES : NO; | 303 YES : NO; |
303 } | 304 } |
304 return NO; | 305 return NO; |
305 } | 306 } |
306 | 307 |
307 - (void)setTitleCommonPrefixLength:(NSUInteger)length { | 308 - (void)setTitleCommonPrefixLength:(NSUInteger)length { |
308 DCHECK([[titleView_ cell] isKindOfClass: | 309 DCHECK([[titleView_ cell] isKindOfClass: |
309 [GTMFadeTruncatingTextFieldCell class]]); | 310 [GTMFadeTruncatingTextFieldCell class]]); |
310 GTMFadeTruncatingTextFieldCell* cell = [titleView_ cell]; | 311 GTMFadeTruncatingTextFieldCell* cell = [titleView_ cell]; |
311 [cell setDesiredCharactersToTruncateFromHead:length]; | 312 [cell setDesiredCharactersToTruncateFromHead:length - 4]; |
Peter Kasting
2011/04/01 17:28:31
Nit: Use constants for these and put the constants
MAD
2011/04/01 19:47:37
Done.
| |
312 [cell setTruncateMode:length > 0 ? GTMFadeTruncatingHeadAndTail : | 313 [cell setTruncateMode:length > 7 ? GTMFadeTruncatingHeadAndTail : |
313 GTMFadeTruncatingTail]; | 314 GTMFadeTruncatingTail]; |
314 } | 315 } |
315 | 316 |
316 @end | 317 @end |
OLD | NEW |