| 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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 const CGFloat kRapidCloseDist = 2.5; | 46 const CGFloat kRapidCloseDist = 2.5; |
| 47 | 47 |
| 48 @interface TabView(MaterialDesign) | 48 @interface TabView(MaterialDesign) |
| 49 + (void)drawTabLeftMaskImage; | 49 + (void)drawTabLeftMaskImage; |
| 50 + (void)drawTabRightMaskImage; | 50 + (void)drawTabRightMaskImage; |
| 51 + (void)drawTabLeftEdgeImage; | 51 + (void)drawTabLeftEdgeImage; |
| 52 + (void)drawTabMiddleEdgeImage; | 52 + (void)drawTabMiddleEdgeImage; |
| 53 + (void)drawTabRightEdgeImage; | 53 + (void)drawTabRightEdgeImage; |
| 54 @end | 54 @end |
| 55 | 55 |
| 56 @interface TabController(Private) |
| 57 // The TabView's close button. |
| 58 - (HoverCloseButton*)closeButton; |
| 59 @end |
| 60 |
| 56 namespace { | 61 namespace { |
| 57 | 62 |
| 58 NSImage* imageForResourceID(int resource_id) { | 63 NSImage* imageForResourceID(int resource_id) { |
| 59 if (!ui::MaterialDesignController::IsModeMaterial()) { | 64 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 60 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 65 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 61 return [rb.GetNativeImageNamed(resource_id).CopyNSImage() autorelease]; | 66 return [rb.GetNativeImageNamed(resource_id).CopyNSImage() autorelease]; |
| 62 } | 67 } |
| 63 | 68 |
| 64 CGFloat imageWidth = resource_id == IDR_TAB_ACTIVE_CENTER ? 1 : 18; | 69 CGFloat imageWidth = resource_id == IDR_TAB_ACTIVE_CENTER ? 1 : 18; |
| 65 SEL theSelector = 0; | 70 SEL theSelector = 0; |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 return [titleView_ isHidden]; | 588 return [titleView_ isHidden]; |
| 584 } | 589 } |
| 585 | 590 |
| 586 - (void)setTitleHidden:(BOOL)titleHidden { | 591 - (void)setTitleHidden:(BOOL)titleHidden { |
| 587 if (titleHidden == [titleView_ isHidden]) | 592 if (titleHidden == [titleView_ isHidden]) |
| 588 return; | 593 return; |
| 589 [titleView_ setHidden:titleHidden]; | 594 [titleView_ setHidden:titleHidden]; |
| 590 [self setNeedsDisplayInRect:[titleView_ frame]]; | 595 [self setNeedsDisplayInRect:[titleView_ frame]]; |
| 591 } | 596 } |
| 592 | 597 |
| 598 - (SkColor)closeButtonColor { |
| 599 return [[controller_ closeButton] iconColor]; |
| 600 } |
| 601 |
| 593 - (void)setState:(NSCellStateValue)state { | 602 - (void)setState:(NSCellStateValue)state { |
| 594 if (state_ == state) | 603 if (state_ == state) |
| 595 return; | 604 return; |
| 596 state_ = state; | 605 state_ = state; |
| 597 [self setNeedsDisplay:YES]; | 606 [self setNeedsDisplay:YES]; |
| 598 } | 607 } |
| 599 | 608 |
| 600 - (void)setClosing:(BOOL)closing { | 609 - (void)setClosing:(BOOL)closing { |
| 601 closing_ = closing; // Safe because the property is nonatomic. | 610 closing_ = closing; // Safe because the property is nonatomic. |
| 602 // When closing, ensure clicks to the close button go nowhere. | 611 // When closing, ensure clicks to the close button go nowhere. |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 NSAffineTransform* transform = [NSAffineTransform transform]; | 946 NSAffineTransform* transform = [NSAffineTransform transform]; |
| 938 [transform scaleXBy:-1 yBy:1]; | 947 [transform scaleXBy:-1 yBy:1]; |
| 939 [transform translateXBy:-17.5 yBy:-0.25]; | 948 [transform translateXBy:-17.5 yBy:-0.25]; |
| 940 [bezierPath transformUsingAffineTransform:transform]; | 949 [bezierPath transformUsingAffineTransform:transform]; |
| 941 | 950 |
| 942 [[NSColor whiteColor] set]; | 951 [[NSColor whiteColor] set]; |
| 943 [bezierPath fill]; | 952 [bezierPath fill]; |
| 944 } | 953 } |
| 945 | 954 |
| 946 @end // @implementation TabView(MaterialDesign) | 955 @end // @implementation TabView(MaterialDesign) |
| OLD | NEW |