| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "grit/ui_resources.h" | 23 #include "grit/ui_resources.h" |
| 24 #include "grit/ui_resources_standard.h" | 24 #include "grit/ui_resources_standard.h" |
| 25 #include "ui/base/layout.h" | 25 #include "ui/base/layout.h" |
| 26 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
| 27 #include "ui/gfx/image/image_skia.h" | 27 #include "ui/gfx/image/image_skia.h" |
| 28 | 28 |
| 29 #if defined(OS_WIN) && !defined(USE_AURA) | 29 #if defined(OS_WIN) && !defined(USE_AURA) |
| 30 #include "ui/views/widget/native_widget_win.h" | 30 #include "ui/views/widget/native_widget_win.h" |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 #if defined(USE_AURA) && !defined(USE_ASH) && defined(OS_LINUX) |
| 34 #include "ui/base/linux_ui.h" |
| 35 #endif |
| 36 |
| 33 using content::BrowserThread; | 37 using content::BrowserThread; |
| 34 using content::UserMetricsAction; | 38 using content::UserMetricsAction; |
| 35 using extensions::Extension; | 39 using extensions::Extension; |
| 36 using ui::ResourceBundle; | 40 using ui::ResourceBundle; |
| 37 | 41 |
| 38 // Strings used in alignment properties. | 42 // Strings used in alignment properties. |
| 39 const char* ThemeService::kAlignmentCenter = "center"; | 43 const char* ThemeService::kAlignmentCenter = "center"; |
| 40 const char* ThemeService::kAlignmentTop = "top"; | 44 const char* ThemeService::kAlignmentTop = "top"; |
| 41 const char* ThemeService::kAlignmentBottom = "bottom"; | 45 const char* ThemeService::kAlignmentBottom = "bottom"; |
| 42 const char* ThemeService::kAlignmentLeft = "left"; | 46 const char* ThemeService::kAlignmentLeft = "left"; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 238 } |
| 235 | 239 |
| 236 const gfx::Image* ThemeService::GetImageNamed(int id) const { | 240 const gfx::Image* ThemeService::GetImageNamed(int id) const { |
| 237 DCHECK(CalledOnValidThread()); | 241 DCHECK(CalledOnValidThread()); |
| 238 | 242 |
| 239 const gfx::Image* image = NULL; | 243 const gfx::Image* image = NULL; |
| 240 | 244 |
| 241 if (theme_pack_.get()) | 245 if (theme_pack_.get()) |
| 242 image = theme_pack_->GetImageNamed(id); | 246 image = theme_pack_->GetImageNamed(id); |
| 243 | 247 |
| 248 #if defined(USE_AURA) && !defined(USE_ASH) && defined(OS_LINUX) |
| 249 const ui::LinuxUI* linux_ui = ui::LinuxUI::instance(); |
| 250 if (!image && linux_ui) |
| 251 image = linux_ui->GetThemeImageNamed(id); |
| 252 #endif |
| 253 |
| 244 if (!image) | 254 if (!image) |
| 245 image = &rb_.GetNativeImageNamed(id); | 255 image = &rb_.GetNativeImageNamed(id); |
| 246 | 256 |
| 247 return image; | 257 return image; |
| 248 } | 258 } |
| 249 | 259 |
| 250 SkBitmap* ThemeService::GetBitmapNamed(int id) const { | 260 SkBitmap* ThemeService::GetBitmapNamed(int id) const { |
| 251 const gfx::Image* image = GetImageNamed(id); | 261 const gfx::Image* image = GetImageNamed(id); |
| 252 if (!image) | 262 if (!image) |
| 253 return NULL; | 263 return NULL; |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 void ThemeService::OnInfobarDisplayed() { | 693 void ThemeService::OnInfobarDisplayed() { |
| 684 number_of_infobars_++; | 694 number_of_infobars_++; |
| 685 } | 695 } |
| 686 | 696 |
| 687 void ThemeService::OnInfobarDestroyed() { | 697 void ThemeService::OnInfobarDestroyed() { |
| 688 number_of_infobars_--; | 698 number_of_infobars_--; |
| 689 | 699 |
| 690 if (number_of_infobars_ == 0) | 700 if (number_of_infobars_ == 0) |
| 691 RemoveUnusedThemes(); | 701 RemoveUnusedThemes(); |
| 692 } | 702 } |
| OLD | NEW |