| 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 [context cr_setPatternPhase:[[self window] themePatternPhase] forView:self]; | 59 NSPoint phase = [[self window] themePatternPhaseForAlignment: |
| 60 THEME_PATTERN_ALIGN_WITH_TAB_STRIP]; |
| 61 [context cr_setPatternPhase:phase forView:self]; |
| 60 | 62 |
| 61 // 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 |
| 62 // theme. | 64 // theme. |
| 63 bool active = [[self window] isKeyWindow] || [[self window] isMainWindow] || | 65 bool active = [[self window] isKeyWindow] || [[self window] isMainWindow] || |
| 64 !themeProvider->UsingDefaultTheme(); | 66 !themeProvider->UsingDefaultTheme(); |
| 65 int resource_id = active ? IDR_THEME_TOOLBAR : IDR_THEME_TOOLBAR_INACTIVE; | 67 int resource_id = active ? IDR_THEME_TOOLBAR : IDR_THEME_TOOLBAR_INACTIVE; |
| 66 [themeProvider->GetNSImageColorNamed(resource_id, true) set]; | 68 [themeProvider->GetNSImageColorNamed(resource_id, true) set]; |
| 67 NSRectFill( | 69 NSRectFill( |
| 68 NSMakeRect(NSMinX(dirtyRect), 0, NSWidth(dirtyRect), backgroundHeight)); | 70 NSMakeRect(NSMinX(dirtyRect), 0, NSWidth(dirtyRect), backgroundHeight)); |
| 69 } | 71 } |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 268 |
| 267 - (void)setNewTabButton:(NewTabButton*)button { | 269 - (void)setNewTabButton:(NewTabButton*)button { |
| 268 newTabButton_.reset([button retain]); | 270 newTabButton_.reset([button retain]); |
| 269 } | 271 } |
| 270 | 272 |
| 271 - (void)setController:(TabStripController*)controller { | 273 - (void)setController:(TabStripController*)controller { |
| 272 controller_ = controller; | 274 controller_ = controller; |
| 273 } | 275 } |
| 274 | 276 |
| 275 @end | 277 @end |
| OLD | NEW |