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 #include "chrome/browser/ui/title_prefix_matcher.h" | |
13 #import "chrome/common/extensions/extension.h" | 12 #import "chrome/common/extensions/extension.h" |
14 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
15 #import "third_party/GTM/AppKit/GTMFadeTruncatingTextFieldCell.h" | 14 #import "third_party/GTM/AppKit/GTMFadeTruncatingTextFieldCell.h" |
16 #include "ui/base/l10n/l10n_util_mac.h" | 15 #include "ui/base/l10n/l10n_util_mac.h" |
17 | 16 |
18 @implementation TabController | 17 @implementation TabController |
19 | 18 |
20 @synthesize action = action_; | 19 @synthesize action = action_; |
21 @synthesize app = app_; | 20 @synthesize app = app_; |
22 @synthesize loadingState = loadingState_; | 21 @synthesize loadingState = loadingState_; |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 312 |
314 // Called by the tabs to determine whether we are in rapid (tab) closure mode. | 313 // Called by the tabs to determine whether we are in rapid (tab) closure mode. |
315 - (BOOL)inRapidClosureMode { | 314 - (BOOL)inRapidClosureMode { |
316 if ([[self target] respondsToSelector:@selector(inRapidClosureMode)]) { | 315 if ([[self target] respondsToSelector:@selector(inRapidClosureMode)]) { |
317 return [[self target] performSelector:@selector(inRapidClosureMode)] ? | 316 return [[self target] performSelector:@selector(inRapidClosureMode)] ? |
318 YES : NO; | 317 YES : NO; |
319 } | 318 } |
320 return NO; | 319 return NO; |
321 } | 320 } |
322 | 321 |
323 - (void)setTitleCommonPrefixLength:(NSUInteger)length { | |
324 DCHECK([[titleView_ cell] isKindOfClass: | |
325 [GTMFadeTruncatingTextFieldCell class]]); | |
326 GTMFadeTruncatingTextFieldCell* cell = [titleView_ cell]; | |
327 [cell setDesiredCharactersToTruncateFromHead:length - | |
328 TitlePrefixMatcher::kCommonCharsToShow]; | |
329 [cell setTruncateMode:length > TitlePrefixMatcher::kMinElidingLength ? | |
330 GTMFadeTruncatingHeadAndTail : GTMFadeTruncatingTail]; | |
331 } | |
332 | |
333 @end | 322 @end |
OLD | NEW |