OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bookmarks/bookmark_bar_toolbar_view.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h" |
6 | 6 |
7 #include "chrome/browser/search/search.h" | 7 #include "chrome/browser/search/search.h" |
8 #include "chrome/browser/themes/theme_properties.h" | 8 #include "chrome/browser/themes/theme_properties.h" |
9 #include "chrome/browser/themes/theme_service.h" | 9 #include "chrome/browser/themes/theme_service.h" |
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 Profile* profile = [controller_ profile]; | 48 Profile* profile = [controller_ profile]; |
49 if (!profile) | 49 if (!profile) |
50 return; | 50 return; |
51 | 51 |
52 [[NSColor whiteColor] set]; | 52 [[NSColor whiteColor] set]; |
53 NSRectFill(dirtyRect); | 53 NSRectFill(dirtyRect); |
54 | 54 |
55 // Overlay with a lighter background color. | 55 // Overlay with a lighter background color. |
56 const ui::ThemeProvider& tp = | 56 const ui::ThemeProvider& tp = |
57 ThemeService::GetThemeProviderForProfile(profile); | 57 ThemeService::GetThemeProviderForProfile(profile); |
58 NSColor* toolbarColor = | 58 NSColor* toolbarColor = tp.GetNSColor(ThemeProperties::COLOR_NTP_BACKGROUND); |
59 tp.GetNSColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND); | |
60 CGFloat alpha = morph * [toolbarColor alphaComponent]; | 59 CGFloat alpha = morph * [toolbarColor alphaComponent]; |
61 [[toolbarColor colorWithAlphaComponent:alpha] set]; | 60 [[toolbarColor colorWithAlphaComponent:alpha] set]; |
62 NSRectFillUsingOperation(dirtyRect, NSCompositeSourceOver); | 61 NSRectFillUsingOperation(dirtyRect, NSCompositeSourceOver); |
63 | 62 |
64 // Fade in/out the background. | 63 // Fade in/out the background. |
65 { | 64 { |
66 gfx::ScopedNSGraphicsContextSaveGState bgScopedState; | 65 gfx::ScopedNSGraphicsContextSaveGState bgScopedState; |
67 NSGraphicsContext* context = [NSGraphicsContext currentContext]; | 66 NSGraphicsContext* context = [NSGraphicsContext currentContext]; |
68 CGContextRef cgContext = static_cast<CGContextRef>([context graphicsPort]); | 67 CGContextRef cgContext = static_cast<CGContextRef>([context graphicsPort]); |
69 CGContextSetAlpha(cgContext, 1 - morph); | 68 CGContextSetAlpha(cgContext, 1 - morph); |
(...skipping 11 matching lines...) Expand all Loading... |
81 strokeColor = [[self strokeColor] blendedColorWithFraction:morph | 80 strokeColor = [[self strokeColor] blendedColorWithFraction:morph |
82 ofColor:strokeColor]; | 81 ofColor:strokeColor]; |
83 strokeColor = [strokeColor colorWithAlphaComponent:0.5]; | 82 strokeColor = [strokeColor colorWithAlphaComponent:0.5]; |
84 [strokeColor set]; | 83 [strokeColor set]; |
85 NSRectFillUsingOperation(NSIntersectionRect(strokeRect, dirtyRect), | 84 NSRectFillUsingOperation(NSIntersectionRect(strokeRect, dirtyRect), |
86 NSCompositeSourceOver); | 85 NSCompositeSourceOver); |
87 } | 86 } |
88 } | 87 } |
89 | 88 |
90 @end // @implementation BookmarkBarToolbarView | 89 @end // @implementation BookmarkBarToolbarView |
OLD | NEW |