Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: chrome/browser/cocoa/bookmark_bar_toolbar_view.mm

Issue 384105: Mac: Animate the bookmark bar showing/hiding. (Closed)
Patch Set: Comments added per rohitrao's review. Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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)drawRectAsBubble:(NSRect)rect;
21 @end 21 @end
22 22
23 @implementation BookmarkBarToolbarView 23 @implementation BookmarkBarToolbarView
24 24
25 - (BOOL)isOpaque { 25 - (BOOL)isOpaque {
26 return [controller_ drawAsFloatingBar]; 26 return [controller_ isShownAsDetachedBar];
27 } 27 }
28 28
29 - (void)drawRect:(NSRect)rect { 29 - (void)drawRect:(NSRect)rect {
30 if ([controller_ drawAsFloatingBar]) { 30 if ([controller_ isShownAsDetachedBar]) {
31 [self drawRectAsFloating:rect]; 31 [self drawRectAsBubble:rect];
32 } else { 32 } else {
33 NSPoint phase = [self gtm_themePatternPhase]; 33 NSPoint phase = [self gtm_themePatternPhase];
34 [[NSGraphicsContext currentContext] setPatternPhase:phase]; 34 [[NSGraphicsContext currentContext] setPatternPhase:phase];
35 [self drawBackground]; 35 [self drawBackground];
36 } 36 }
37 } 37 }
38 38
39 - (void)drawRectAsFloating:(NSRect)rect { 39 - (void)drawRectAsBubble:(NSRect)rect {
40 NSRect bounds = [self bounds]; 40 NSRect bounds = [self bounds];
41 41
42 ThemeProvider* themeProvider = [controller_ themeProvider]; 42 ThemeProvider* themeProvider = [controller_ themeProvider];
43 if (!themeProvider) 43 if (!themeProvider)
44 return; 44 return;
45 45
46 NSGraphicsContext* theContext = [NSGraphicsContext currentContext]; 46 NSGraphicsContext* theContext = [NSGraphicsContext currentContext];
47 [theContext saveGraphicsState]; 47 [theContext saveGraphicsState];
48 48
49 // Draw the background 49 // Draw the background
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 NSColor* borderColor = 85 NSColor* borderColor =
86 [[self gtm_theme] strokeColorForStyle:GTMThemeStyleToolBarButton 86 [[self gtm_theme] strokeColorForStyle:GTMThemeStyleToolBarButton
87 state:GTMThemeStateActiveWindow]; 87 state:GTMThemeStateActiveWindow];
88 [borderColor set]; 88 [borderColor set];
89 [border stroke]; 89 [border stroke];
90 90
91 [theContext restoreGraphicsState]; 91 [theContext restoreGraphicsState];
92 } 92 }
93 93
94 @end // @implementation BookmarkBarToolbarView 94 @end // @implementation BookmarkBarToolbarView
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_toolbar_view.h ('k') | chrome/browser/cocoa/bookmark_bar_toolbar_view_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698