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