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/theme_resources_standard.h" | 22 #include "grit/theme_resources_standard.h" |
23 #include "grit/ui_resources.h" | 23 #include "grit/ui_resources.h" |
| 24 #include "ui/base/layout.h" |
24 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
25 #include "ui/gfx/image/image_skia.h" | 26 #include "ui/gfx/image/image_skia.h" |
26 | 27 |
27 #if defined(OS_WIN) && !defined(USE_AURA) | 28 #if defined(OS_WIN) && !defined(USE_AURA) |
28 #include "ui/views/widget/native_widget_win.h" | 29 #include "ui/views/widget/native_widget_win.h" |
29 #endif | 30 #endif |
30 | 31 |
31 using content::BrowserThread; | 32 using content::BrowserThread; |
32 using content::UserMetricsAction; | 33 using content::UserMetricsAction; |
33 using extensions::Extension; | 34 using extensions::Extension; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // Check to see whether we should substitute some images. | 319 // Check to see whether we should substitute some images. |
319 int ntp_alternate; | 320 int ntp_alternate; |
320 GetDisplayProperty(NTP_LOGO_ALTERNATE, &ntp_alternate); | 321 GetDisplayProperty(NTP_LOGO_ALTERNATE, &ntp_alternate); |
321 if (id == IDR_PRODUCT_LOGO && ntp_alternate != 0) | 322 if (id == IDR_PRODUCT_LOGO && ntp_alternate != 0) |
322 id = IDR_PRODUCT_LOGO_WHITE; | 323 id = IDR_PRODUCT_LOGO_WHITE; |
323 | 324 |
324 base::RefCountedMemory* data = NULL; | 325 base::RefCountedMemory* data = NULL; |
325 if (theme_pack_.get()) | 326 if (theme_pack_.get()) |
326 data = theme_pack_->GetRawData(id); | 327 data = theme_pack_->GetRawData(id); |
327 if (!data) | 328 if (!data) |
328 data = rb_.LoadDataResourceBytes(id); | 329 data = rb_.LoadDataResourceBytes(id, ui::SCALE_FACTOR_100P); |
329 | 330 |
330 return data; | 331 return data; |
331 } | 332 } |
332 | 333 |
333 void ThemeService::SetTheme(const Extension* extension) { | 334 void ThemeService::SetTheme(const Extension* extension) { |
334 // Clear our image cache. | 335 // Clear our image cache. |
335 FreePlatformCaches(); | 336 FreePlatformCaches(); |
336 | 337 |
337 DCHECK(extension); | 338 DCHECK(extension); |
338 DCHECK(extension->is_theme()); | 339 DCHECK(extension->is_theme()); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 void ThemeService::OnInfobarDisplayed() { | 682 void ThemeService::OnInfobarDisplayed() { |
682 number_of_infobars_++; | 683 number_of_infobars_++; |
683 } | 684 } |
684 | 685 |
685 void ThemeService::OnInfobarDestroyed() { | 686 void ThemeService::OnInfobarDestroyed() { |
686 number_of_infobars_--; | 687 number_of_infobars_--; |
687 | 688 |
688 if (number_of_infobars_ == 0) | 689 if (number_of_infobars_ == 0) |
689 RemoveUnusedThemes(); | 690 RemoveUnusedThemes(); |
690 } | 691 } |
OLD | NEW |