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

Unified Diff: chrome/browser/ui/cocoa/download/download_shelf_view_cocoa.mm

Issue 2336463002: Make the edge where BackgroundGradientView draws a divider selectable. (Closed)
Patch Set: Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/download/download_shelf_view_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/download/download_shelf_view_cocoa.mm b/chrome/browser/ui/cocoa/download/download_shelf_view_cocoa.mm
index 92dd23f985a34f5e67b16ecb8617858b0119cd8e..b8d911f1f85c6dd31ad7d811d61c5590bcf98af1 100644
--- a/chrome/browser/ui/cocoa/download/download_shelf_view_cocoa.mm
+++ b/chrome/browser/ui/cocoa/download/download_shelf_view_cocoa.mm
@@ -16,7 +16,7 @@
// For programmatic instantiations in unit tests.
- (id)initWithFrame:(NSRect)frameRect {
if ((self = [super initWithFrame:frameRect])) {
- [self setShowsDivider:NO];
+ [self commonInit];
}
return self;
}
@@ -24,24 +24,14 @@
// For nib instantiations in production.
- (id)initWithCoder:(NSCoder*)decoder {
if ((self = [super initWithCoder:decoder])) {
- [self setShowsDivider:NO];
+ [self commonInit];
}
return self;
}
-- (NSColor*)strokeColor {
- const ui::ThemeProvider* themeProvider = [[self window] themeProvider];
- if (!themeProvider) {
- return [NSColor blackColor];
- }
- if (!ui::MaterialDesignController::IsModeMaterial()) {
- BOOL isActive = [[self window] isMainWindow];
- return themeProvider->GetNSColor(
- isActive ? ThemeProperties::COLOR_TOOLBAR_STROKE :
- ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE);
- }
- return themeProvider->GetNSColor(
- ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR);
+- (void)commonInit {
+ self.divider = BackgroundGradientViewDivider::Top;
+ self.showsDivider = YES;
}
- (NSPoint)patternPhase {
@@ -52,37 +42,6 @@
0, NSHeight([self bounds]) + [TabStripController defaultTabHeight]);
}
-- (void)drawRect:(NSRect)dirtyRect {
- [super drawRect:dirtyRect];
-
- // Draw top stroke
- NSRect borderRect, contentRect;
- NSDivideRect([self bounds], &borderRect, &contentRect, [self cr_lineWidth],
- NSMaxYEdge);
- if (NSIntersectsRect(borderRect, dirtyRect)) {
- [[self strokeColor] set];
- NSRectFillUsingOperation(NSIntersectionRect(borderRect, dirtyRect),
- NSCompositeSourceOver);
- }
-
- // Draw the top highlight
- borderRect.origin.y -= [self cr_lineWidth];
- if (NSIntersectsRect(borderRect, dirtyRect)) {
- const ui::ThemeProvider* themeProvider = [[self window] themeProvider];
- if (themeProvider) {
- int resourceName = themeProvider->UsingSystemTheme()
- ? ThemeProperties::COLOR_TOOLBAR_BEZEL
- : ThemeProperties::COLOR_TOOLBAR;
- NSColor* highlightColor = themeProvider->GetNSColor(resourceName);
- if (highlightColor) {
- [highlightColor set];
- NSRectFillUsingOperation(NSIntersectionRect(borderRect, dirtyRect),
- NSCompositeSourceOver);
- }
- }
- }
-}
Nico 2016/09/12 13:45:55 Is this appearance-preserving?
Sidney San Martín 2016/09/14 17:46:59 It is now, as far as I can tell.
-
// Mouse down events on the download shelf should not allow dragging the parent
// window around.
- (BOOL)mouseDownCanMoveWindow {

Powered by Google App Engine
This is Rietveld 408576698