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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/sdk_forward_declarations.h" |
8 #include "chrome/browser/themes/theme_service.h" | 9 #include "chrome/browser/themes/theme_service.h" |
9 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 10 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
10 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" | 11 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" |
11 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" | 12 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
12 #import "chrome/browser/ui/cocoa/themed_window.h" | 13 #import "chrome/browser/ui/cocoa/themed_window.h" |
13 #import "chrome/browser/ui/cocoa/view_id_util.h" | 14 #import "chrome/browser/ui/cocoa/view_id_util.h" |
14 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
15 #include "grit/theme_resources.h" | 16 #include "grit/theme_resources.h" |
16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
18 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 19 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
19 | 20 |
20 #if !defined(MAC_OS_X_VERSION_10_7) || \ | |
21 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | |
22 @interface NSWindow (LionAPI) | |
23 - (CGFloat)backingScaleFactor; | |
24 @end | |
25 #endif | |
26 | 21 |
27 const int kMaskHeight = 29; // Height of the mask bitmap. | 22 const int kMaskHeight = 29; // Height of the mask bitmap. |
28 const int kFillHeight = 25; // Height of the "mask on" part of the mask bitmap. | 23 const int kFillHeight = 25; // Height of the "mask on" part of the mask bitmap. |
29 | 24 |
30 | |
31 // Constants for inset and control points for tab shape. | 25 // Constants for inset and control points for tab shape. |
32 const CGFloat kInsetMultiplier = 2.0/3.0; | 26 const CGFloat kInsetMultiplier = 2.0/3.0; |
33 const CGFloat kControlPoint1Multiplier = 1.0/3.0; | 27 const CGFloat kControlPoint1Multiplier = 1.0/3.0; |
34 const CGFloat kControlPoint2Multiplier = 3.0/8.0; | 28 const CGFloat kControlPoint2Multiplier = 3.0/8.0; |
35 | 29 |
36 // The amount of time in seconds during which each type of glow increases, holds | 30 // The amount of time in seconds during which each type of glow increases, holds |
37 // steady, and decreases, respectively. | 31 // steady, and decreases, respectively. |
38 const NSTimeInterval kHoverShowDuration = 0.2; | 32 const NSTimeInterval kHoverShowDuration = 0.2; |
39 const NSTimeInterval kHoverHoldDuration = 0.02; | 33 const NSTimeInterval kHoverHoldDuration = 0.02; |
40 const NSTimeInterval kHoverHideDuration = 0.4; | 34 const NSTimeInterval kHoverHideDuration = 0.4; |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 CGFloat middleWidth = tabWidth - leftWidth - rightWidth; | 694 CGFloat middleWidth = tabWidth - leftWidth - rightWidth; |
701 NSRect middleRect = NSMakeRect(leftWidth, 0, middleWidth, kFillHeight); | 695 NSRect middleRect = NSMakeRect(leftWidth, 0, middleWidth, kFillHeight); |
702 [[NSColor whiteColor] setFill]; | 696 [[NSColor whiteColor] setFill]; |
703 NSRectFill(middleRect); | 697 NSRectFill(middleRect); |
704 | 698 |
705 maskCache_.reset(CGBitmapContextCreateImage(maskContext)); | 699 maskCache_.reset(CGBitmapContextCreateImage(maskContext)); |
706 return maskCache_; | 700 return maskCache_; |
707 } | 701 } |
708 | 702 |
709 @end // @implementation TabView(Private) | 703 @end // @implementation TabView(Private) |
OLD | NEW |