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/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h" |
6 | 6 |
7 #include "app/theme_provider.h" | |
8 #include "gfx/rect.h" | 7 #include "gfx/rect.h" |
9 #include "chrome/browser/ntp_background_util.h" | 8 #include "chrome/browser/ntp_background_util.h" |
10 #include "chrome/browser/themes/browser_theme_provider.h" | 9 #include "chrome/browser/themes/browser_theme_provider.h" |
11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
14 #import "chrome/browser/ui/cocoa/themed_window.h" | 13 #import "chrome/browser/ui/cocoa/themed_window.h" |
15 #include "gfx/canvas_skia_paint.h" | 14 #include "gfx/canvas_skia_paint.h" |
| 15 #include "ui/base/theme_provider.h" |
16 | 16 |
17 const CGFloat kBorderRadius = 3.0; | 17 const CGFloat kBorderRadius = 3.0; |
18 | 18 |
19 @interface BookmarkBarToolbarView (Private) | 19 @interface BookmarkBarToolbarView (Private) |
20 - (void)drawRectAsBubble:(NSRect)rect; | 20 - (void)drawRectAsBubble:(NSRect)rect; |
21 @end | 21 @end |
22 | 22 |
23 @implementation BookmarkBarToolbarView | 23 @implementation BookmarkBarToolbarView |
24 | 24 |
25 - (BOOL)isOpaque { | 25 - (BOOL)isOpaque { |
(...skipping 12 matching lines...) Expand all Loading... |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 - (void)drawRectAsBubble:(NSRect)rect { | 41 - (void)drawRectAsBubble:(NSRect)rect { |
42 // The state of our morph; 1 is total bubble, 0 is the regular bar. We use it | 42 // The state of our morph; 1 is total bubble, 0 is the regular bar. We use it |
43 // to morph the bubble to a regular bar (shape and colour). | 43 // to morph the bubble to a regular bar (shape and colour). |
44 CGFloat morph = [controller_ detachedMorphProgress]; | 44 CGFloat morph = [controller_ detachedMorphProgress]; |
45 | 45 |
46 NSRect bounds = [self bounds]; | 46 NSRect bounds = [self bounds]; |
47 | 47 |
48 ThemeProvider* themeProvider = [controller_ themeProvider]; | 48 ui::ThemeProvider* themeProvider = [controller_ themeProvider]; |
49 if (!themeProvider) | 49 if (!themeProvider) |
50 return; | 50 return; |
51 | 51 |
52 NSGraphicsContext* context = [NSGraphicsContext currentContext]; | 52 NSGraphicsContext* context = [NSGraphicsContext currentContext]; |
53 [context saveGraphicsState]; | 53 [context saveGraphicsState]; |
54 | 54 |
55 // Draw the background. | 55 // Draw the background. |
56 { | 56 { |
57 // CanvasSkiaPaint draws to the NSGraphicsContext during its destructor, so | 57 // CanvasSkiaPaint draws to the NSGraphicsContext during its destructor, so |
58 // explicitly scope this. | 58 // explicitly scope this. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 NSWidth(bounds) - 2 * morph * bookmarks::kNTPBookmarkBarPadding - 2 * 0.5; | 126 NSWidth(bounds) - 2 * morph * bookmarks::kNTPBookmarkBarPadding - 2 * 0.5; |
127 [divider moveToPoint:dividerStart]; | 127 [divider moveToPoint:dividerStart]; |
128 [divider relativeLineToPoint:NSMakePoint(dividerWidth, 0)]; | 128 [divider relativeLineToPoint:NSMakePoint(dividerWidth, 0)]; |
129 [divider stroke]; | 129 [divider stroke]; |
130 | 130 |
131 // Restore the graphics context. | 131 // Restore the graphics context. |
132 [context restoreGraphicsState]; | 132 [context restoreGraphicsState]; |
133 } | 133 } |
134 | 134 |
135 @end // @implementation BookmarkBarToolbarView | 135 @end // @implementation BookmarkBarToolbarView |
OLD | NEW |