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_view.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/mac/sdk_forward_declarations.h" | 9 #include "base/mac/sdk_forward_declarations.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
11 #include "chrome/browser/themes/theme_properties.h" | 11 #include "chrome/browser/themes/theme_properties.h" |
12 #include "chrome/browser/themes/theme_service.h" | 12 #include "chrome/browser/themes/theme_service.h" |
13 #import "chrome/browser/ui/cocoa/tabs/media_indicator_button_cocoa.h" | 13 #import "chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.h" |
14 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" | 14 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" |
15 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" | 15 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
16 #import "chrome/browser/ui/cocoa/themed_window.h" | 16 #import "chrome/browser/ui/cocoa/themed_window.h" |
17 #import "chrome/browser/ui/cocoa/view_id_util.h" | 17 #import "chrome/browser/ui/cocoa/view_id_util.h" |
18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
19 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
20 #include "skia/ext/skia_utils_mac.h" | 20 #include "skia/ext/skia_utils_mac.h" |
21 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMFadeTruncatingTextFiel
dCell.h" | 21 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMFadeTruncatingTextFiel
dCell.h" |
22 #import "ui/base/cocoa/nsgraphics_context_additions.h" | 22 #import "ui/base/cocoa/nsgraphics_context_additions.h" |
23 #import "ui/base/cocoa/nsview_additions.h" | 23 #import "ui/base/cocoa/nsview_additions.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 if (alertState_ != tabs::kAlertNone) { | 619 if (alertState_ != tabs::kAlertNone) { |
620 alertState_ = tabs::kAlertFalling; | 620 alertState_ = tabs::kAlertFalling; |
621 alertHoldEndTime_ = | 621 alertHoldEndTime_ = |
622 [NSDate timeIntervalSinceReferenceDate] + kGlowUpdateInterval; | 622 [NSDate timeIntervalSinceReferenceDate] + kGlowUpdateInterval; |
623 [self resetLastGlowUpdateTime]; | 623 [self resetLastGlowUpdateTime]; |
624 [self adjustGlowValue]; | 624 [self adjustGlowValue]; |
625 } | 625 } |
626 } | 626 } |
627 | 627 |
628 - (int)widthOfLargestSelectableRegion { | 628 - (int)widthOfLargestSelectableRegion { |
629 // Assume the entire region to the left of the media indicator and/or close | 629 // Assume the entire region to the left of the alert indicator and/or close |
630 // buttons is available for click-to-select. If neither are visible, the | 630 // buttons is available for click-to-select. If neither are visible, the |
631 // entire tab region is available. | 631 // entire tab region is available. |
632 MediaIndicatorButton* const indicator = [controller_ mediaIndicatorButton]; | 632 AlertIndicatorButton* const indicator = [controller_ alertIndicatorButton]; |
633 const int indicatorLeft = (!indicator || [indicator isHidden]) ? | 633 const int indicatorLeft = (!indicator || [indicator isHidden]) ? |
634 NSWidth([self frame]) : NSMinX([indicator frame]); | 634 NSWidth([self frame]) : NSMinX([indicator frame]); |
635 HoverCloseButton* const closeButton = [controller_ closeButton]; | 635 HoverCloseButton* const closeButton = [controller_ closeButton]; |
636 const int closeButtonLeft = (!closeButton || [closeButton isHidden]) ? | 636 const int closeButtonLeft = (!closeButton || [closeButton isHidden]) ? |
637 NSWidth([self frame]) : NSMinX([closeButton frame]); | 637 NSWidth([self frame]) : NSMinX([closeButton frame]); |
638 return std::min(indicatorLeft, closeButtonLeft); | 638 return std::min(indicatorLeft, closeButtonLeft); |
639 } | 639 } |
640 | 640 |
641 - (BOOL)accessibilityIsIgnored { | 641 - (BOOL)accessibilityIsIgnored { |
642 return NO; | 642 return NO; |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 NSAffineTransform* transform = [NSAffineTransform transform]; | 937 NSAffineTransform* transform = [NSAffineTransform transform]; |
938 [transform scaleXBy:-1 yBy:1]; | 938 [transform scaleXBy:-1 yBy:1]; |
939 [transform translateXBy:-17.5 yBy:-0.25]; | 939 [transform translateXBy:-17.5 yBy:-0.25]; |
940 [bezierPath transformUsingAffineTransform:transform]; | 940 [bezierPath transformUsingAffineTransform:transform]; |
941 | 941 |
942 [[NSColor whiteColor] set]; | 942 [[NSColor whiteColor] set]; |
943 [bezierPath fill]; | 943 [bezierPath fill]; |
944 } | 944 } |
945 | 945 |
946 @end // @implementation TabView(MaterialDesign) | 946 @end // @implementation TabView(MaterialDesign) |
OLD | NEW |