blob: eb7ffcf6652460640f76f9a3f0d5fbf8e81ca370 [file] [log] [blame]
Torne (Richard Coles)58218062012-11-14 11:43:16 +00001// 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
3// found in the LICENSE file.
4
5#include "chrome/browser/ui/cocoa/download/background_theme.h"
6
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +00007#import "chrome/browser/themes/theme_properties.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +00008
9BackgroundTheme::BackgroundTheme(ui::ThemeProvider* provider) :
10 provider_(provider) {
11 NSColor* bgColor = [NSColor colorWithCalibratedRed:241/255.0
12 green:245/255.0
13 blue:250/255.0
14 alpha:77/255.0];
15 NSColor* clickedColor = [NSColor colorWithCalibratedRed:239/255.0
16 green:245/255.0
17 blue:252/255.0
18 alpha:51/255.0];
19
20 borderColor_.reset(
21 [[NSColor colorWithCalibratedWhite:0 alpha:36/255.0] retain]);
22 buttonGradient_.reset([[NSGradient alloc]
23 initWithColors:[NSArray arrayWithObject:bgColor]]);
24 buttonPressedGradient_.reset([[NSGradient alloc]
25 initWithColors:[NSArray arrayWithObject:clickedColor]]);
26}
27
28BackgroundTheme::~BackgroundTheme() {}
29
30gfx::ImageSkia* BackgroundTheme::GetImageSkiaNamed(int id) const {
31 return NULL;
32}
33
34SkColor BackgroundTheme::GetColor(int id) const {
35 return SkColor();
36}
37
38bool BackgroundTheme::GetDisplayProperty(int id, int* result) const {
39 return false;
40}
41
42bool BackgroundTheme::ShouldUseNativeFrame() const {
43 return false;
44}
45
46bool BackgroundTheme::HasCustomImage(int id) const {
47 return false;
48}
49
50base::RefCountedMemory* BackgroundTheme::GetRawData(
51 int id,
52 ui::ScaleFactor scale_factor) const {
53 return NULL;
54}
55
Ben Murdochbb1529c2013-08-08 10:24:53 +010056NSImage* BackgroundTheme::GetNSImageNamed(int id) const {
Torne (Richard Coles)58218062012-11-14 11:43:16 +000057 return nil;
58}
59
Ben Murdochbb1529c2013-08-08 10:24:53 +010060NSColor* BackgroundTheme::GetNSImageColorNamed(int id) const {
Torne (Richard Coles)58218062012-11-14 11:43:16 +000061 return nil;
62}
63
Ben Murdochbb1529c2013-08-08 10:24:53 +010064NSColor* BackgroundTheme::GetNSColor(int id) const {
65 return provider_->GetNSColor(id);
Torne (Richard Coles)58218062012-11-14 11:43:16 +000066}
67
Ben Murdochbb1529c2013-08-08 10:24:53 +010068NSColor* BackgroundTheme::GetNSColorTint(int id) const {
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000069 if (id == ThemeProperties::TINT_BUTTONS)
Torne (Richard Coles)58218062012-11-14 11:43:16 +000070 return borderColor_.get();
71
Ben Murdochbb1529c2013-08-08 10:24:53 +010072 return provider_->GetNSColorTint(id);
Torne (Richard Coles)58218062012-11-14 11:43:16 +000073}
74
75NSGradient* BackgroundTheme::GetNSGradient(int id) const {
76 switch (id) {
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000077 case ThemeProperties::GRADIENT_TOOLBAR_BUTTON:
78 case ThemeProperties::GRADIENT_TOOLBAR_BUTTON_INACTIVE:
Torne (Richard Coles)58218062012-11-14 11:43:16 +000079 return buttonGradient_.get();
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000080 case ThemeProperties::GRADIENT_TOOLBAR_BUTTON_PRESSED:
81 case ThemeProperties::GRADIENT_TOOLBAR_BUTTON_PRESSED_INACTIVE:
Torne (Richard Coles)58218062012-11-14 11:43:16 +000082 return buttonPressedGradient_.get();
83 default:
84 return provider_->GetNSGradient(id);
85 }
86}
87
88