| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h" | 5 #include "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h" |
| 6 | 6 |
| 7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #import "chrome/browser/themes/theme_properties.h" | 8 #import "chrome/browser/themes/theme_properties.h" |
| 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 10 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 10 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 initWithStartingColor:skia::SkColorToCalibratedNSColor(topColor) | 45 initWithStartingColor:skia::SkColorToCalibratedNSColor(topColor) |
| 46 endingColor:skia::SkColorToCalibratedNSColor(bottomColor)]); | 46 endingColor:skia::SkColorToCalibratedNSColor(bottomColor)]); |
| 47 [self setGradient:gradient]; | 47 [self setGradient:gradient]; |
| 48 } | 48 } |
| 49 | 49 |
| 50 - (NSColor*)strokeColor { | 50 - (NSColor*)strokeColor { |
| 51 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; | 51 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; |
| 52 if (!themeProvider) | 52 if (!themeProvider) |
| 53 return [NSColor blackColor]; | 53 return [NSColor blackColor]; |
| 54 | 54 |
| 55 BOOL active = [[self window] isMainWindow]; | 55 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 56 BOOL active = [[self window] isMainWindow]; |
| 57 return themeProvider->GetNSColor( |
| 58 active ? ThemeProperties::COLOR_TOOLBAR_STROKE : |
| 59 ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE); |
| 60 } |
| 56 return themeProvider->GetNSColor( | 61 return themeProvider->GetNSColor( |
| 57 active ? ThemeProperties::COLOR_TOOLBAR_STROKE : | 62 ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); |
| 58 ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE); | |
| 59 } | 63 } |
| 60 | 64 |
| 61 - (void)drawRect:(NSRect)rect { | 65 - (void)drawRect:(NSRect)rect { |
| 62 NSRect bounds = [self bounds]; | 66 NSRect bounds = [self bounds]; |
| 63 if (ui::MaterialDesignController::IsModeMaterial()) { | 67 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 64 bounds.size.height = InfoBarContainerDelegate::kDefaultBarTargetHeightMd; | 68 bounds.size.height = InfoBarContainerDelegate::kDefaultBarTargetHeightMd; |
| 65 } else { | 69 } else { |
| 66 bounds.size.height = InfoBarContainerDelegate::kDefaultBarTargetHeight; | 70 bounds.size.height = InfoBarContainerDelegate::kDefaultBarTargetHeight; |
| 67 } | 71 } |
| 68 CGFloat tipXOffset = arrowX_ - arrowHalfWidth_; | 72 CGFloat tipXOffset = arrowX_ - arrowHalfWidth_; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 145 } |
| 142 | 146 |
| 143 - (void)setHasTip:(BOOL)hasTip { | 147 - (void)setHasTip:(BOOL)hasTip { |
| 144 if (hasTip_ == hasTip) | 148 if (hasTip_ == hasTip) |
| 145 return; | 149 return; |
| 146 hasTip_ = hasTip; | 150 hasTip_ = hasTip; |
| 147 [self setNeedsDisplay:YES]; | 151 [self setNeedsDisplay:YES]; |
| 148 } | 152 } |
| 149 | 153 |
| 150 @end | 154 @end |
| OLD | NEW |