| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/tab_view.h" | 5 #import "chrome/browser/cocoa/tab_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/nsimage_cache_mac.h" | 8 #include "base/nsimage_cache_mac.h" |
| 9 #include "chrome/browser/browser_theme_provider.h" | 9 #include "chrome/browser/browser_theme_provider.h" |
| 10 #import "chrome/browser/cocoa/tab_controller.h" | 10 #import "chrome/browser/cocoa/tab_controller.h" |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 [[self superview] convertPoint:[theEvent locationInWindow] | 591 [[self superview] convertPoint:[theEvent locationInWindow] |
| 592 fromView:nil]; | 592 fromView:nil]; |
| 593 // If the mouse up occurred in our view or over the close button, then | 593 // If the mouse up occurred in our view or over the close button, then |
| 594 // close. | 594 // close. |
| 595 if ([self hitTest:upLocation]) | 595 if ([self hitTest:upLocation]) |
| 596 [controller_ closeTab:self]; | 596 [controller_ closeTab:self]; |
| 597 } | 597 } |
| 598 } | 598 } |
| 599 | 599 |
| 600 - (void)drawRect:(NSRect)rect { | 600 - (void)drawRect:(NSRect)rect { |
| 601 // If this tab is phantom, do not draw the tab background itself. The only UI | |
| 602 // element that will represent this tab is the favicon. | |
| 603 if ([controller_ phantom]) | |
| 604 return; | |
| 605 | |
| 606 NSGraphicsContext* context = [NSGraphicsContext currentContext]; | 601 NSGraphicsContext* context = [NSGraphicsContext currentContext]; |
| 607 [context saveGraphicsState]; | 602 [context saveGraphicsState]; |
| 608 rect = [self bounds]; | 603 rect = [self bounds]; |
| 609 BOOL active = [[self window] isKeyWindow] || [[self window] isMainWindow]; | 604 BOOL active = [[self window] isKeyWindow] || [[self window] isMainWindow]; |
| 610 BOOL selected = [self state]; | 605 BOOL selected = [self state]; |
| 611 | 606 |
| 612 // Outset by 0.5 in order to draw on pixels rather than on borders (which | 607 // Outset by 0.5 in order to draw on pixels rather than on borders (which |
| 613 // would cause blurry pixels). Subtract 1px of height to compensate, | 608 // would cause blurry pixels). Subtract 1px of height to compensate, |
| 614 // otherwise clipping will occur. | 609 // otherwise clipping will occur. |
| 615 rect = NSInsetRect(rect, -0.5, -0.5); | 610 rect = NSInsetRect(rect, -0.5, -0.5); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 } | 952 } |
| 958 | 953 |
| 959 if (nextUpdate < kNoUpdate) | 954 if (nextUpdate < kNoUpdate) |
| 960 [self performSelector:_cmd withObject:nil afterDelay:nextUpdate]; | 955 [self performSelector:_cmd withObject:nil afterDelay:nextUpdate]; |
| 961 | 956 |
| 962 [self resetLastGlowUpdateTime]; | 957 [self resetLastGlowUpdateTime]; |
| 963 [self setNeedsDisplay:YES]; | 958 [self setNeedsDisplay:YES]; |
| 964 } | 959 } |
| 965 | 960 |
| 966 @end // @implementation TabView(Private) | 961 @end // @implementation TabView(Private) |
| OLD | NEW |