| 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/toolbar/toolbar_view_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_view_cocoa.h" |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/view_id_util.h" | 7 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 8 #import "ui/base/cocoa/nsview_additions.h" | 8 #import "ui/base/cocoa/nsview_additions.h" |
| 9 #include "ui/base/material_design/material_design_controller.h" |
| 9 | 10 |
| 10 @implementation ToolbarView | 11 @implementation ToolbarView |
| 11 | 12 |
| 12 @synthesize dividerOpacity = dividerOpacity_; | 13 @synthesize dividerOpacity = dividerOpacity_; |
| 13 | 14 |
| 14 // Prevent mouse down events from moving the parent window around. | 15 // Prevent mouse down events from moving the parent window around. |
| 15 - (BOOL)mouseDownCanMoveWindow { | 16 - (BOOL)mouseDownCanMoveWindow { |
| 16 return NO; | 17 return NO; |
| 17 } | 18 } |
| 18 | 19 |
| 19 - (void)drawRect:(NSRect)dirtyRect { | 20 - (void)drawRect:(NSRect)dirtyRect { |
| 20 [self drawBackground:dirtyRect]; | 21 [self drawBackground:dirtyRect]; |
| 21 } | 22 } |
| 22 | 23 |
| 23 // Override of |-[BackgroundGradientView strokeColor]|; make it respect opacity. | 24 // Override of |-[BackgroundGradientView strokeColor]|; make it respect opacity. |
| 24 - (NSColor*)strokeColor { | 25 - (NSColor*)strokeColor { |
| 25 return [[super strokeColor] colorWithAlphaComponent:[self dividerOpacity]]; | 26 // Only return a transparent color if not Material Design. |
| 27 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 28 return [[super strokeColor] colorWithAlphaComponent:[self dividerOpacity]]; |
| 29 } |
| 30 return [super strokeColor]; |
| 26 } | 31 } |
| 27 | 32 |
| 28 - (BOOL)accessibilityIsIgnored { | 33 - (BOOL)accessibilityIsIgnored { |
| 29 return NO; | 34 return NO; |
| 30 } | 35 } |
| 31 | 36 |
| 32 - (id)accessibilityAttributeValue:(NSString*)attribute { | 37 - (id)accessibilityAttributeValue:(NSString*)attribute { |
| 33 if ([attribute isEqual:NSAccessibilityRoleAttribute]) | 38 if ([attribute isEqual:NSAccessibilityRoleAttribute]) |
| 34 return NSAccessibilityToolbarRole; | 39 return NSAccessibilityToolbarRole; |
| 35 | 40 |
| 36 return [super accessibilityAttributeValue:attribute]; | 41 return [super accessibilityAttributeValue:attribute]; |
| 37 } | 42 } |
| 38 | 43 |
| 39 - (ViewID)viewID { | 44 - (ViewID)viewID { |
| 40 return VIEW_ID_TOOLBAR; | 45 return VIEW_ID_TOOLBAR; |
| 41 } | 46 } |
| 42 | 47 |
| 43 - (BOOL)isOpaque { | 48 - (BOOL)isOpaque { |
| 44 return YES; | 49 return YES; |
| 45 } | 50 } |
| 46 | 51 |
| 47 // ThemedWindowDrawing overrides. | 52 // ThemedWindowDrawing overrides. |
| 48 | 53 |
| 49 - (void)windowDidChangeActive { | 54 - (void)windowDidChangeActive { |
| 50 // Need to redraw the omnibox and toolbar buttons as well. | 55 // Need to redraw the omnibox and toolbar buttons as well. |
| 51 [self cr_recursivelySetNeedsDisplay:YES]; | 56 [self cr_recursivelySetNeedsDisplay:YES]; |
| 52 } | 57 } |
| 53 | 58 |
| 54 @end | 59 @end |
| OLD | NEW |