| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/cocoa/bookmark_bar_toolbar_view.h" | 5 #import "chrome/browser/cocoa/bookmark_bar_toolbar_view.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas_paint.h" | 7 #include "app/gfx/canvas_paint.h" |
| 8 #include "app/theme_provider.h" | 8 #include "app/theme_provider.h" |
| 9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
| 10 #include "chrome/browser/browser_theme_provider.h" | 10 #include "chrome/browser/browser_theme_provider.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // CanvasPaint draws to the NSGraphicsContext during its destructor, so | 69 // CanvasPaint draws to the NSGraphicsContext during its destructor, so |
| 70 // explicitly scope this. | 70 // explicitly scope this. |
| 71 gfx::CanvasPaint canvas(rect, true); | 71 gfx::CanvasPaint canvas(rect, true); |
| 72 gfx::Rect area(0, 0, NSWidth(rect), NSHeight(rect)); | 72 gfx::Rect area(0, 0, NSWidth(rect), NSHeight(rect)); |
| 73 | 73 |
| 74 NtpBackgroundUtil::PaintBackgroundDetachedMode(themeProvider, &canvas, | 74 NtpBackgroundUtil::PaintBackgroundDetachedMode(themeProvider, &canvas, |
| 75 area, [controller_ currentTabContentsHeight]); | 75 area, [controller_ currentTabContentsHeight]); |
| 76 } | 76 } |
| 77 | 77 |
| 78 // Draw our bookmark bar border on top of the background. | 78 // Draw our bookmark bar border on top of the background. |
| 79 NSRect frame_rect = | 79 NSRect frameRect = |
| 80 NSMakeRect(bookmarks::kNTPBookmarkBarPadding, | 80 NSMakeRect(bookmarks::kNTPBookmarkBarPadding, |
| 81 bookmarks::kNTPBookmarkBarPadding, | 81 bookmarks::kNTPBookmarkBarPadding, |
| 82 NSWidth(bounds) - 2 * bookmarks::kNTPBookmarkBarPadding, | 82 NSWidth(bounds) - 2 * bookmarks::kNTPBookmarkBarPadding, |
| 83 NSHeight(bounds) - 2 * bookmarks::kNTPBookmarkBarPadding); | 83 NSHeight(bounds) - 2 * bookmarks::kNTPBookmarkBarPadding); |
| 84 // Now draw a bezier path with rounded rectangles around the area | 84 // Now draw a bezier path with rounded rectangles around the area |
| 85 frameRect = NSInsetRect(frameRect, 0.5, 0.5); |
| 85 NSBezierPath* border = | 86 NSBezierPath* border = |
| 86 [NSBezierPath bezierPathWithRoundedRect:frame_rect | 87 [NSBezierPath bezierPathWithRoundedRect:frameRect |
| 87 xRadius:kBorderRadius | 88 xRadius:kBorderRadius |
| 88 yRadius:kBorderRadius]; | 89 yRadius:kBorderRadius]; |
| 89 NSColor* toolbarColor = | 90 NSColor* toolbarColor = |
| 90 [[self gtm_theme] backgroundColorForStyle:GTMThemeStyleToolBar | 91 [[self gtm_theme] backgroundColorForStyle:GTMThemeStyleToolBar |
| 91 state:GTMThemeStateActiveWindow]; | 92 state:GTMThemeStateActiveWindow]; |
| 92 // workaround for default theme | 93 // workaround for default theme |
| 93 // TODO(alcor) next GTM update return nil for background color if not set; | 94 // TODO(alcor) next GTM update return nil for background color if not set; |
| 94 // http://crbug.com/25196 | 95 // http://crbug.com/25196 |
| 95 if ([toolbarColor isEqual:[NSColor colorWithCalibratedWhite:0.5 alpha:1.0]]) | 96 if ([toolbarColor isEqual:[NSColor colorWithCalibratedWhite:0.5 alpha:1.0]]) |
| 96 toolbarColor = nil; | 97 toolbarColor = nil; |
| 97 if (!toolbarColor) | 98 if (!toolbarColor) |
| 98 toolbarColor = [NSColor colorWithCalibratedWhite:0.9 alpha:1.0]; | 99 toolbarColor = [NSColor colorWithCalibratedWhite:0.9 alpha:1.0]; |
| 99 [toolbarColor set]; | 100 [toolbarColor set]; |
| 100 [border fill]; | 101 [border fill]; |
| 101 | 102 |
| 102 NSColor* borderColor = | 103 NSColor* borderColor = |
| 103 [[self gtm_theme] strokeColorForStyle:GTMThemeStyleToolBar | 104 [[self gtm_theme] strokeColorForStyle:GTMThemeStyleToolBarButton |
| 104 state:GTMThemeStateActiveWindow]; | 105 state:GTMThemeStateActiveWindow]; |
| 105 [borderColor set]; | 106 [borderColor set]; |
| 106 [border stroke]; | 107 [border stroke]; |
| 107 | 108 |
| 108 [theContext restoreGraphicsState]; | 109 [theContext restoreGraphicsState]; |
| 109 } | 110 } |
| 110 | 111 |
| 111 @end // @implementation BookmarkBarToolbarView | 112 @end // @implementation BookmarkBarToolbarView |
| OLD | NEW |