Chromium Code Reviews| 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_folder_window.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_window.h" |
| 6 | 6 |
| 7 #import "base/logging.h" | 7 #import "base/logging.h" |
| 8 #import "base/memory/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
| 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
| 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" |
| 11 #import "third_party/GTM/AppKit/GTMNSBezierPath+RoundRect.h" | |
| 11 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" | 12 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" |
| 12 #import "third_party/GTM/AppKit/GTMNSBezierPath+RoundRect.h" | |
| 13 | 13 |
| 14 using bookmarks::kBookmarkBarMenuCornerRadius; | 14 using bookmarks::kBookmarkBarMenuCornerRadius; |
| 15 | 15 |
| 16 @implementation BookmarkBarFolderWindow | 16 @implementation BookmarkBarFolderWindow |
| 17 | 17 |
| 18 - (id)initWithContentRect:(NSRect)contentRect | 18 - (id)initWithContentRect:(NSRect)contentRect |
| 19 styleMask:(NSUInteger)windowStyle | 19 styleMask:(NSUInteger)windowStyle |
| 20 backing:(NSBackingStoreType)bufferingType | 20 backing:(NSBackingStoreType)bufferingType |
| 21 defer:(BOOL)deferCreation { | 21 defer:(BOOL)deferCreation { |
| 22 if ((self = [super initWithContentRect:contentRect | 22 if ((self = [super initWithContentRect:contentRect |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 53 topLeftCornerRadius:kBookmarkBarMenuCornerRadius | 53 topLeftCornerRadius:kBookmarkBarMenuCornerRadius |
| 54 topRightCornerRadius:kBookmarkBarMenuCornerRadius | 54 topRightCornerRadius:kBookmarkBarMenuCornerRadius |
| 55 bottomLeftCornerRadius:kBookmarkBarMenuCornerRadius | 55 bottomLeftCornerRadius:kBookmarkBarMenuCornerRadius |
| 56 bottomRightCornerRadius:kBookmarkBarMenuCornerRadius]; | 56 bottomRightCornerRadius:kBookmarkBarMenuCornerRadius]; |
| 57 NSColor* startColor = [NSColor colorWithCalibratedWhite:0.91 alpha:1.0]; | 57 NSColor* startColor = [NSColor colorWithCalibratedWhite:0.91 alpha:1.0]; |
| 58 NSColor* midColor = | 58 NSColor* midColor = |
| 59 [startColor gtm_colorAdjustedFor:GTMColorationLightMidtone faded:YES]; | 59 [startColor gtm_colorAdjustedFor:GTMColorationLightMidtone faded:YES]; |
| 60 NSColor* endColor = | 60 NSColor* endColor = |
| 61 [startColor gtm_colorAdjustedFor:GTMColorationLightPenumbra faded:YES]; | 61 [startColor gtm_colorAdjustedFor:GTMColorationLightPenumbra faded:YES]; |
| 62 | 62 |
| 63 scoped_nsobject<NSGradient> gradient( | 63 base::scoped_nsobject<NSGradient> gradient( |
| 64 [[NSGradient alloc] initWithColorsAndLocations:startColor, 0.0, | 64 [[NSGradient alloc] initWithColorsAndLocations:startColor, 0.0, |
| 65 midColor, 0.25, | 65 midColor, 0.25, |
| 66 endColor, 0.5, | 66 endColor, 0.5, |
| 67 midColor, 0.75, | 67 midColor, 0.75, |
| 68 startColor, 1.0, | 68 startColor, 1.0, |
| 69 nil]); | 69 nil]); |
|
Nico
2013/06/25 01:09:50
Filed PR16435 and PR16436 for this.
| |
| 70 [gradient drawInBezierPath:bezier angle:0.0]; | 70 [gradient drawInBezierPath:bezier angle:0.0]; |
| 71 } | 71 } |
| 72 | 72 |
| 73 @end | 73 @end |
| 74 | 74 |
| 75 | 75 |
| 76 @implementation BookmarkBarFolderWindowScrollView | 76 @implementation BookmarkBarFolderWindowScrollView |
| 77 | 77 |
| 78 // We want "draw background" of the NSScrollView in the xib to be NOT | 78 // We want "draw background" of the NSScrollView in the xib to be NOT |
| 79 // checked. That allows us to round the bottom corners of the folder | 79 // checked. That allows us to round the bottom corners of the folder |
| 80 // window. However that also allows some scrollWheel: events to leak | 80 // window. However that also allows some scrollWheel: events to leak |
| 81 // into the NSWindow behind it (even in a different application). | 81 // into the NSWindow behind it (even in a different application). |
| 82 // Better to plug the scroll leak than to round corners for M5. | 82 // Better to plug the scroll leak than to round corners for M5. |
| 83 - (void)scrollWheel:(NSEvent *)theEvent { | 83 - (void)scrollWheel:(NSEvent *)theEvent { |
| 84 DCHECK([[[self window] windowController] | 84 DCHECK([[[self window] windowController] |
| 85 respondsToSelector:@selector(scrollWheel:)]); | 85 respondsToSelector:@selector(scrollWheel:)]); |
| 86 [[[self window] windowController] scrollWheel:theEvent]; | 86 [[[self window] windowController] scrollWheel:theEvent]; |
| 87 } | 87 } |
| 88 | 88 |
| 89 @end | 89 @end |
| OLD | NEW |