| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/themes/browser_theme_pack.h" | 15 #include "chrome/browser/themes/browser_theme_pack.h" |
| 16 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
| 17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 20 #include "content/public/browser/user_metrics.h" | 20 #include "content/public/browser/user_metrics.h" |
| 21 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
| 22 #include "grit/ui_resources.h" | 22 #include "grit/ui_resources.h" |
| 23 #include "ui/base/layout.h" | 23 #include "ui/base/layout.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 25 #include "ui/gfx/image/image_skia.h" | 25 #include "ui/gfx/image/image_skia.h" |
| 26 | 26 |
| 27 #if defined(OS_WIN) && !defined(USE_AURA) | 27 #if defined(OS_WIN) && !defined(USE_AURA) |
| 28 #include "ui/views/widget/native_widget_win.h" | 28 #include "ui/base/win/shell.h" |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 #if defined(USE_AURA) && !defined(USE_ASH) && defined(OS_LINUX) | 31 #if defined(USE_AURA) && !defined(USE_ASH) && defined(OS_LINUX) |
| 32 #include "ui/base/linux_ui.h" | 32 #include "ui/base/linux_ui.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 using content::BrowserThread; | 35 using content::BrowserThread; |
| 36 using content::UserMetricsAction; | 36 using content::UserMetricsAction; |
| 37 using extensions::Extension; | 37 using extensions::Extension; |
| 38 using ui::ResourceBundle; | 38 using ui::ResourceBundle; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 if (theme_pack_.get()) | 313 if (theme_pack_.get()) |
| 314 return theme_pack_->GetDisplayProperty(id, result); | 314 return theme_pack_->GetDisplayProperty(id, result); |
| 315 | 315 |
| 316 return GetDefaultDisplayProperty(id, result); | 316 return GetDefaultDisplayProperty(id, result); |
| 317 } | 317 } |
| 318 | 318 |
| 319 bool ThemeService::ShouldUseNativeFrame() const { | 319 bool ThemeService::ShouldUseNativeFrame() const { |
| 320 if (HasCustomImage(IDR_THEME_FRAME)) | 320 if (HasCustomImage(IDR_THEME_FRAME)) |
| 321 return false; | 321 return false; |
| 322 #if defined(OS_WIN) && !defined(USE_AURA) | 322 #if defined(OS_WIN) && !defined(USE_AURA) |
| 323 return views::NativeWidgetWin::IsAeroGlassEnabled(); | 323 return ui::win::IsAeroGlassEnabled(); |
| 324 #else | 324 #else |
| 325 return false; | 325 return false; |
| 326 #endif | 326 #endif |
| 327 } | 327 } |
| 328 | 328 |
| 329 bool ThemeService::HasCustomImage(int id) const { | 329 bool ThemeService::HasCustomImage(int id) const { |
| 330 if (!HasThemeableImage(id)) | 330 if (!HasThemeableImage(id)) |
| 331 return false; | 331 return false; |
| 332 | 332 |
| 333 if (theme_pack_) | 333 if (theme_pack_) |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 void ThemeService::OnInfobarDisplayed() { | 713 void ThemeService::OnInfobarDisplayed() { |
| 714 number_of_infobars_++; | 714 number_of_infobars_++; |
| 715 } | 715 } |
| 716 | 716 |
| 717 void ThemeService::OnInfobarDestroyed() { | 717 void ThemeService::OnInfobarDestroyed() { |
| 718 number_of_infobars_--; | 718 number_of_infobars_--; |
| 719 | 719 |
| 720 if (number_of_infobars_ == 0) | 720 if (number_of_infobars_ == 0) |
| 721 RemoveUnusedThemes(); | 721 RemoveUnusedThemes(); |
| 722 } | 722 } |
| OLD | NEW |