| 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" |
| 11 #import "chrome/browser/cocoa/browser_window_controller.h" | 11 #import "chrome/browser/cocoa/browser_window_controller.h" |
| 12 #import "chrome/browser/cocoa/bookmark_bar_constants.h" | 12 #import "chrome/browser/cocoa/bookmark_bar_constants.h" |
| 13 #import "chrome/browser/cocoa/bookmark_bar_controller.h" | 13 #import "chrome/browser/cocoa/bookmark_bar_controller.h" |
| 14 #include "chrome/browser/ntp_background_util.h" | 14 #include "chrome/browser/ntp_background_util.h" |
| 15 #import "third_party/GTM/AppKit/GTMTheme.h" | 15 #import "third_party/GTM/AppKit/GTMTheme.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)drawRectAsFloating:(NSRect)rect; | 20 - (void)drawRectAsFloating:(NSRect)rect; |
| 21 @end | 21 @end |
| 22 | 22 |
| 23 @implementation BookmarkBarToolbarView | 23 @implementation BookmarkBarToolbarView |
| 24 | 24 |
| 25 - (BOOL)isOpaque { | 25 - (BOOL)isOpaque { |
| 26 return YES; | 26 return [controller_ drawAsFloatingBar]; |
| 27 } | 27 } |
| 28 | 28 |
| 29 - (void)drawRect:(NSRect)rect { | 29 - (void)drawRect:(NSRect)rect { |
| 30 if ([controller_ drawAsFloatingBar]) { | 30 if ([controller_ drawAsFloatingBar]) { |
| 31 [self drawRectAsFloating:rect]; | 31 [self drawRectAsFloating:rect]; |
| 32 } else { | 32 } else { |
| 33 [super drawRect:rect]; | 33 NSPoint phase = [self gtm_themePatternPhase]; |
| 34 [[NSGraphicsContext currentContext] setPatternPhase:phase]; |
| 35 [self drawBackground]; |
| 34 } | 36 } |
| 35 } | 37 } |
| 36 | 38 |
| 37 - (void)layoutViews { | 39 - (void)layoutViews { |
| 38 if ([controller_ drawAsFloatingBar]) { | 40 if ([controller_ drawAsFloatingBar]) { |
| 39 // The internal bookmark bar should have padding to center it. | 41 // The internal bookmark bar should have padding to center it. |
| 40 NSRect frame = [self frame]; | 42 NSRect frame = [self frame]; |
| 41 [buttonView_ setFrame: | 43 [buttonView_ setFrame: |
| 42 NSMakeRect(bookmarks::kNTPBookmarkBarPadding, | 44 NSMakeRect(bookmarks::kNTPBookmarkBarPadding, |
| 43 bookmarks::kNTPBookmarkBarPadding, | 45 bookmarks::kNTPBookmarkBarPadding, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 [themeProvider->GetNSColor(BrowserThemeProvider::COLOR_TOOLBAR) set];; | 94 [themeProvider->GetNSColor(BrowserThemeProvider::COLOR_TOOLBAR) set];; |
| 93 [border fill]; | 95 [border fill]; |
| 94 | 96 |
| 95 [themeProvider->GetNSColor(BrowserThemeProvider::COLOR_NTP_HEADER) set]; | 97 [themeProvider->GetNSColor(BrowserThemeProvider::COLOR_NTP_HEADER) set]; |
| 96 [border stroke]; | 98 [border stroke]; |
| 97 | 99 |
| 98 [theContext restoreGraphicsState]; | 100 [theContext restoreGraphicsState]; |
| 99 } | 101 } |
| 100 | 102 |
| 101 @end // @implementation BookmarkBarToolbarView | 103 @end // @implementation BookmarkBarToolbarView |
| OLD | NEW |