| 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 #import "chrome/browser/ui/cocoa/download/download_shelf_view_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/download/download_shelf_view_cocoa.h" |
| 6 | 6 |
| 7 #include "chrome/browser/themes/theme_properties.h" | 7 #include "chrome/browser/themes/theme_properties.h" |
| 8 #include "chrome/browser/themes/theme_service.h" | 8 #include "chrome/browser/themes/theme_service.h" |
| 9 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 9 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 10 #import "chrome/browser/ui/cocoa/view_id_util.h" | 10 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 11 #import "ui/base/cocoa/nsview_additions.h" | 11 #import "ui/base/cocoa/nsview_additions.h" |
| 12 #include "ui/base/material_design/material_design_controller.h" |
| 12 | 13 |
| 13 @implementation DownloadShelfView | 14 @implementation DownloadShelfView |
| 14 | 15 |
| 15 // For programmatic instantiations in unit tests. | 16 // For programmatic instantiations in unit tests. |
| 16 - (id)initWithFrame:(NSRect)frameRect { | 17 - (id)initWithFrame:(NSRect)frameRect { |
| 17 if ((self = [super initWithFrame:frameRect])) { | 18 if ((self = [super initWithFrame:frameRect])) { |
| 18 [self setShowsDivider:NO]; | 19 [self setShowsDivider:NO]; |
| 19 } | 20 } |
| 20 return self; | 21 return self; |
| 21 } | 22 } |
| 22 | 23 |
| 23 // For nib instantiations in production. | 24 // For nib instantiations in production. |
| 24 - (id)initWithCoder:(NSCoder*)decoder { | 25 - (id)initWithCoder:(NSCoder*)decoder { |
| 25 if ((self = [super initWithCoder:decoder])) { | 26 if ((self = [super initWithCoder:decoder])) { |
| 26 [self setShowsDivider:NO]; | 27 [self setShowsDivider:NO]; |
| 27 } | 28 } |
| 28 return self; | 29 return self; |
| 29 } | 30 } |
| 30 | 31 |
| 31 - (NSColor*)strokeColor { | 32 - (NSColor*)strokeColor { |
| 32 BOOL isActive = [[self window] isMainWindow]; | |
| 33 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; | 33 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; |
| 34 return themeProvider ? themeProvider->GetNSColor( | 34 if (!themeProvider) { |
| 35 isActive ? ThemeProperties::COLOR_TOOLBAR_STROKE : | 35 return [NSColor blackColor]; |
| 36 ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE) : | 36 } |
| 37 [NSColor blackColor]; | 37 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 38 BOOL isActive = [[self window] isMainWindow]; |
| 39 return themeProvider->GetNSColor( |
| 40 isActive ? ThemeProperties::COLOR_TOOLBAR_STROKE : |
| 41 ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE); |
| 42 } |
| 43 return themeProvider->GetNSColor( |
| 44 ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); |
| 38 } | 45 } |
| 39 | 46 |
| 40 - (NSPoint)patternPhase { | 47 - (NSPoint)patternPhase { |
| 41 // We want our backgrounds for the shelf to be phased from the upper | 48 // We want our backgrounds for the shelf to be phased from the upper |
| 42 // left hand corner of the view. Offset it by tab height so that the | 49 // left hand corner of the view. Offset it by tab height so that the |
| 43 // background matches the toolbar background. | 50 // background matches the toolbar background. |
| 44 return NSMakePoint( | 51 return NSMakePoint( |
| 45 0, NSHeight([self bounds]) + [TabStripController defaultTabHeight]); | 52 0, NSHeight([self bounds]) + [TabStripController defaultTabHeight]); |
| 46 } | 53 } |
| 47 | 54 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 91 |
| 85 - (ViewID)viewID { | 92 - (ViewID)viewID { |
| 86 return VIEW_ID_DOWNLOAD_SHELF; | 93 return VIEW_ID_DOWNLOAD_SHELF; |
| 87 } | 94 } |
| 88 | 95 |
| 89 - (BOOL)isOpaque { | 96 - (BOOL)isOpaque { |
| 90 return YES; | 97 return YES; |
| 91 } | 98 } |
| 92 | 99 |
| 93 @end | 100 @end |
| OLD | NEW |