| 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/themes/theme_service.h" | 5 #include "chrome/browser/themes/theme_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 return Properties::GetDefaultColor(id); | 284 return Properties::GetDefaultColor(id); |
| 285 } | 285 } |
| 286 | 286 |
| 287 int ThemeService::GetDisplayProperty(int id) const { | 287 int ThemeService::GetDisplayProperty(int id) const { |
| 288 int result = 0; | 288 int result = 0; |
| 289 if (theme_supplier_.get() && | 289 if (theme_supplier_.get() && |
| 290 theme_supplier_->GetDisplayProperty(id, &result)) { | 290 theme_supplier_->GetDisplayProperty(id, &result)) { |
| 291 return result; | 291 return result; |
| 292 } | 292 } |
| 293 | 293 |
| 294 if (id == Properties::NTP_LOGO_ALTERNATE) { | 294 switch (id) { |
| 295 if (UsingDefaultTheme() || UsingSystemTheme()) | 295 case Properties::NTP_BACKGROUND_ALIGNMENT: |
| 296 return 0; // Colorful logo. | 296 return Properties::ALIGN_CENTER; |
| 297 | 297 |
| 298 if (HasCustomImage(IDR_THEME_NTP_BACKGROUND)) | 298 case Properties::NTP_BACKGROUND_TILING: |
| 299 return 1; // White logo. | 299 return Properties::NO_REPEAT; |
| 300 | 300 |
| 301 SkColor background_color = GetColor(Properties::COLOR_NTP_BACKGROUND); | 301 case Properties::NTP_LOGO_ALTERNATE: |
| 302 return IsColorGrayscale(background_color) ? 0 : 1; | 302 return UsingDefaultTheme() || UsingSystemTheme() || |
| 303 (!HasCustomImage(IDR_THEME_NTP_BACKGROUND) && |
| 304 IsColorGrayscale(GetColor(Properties::COLOR_NTP_BACKGROUND))) ? |
| 305 0 : 1; |
| 306 |
| 307 default: |
| 308 return -1; |
| 303 } | 309 } |
| 304 | |
| 305 return Properties::GetDefaultDisplayProperty(id); | |
| 306 } | 310 } |
| 307 | 311 |
| 308 bool ThemeService::ShouldUseNativeFrame() const { | 312 bool ThemeService::ShouldUseNativeFrame() const { |
| 309 if (HasCustomImage(IDR_THEME_FRAME)) | 313 if (HasCustomImage(IDR_THEME_FRAME)) |
| 310 return false; | 314 return false; |
| 311 #if defined(OS_WIN) | 315 #if defined(OS_WIN) |
| 312 return ui::win::IsAeroGlassEnabled(); | 316 return ui::win::IsAeroGlassEnabled(); |
| 313 #else | 317 #else |
| 314 return false; | 318 return false; |
| 315 #endif | 319 #endif |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 void ThemeService::OnInfobarDestroyed() { | 684 void ThemeService::OnInfobarDestroyed() { |
| 681 number_of_infobars_--; | 685 number_of_infobars_--; |
| 682 | 686 |
| 683 if (number_of_infobars_ == 0) | 687 if (number_of_infobars_ == 0) |
| 684 RemoveUnusedThemes(false); | 688 RemoveUnusedThemes(false); |
| 685 } | 689 } |
| 686 | 690 |
| 687 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { | 691 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { |
| 688 return theme_syncable_service_.get(); | 692 return theme_syncable_service_.get(); |
| 689 } | 693 } |
| OLD | NEW |