| 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/background_gradient_view.h" | 5 #include "chrome/browser/ui/cocoa/background_gradient_view.h" |
| 6 | 6 |
| 7 #import "chrome/browser/themes/theme_properties.h" | 7 #import "chrome/browser/themes/theme_properties.h" |
| 8 #import "chrome/browser/themes/theme_service.h" | 8 #import "chrome/browser/themes/theme_service.h" |
| 9 #import "chrome/browser/ui/cocoa/themed_window.h" | 9 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
| 11 #import "ui/base/cocoa/nsgraphics_context_additions.h" | 11 #import "ui/base/cocoa/nsgraphics_context_additions.h" |
| 12 #import "ui/base/cocoa/nsview_additions.h" | 12 #import "ui/base/cocoa/nsview_additions.h" |
| 13 #include "ui/base/material_design/material_design_controller.h" |
| 13 | 14 |
| 14 @interface BackgroundGradientView (Private) | 15 @interface BackgroundGradientView (Private) |
| 15 - (void)commonInit; | 16 - (void)commonInit; |
| 16 - (NSColor*)backgroundImageColor; | 17 - (NSColor*)backgroundImageColor; |
| 17 @end | 18 @end |
| 18 | 19 |
| 19 @implementation BackgroundGradientView | 20 @implementation BackgroundGradientView |
| 20 | 21 |
| 21 @synthesize showsDivider = showsDivider_; | 22 @synthesize showsDivider = showsDivider_; |
| 22 | 23 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // of parentWindow instead. Note that this is not tracked correctly (but | 88 // of parentWindow instead. Note that this is not tracked correctly (but |
| 88 // the views that do this appear to be removed when the window loses focus | 89 // the views that do this appear to be removed when the window loses focus |
| 89 // anyway). | 90 // anyway). |
| 90 if ([window parentWindow]) | 91 if ([window parentWindow]) |
| 91 window = [window parentWindow]; | 92 window = [window parentWindow]; |
| 92 BOOL isActive = [window isMainWindow]; | 93 BOOL isActive = [window isMainWindow]; |
| 93 | 94 |
| 94 const ui::ThemeProvider* themeProvider = [window themeProvider]; | 95 const ui::ThemeProvider* themeProvider = [window themeProvider]; |
| 95 if (!themeProvider) | 96 if (!themeProvider) |
| 96 return [NSColor blackColor]; | 97 return [NSColor blackColor]; |
| 98 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 99 return themeProvider->GetNSColor( |
| 100 isActive ? ThemeProperties::COLOR_TOOLBAR_STROKE : |
| 101 ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE); |
| 102 } |
| 97 return themeProvider->GetNSColor( | 103 return themeProvider->GetNSColor( |
| 98 isActive ? ThemeProperties::COLOR_TOOLBAR_STROKE : | 104 ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); |
| 99 ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE); | |
| 100 } | 105 } |
| 101 | 106 |
| 102 - (NSColor*)backgroundImageColor { | 107 - (NSColor*)backgroundImageColor { |
| 103 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; | 108 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; |
| 104 if (!themeProvider) | 109 if (!themeProvider) |
| 105 return [[self window] backgroundColor]; | 110 return [[self window] backgroundColor]; |
| 106 | 111 |
| 107 // Themes don't have an inactive image so only look for one if there's no | 112 // Themes don't have an inactive image so only look for one if there's no |
| 108 // theme. | 113 // theme. |
| 109 BOOL isActive = [[self window] isMainWindow]; | 114 BOOL isActive = [[self window] isMainWindow]; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 175 |
| 171 - (void)windowDidChangeTheme { | 176 - (void)windowDidChangeTheme { |
| 172 [self setNeedsDisplay:YES]; | 177 [self setNeedsDisplay:YES]; |
| 173 } | 178 } |
| 174 | 179 |
| 175 - (void)windowDidChangeActive { | 180 - (void)windowDidChangeActive { |
| 176 [self setNeedsDisplay:YES]; | 181 [self setNeedsDisplay:YES]; |
| 177 } | 182 } |
| 178 | 183 |
| 179 @end | 184 @end |
| OLD | NEW |