Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: chrome/browser/themes/theme_service.cc

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 ui::ResourceBundle; 34 using ui::ResourceBundle;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // Check to see whether we should substitute some images. 318 // Check to see whether we should substitute some images.
318 int ntp_alternate; 319 int ntp_alternate;
319 GetDisplayProperty(NTP_LOGO_ALTERNATE, &ntp_alternate); 320 GetDisplayProperty(NTP_LOGO_ALTERNATE, &ntp_alternate);
320 if (id == IDR_PRODUCT_LOGO && ntp_alternate != 0) 321 if (id == IDR_PRODUCT_LOGO && ntp_alternate != 0)
321 id = IDR_PRODUCT_LOGO_WHITE; 322 id = IDR_PRODUCT_LOGO_WHITE;
322 323
323 base::RefCountedMemory* data = NULL; 324 base::RefCountedMemory* data = NULL;
324 if (theme_pack_.get()) 325 if (theme_pack_.get())
325 data = theme_pack_->GetRawData(id); 326 data = theme_pack_->GetRawData(id);
326 if (!data) 327 if (!data)
327 data = rb_.LoadDataResourceBytes(id); 328 data = rb_.LoadDataResourceBytes(id, ui::SCALE_FACTOR_100P);
328 329
329 return data; 330 return data;
330 } 331 }
331 332
332 void ThemeService::SetTheme(const Extension* extension) { 333 void ThemeService::SetTheme(const Extension* extension) {
333 // Clear our image cache. 334 // Clear our image cache.
334 FreePlatformCaches(); 335 FreePlatformCaches();
335 336
336 DCHECK(extension); 337 DCHECK(extension);
337 DCHECK(extension->is_theme()); 338 DCHECK(extension->is_theme());
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 void ThemeService::OnInfobarDisplayed() { 681 void ThemeService::OnInfobarDisplayed() {
681 number_of_infobars_++; 682 number_of_infobars_++;
682 } 683 }
683 684
684 void ThemeService::OnInfobarDestroyed() { 685 void ThemeService::OnInfobarDestroyed() {
685 number_of_infobars_--; 686 number_of_infobars_--;
686 687
687 if (number_of_infobars_ == 0) 688 if (number_of_infobars_ == 0)
688 RemoveUnusedThemes(); 689 RemoveUnusedThemes();
689 } 690 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698