Home | History | Annotate | Download | only in download
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/ui/cocoa/download/background_theme.h"
      6 
      7 #import "chrome/browser/themes/theme_properties.h"
      8 
      9 BackgroundTheme::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 
     28 BackgroundTheme::~BackgroundTheme() {}
     29 
     30 bool BackgroundTheme::UsingSystemTheme() const {
     31   return true;
     32 }
     33 
     34 gfx::ImageSkia* BackgroundTheme::GetImageSkiaNamed(int id) const {
     35   return NULL;
     36 }
     37 
     38 SkColor BackgroundTheme::GetColor(int id) const {
     39   return SkColor();
     40 }
     41 
     42 int BackgroundTheme::GetDisplayProperty(int id) const {
     43   return -1;
     44 }
     45 
     46 bool BackgroundTheme::ShouldUseNativeFrame() const {
     47   return false;
     48 }
     49 
     50 bool BackgroundTheme::HasCustomImage(int id) const {
     51   return false;
     52 }
     53 
     54 base::RefCountedMemory* BackgroundTheme::GetRawData(
     55     int id,
     56     ui::ScaleFactor scale_factor) const {
     57   return NULL;
     58 }
     59 
     60 NSImage* BackgroundTheme::GetNSImageNamed(int id) const {
     61   return nil;
     62 }
     63 
     64 NSColor* BackgroundTheme::GetNSImageColorNamed(int id) const {
     65   return nil;
     66 }
     67 
     68 NSColor* BackgroundTheme::GetNSColor(int id) const {
     69   return provider_->GetNSColor(id);
     70 }
     71 
     72 NSColor* BackgroundTheme::GetNSColorTint(int id) const {
     73   if (id == ThemeProperties::TINT_BUTTONS)
     74     return borderColor_.get();
     75 
     76   return provider_->GetNSColorTint(id);
     77 }
     78 
     79 NSGradient* BackgroundTheme::GetNSGradient(int id) const {
     80   switch (id) {
     81     case ThemeProperties::GRADIENT_TOOLBAR_BUTTON:
     82     case ThemeProperties::GRADIENT_TOOLBAR_BUTTON_INACTIVE:
     83       return buttonGradient_.get();
     84     case ThemeProperties::GRADIENT_TOOLBAR_BUTTON_PRESSED:
     85     case ThemeProperties::GRADIENT_TOOLBAR_BUTTON_PRESSED_INACTIVE:
     86       return buttonPressedGradient_.get();
     87     default:
     88       return provider_->GetNSGradient(id);
     89   }
     90 }
     91 
     92 
     93