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_strip_view.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
6 | 6 |
7 #include <cmath> // floor | 7 #include <cmath> // floor |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 ThemeService* themeProvider = | 49 ThemeService* themeProvider = |
50 static_cast<ThemeService*>([[self window] themeProvider]); | 50 static_cast<ThemeService*>([[self window] themeProvider]); |
51 if (!themeProvider) | 51 if (!themeProvider) |
52 return; | 52 return; |
53 | 53 |
54 // First draw the toolbar bitmap, so that theme colors can shine through. | 54 // First draw the toolbar bitmap, so that theme colors can shine through. |
55 CGFloat backgroundHeight = 2 * [self cr_lineWidth]; | 55 CGFloat backgroundHeight = 2 * [self cr_lineWidth]; |
56 if (NSMinY(dirtyRect) < backgroundHeight) { | 56 if (NSMinY(dirtyRect) < backgroundHeight) { |
57 gfx::ScopedNSGraphicsContextSaveGState scopedGState; | 57 gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
58 NSGraphicsContext *context = [NSGraphicsContext currentContext]; | 58 NSGraphicsContext *context = [NSGraphicsContext currentContext]; |
59 NSPoint phase = [[self window] themePatternPhaseForAlignment: | 59 NSPoint position = [[self window] themeImagePositionForAlignment: |
60 THEME_PATTERN_ALIGN_WITH_TAB_STRIP]; | 60 THEME_IMAGE_ALIGN_WITH_TAB_STRIP]; |
61 [context cr_setPatternPhase:phase forView:self]; | 61 [context cr_setPatternPhase:position forView:self]; |
62 | 62 |
63 // Themes don't have an inactive image so only look for one if there's no | 63 // Themes don't have an inactive image so only look for one if there's no |
64 // theme. | 64 // theme. |
65 bool active = [[self window] isKeyWindow] || [[self window] isMainWindow] || | 65 bool active = [[self window] isKeyWindow] || [[self window] isMainWindow] || |
66 !themeProvider->UsingDefaultTheme(); | 66 !themeProvider->UsingDefaultTheme(); |
67 int resource_id = active ? IDR_THEME_TOOLBAR : IDR_THEME_TOOLBAR_INACTIVE; | 67 int resource_id = active ? IDR_THEME_TOOLBAR : IDR_THEME_TOOLBAR_INACTIVE; |
68 [themeProvider->GetNSImageColorNamed(resource_id, true) set]; | 68 [themeProvider->GetNSImageColorNamed(resource_id, true) set]; |
69 NSRectFill( | 69 NSRectFill( |
70 NSMakeRect(NSMinX(dirtyRect), 0, NSWidth(dirtyRect), backgroundHeight)); | 70 NSMakeRect(NSMinX(dirtyRect), 0, NSWidth(dirtyRect), backgroundHeight)); |
71 } | 71 } |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 - (void)setNewTabButton:(NewTabButton*)button { | 269 - (void)setNewTabButton:(NewTabButton*)button { |
270 newTabButton_.reset([button retain]); | 270 newTabButton_.reset([button retain]); |
271 } | 271 } |
272 | 272 |
273 - (void)setController:(TabStripController*)controller { | 273 - (void)setController:(TabStripController*)controller { |
274 controller_ = controller; | 274 controller_ = controller; |
275 } | 275 } |
276 | 276 |
277 @end | 277 @end |
OLD | NEW |