| 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 "chrome/grit/theme_resources.h" | 10 #include "chrome/grit/theme_resources.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 - (NSColor*)strokeColor { | 87 - (NSColor*)strokeColor { |
| 88 NSWindow* window = [self window]; | 88 NSWindow* window = [self window]; |
| 89 | 89 |
| 90 // Some views have a child NSWindow between them and the window that is | 90 // Some views have a child NSWindow between them and the window that is |
| 91 // active (e.g, OmniboxPopupTopSeparatorView). For these, check the status | 91 // active (e.g, OmniboxPopupTopSeparatorView). For these, check the status |
| 92 // of parentWindow instead. Note that this is not tracked correctly (but | 92 // of parentWindow instead. Note that this is not tracked correctly (but |
| 93 // the views that do this appear to be removed when the window loses focus | 93 // the views that do this appear to be removed when the window loses focus |
| 94 // anyway). | 94 // anyway). |
| 95 if ([window parentWindow]) | 95 if ([window parentWindow]) |
| 96 window = [window parentWindow]; | 96 window = [window parentWindow]; |
| 97 BOOL isActive = [window isMainWindow]; | |
| 98 | 97 |
| 99 const ui::ThemeProvider* themeProvider = [window themeProvider]; | 98 const ui::ThemeProvider* themeProvider = [window themeProvider]; |
| 100 if (!themeProvider) | 99 if (!themeProvider) |
| 101 return [NSColor blackColor]; | 100 return [NSColor blackColor]; |
| 102 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
| 103 return themeProvider->GetNSColor( | |
| 104 isActive ? ThemeProperties::COLOR_TOOLBAR_STROKE : | |
| 105 ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE); | |
| 106 } | |
| 107 return themeProvider->GetNSColor( | 101 return themeProvider->GetNSColor( |
| 108 ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); | 102 ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); |
| 109 } | 103 } |
| 110 | 104 |
| 111 - (NSColor*)backgroundImageColor { | 105 - (NSColor*)backgroundImageColor { |
| 112 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; | 106 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; |
| 113 if (!themeProvider) | 107 if (!themeProvider) |
| 114 return [[self window] backgroundColor]; | 108 return [[self window] backgroundColor]; |
| 115 | 109 |
| 116 // Themes don't have an inactive image so only look for one if there's no | 110 // Themes don't have an inactive image so only look for one if there's no |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 173 |
| 180 - (void)windowDidChangeTheme { | 174 - (void)windowDidChangeTheme { |
| 181 [self setNeedsDisplay:YES]; | 175 [self setNeedsDisplay:YES]; |
| 182 } | 176 } |
| 183 | 177 |
| 184 - (void)windowDidChangeActive { | 178 - (void)windowDidChangeActive { |
| 185 [self setNeedsDisplay:YES]; | 179 [self setNeedsDisplay:YES]; |
| 186 } | 180 } |
| 187 | 181 |
| 188 @end | 182 @end |
| OLD | NEW |