| 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 if (!ui::MaterialDesignController::IsModeMaterial()) { | 55 BOOL active = [[self window] isMainWindow]; |
| 56 BOOL active = [[self window] isMainWindow]; | |
| 57 return themeProvider->GetNSColor( | |
| 58 active ? ThemeProperties::COLOR_TOOLBAR_STROKE : | |
| 59 ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE); | |
| 60 } | |
| 61 return themeProvider->GetNSColor( | 56 return themeProvider->GetNSColor( |
| 62 ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); | 57 active ? ThemeProperties::COLOR_TOOLBAR_STROKE : |
| 58 ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE); |
| 63 } | 59 } |
| 64 | 60 |
| 65 - (void)drawRect:(NSRect)rect { | 61 - (void)drawRect:(NSRect)rect { |
| 66 NSRect bounds = [self bounds]; | 62 NSRect bounds = [self bounds]; |
| 67 if (ui::MaterialDesignController::IsModeMaterial()) { | 63 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 68 bounds.size.height = InfoBarContainerDelegate::kDefaultBarTargetHeightMd; | 64 bounds.size.height = InfoBarContainerDelegate::kDefaultBarTargetHeightMd; |
| 69 } else { | 65 } else { |
| 70 bounds.size.height = InfoBarContainerDelegate::kDefaultBarTargetHeight; | 66 bounds.size.height = InfoBarContainerDelegate::kDefaultBarTargetHeight; |
| 71 } | 67 } |
| 72 CGFloat tipXOffset = arrowX_ - arrowHalfWidth_; | 68 CGFloat tipXOffset = arrowX_ - arrowHalfWidth_; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 141 } |
| 146 | 142 |
| 147 - (void)setHasTip:(BOOL)hasTip { | 143 - (void)setHasTip:(BOOL)hasTip { |
| 148 if (hasTip_ == hasTip) | 144 if (hasTip_ == hasTip) |
| 149 return; | 145 return; |
| 150 hasTip_ = hasTip; | 146 hasTip_ = hasTip; |
| 151 [self setNeedsDisplay:YES]; | 147 [self setNeedsDisplay:YES]; |
| 152 } | 148 } |
| 153 | 149 |
| 154 @end | 150 @end |
| OLD | NEW |