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

Side by Side Diff: chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.cc

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Convert ptr to bool for win compile. 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/ui/webui/options2/chromeos/wallpaper_thumbnail_source2. h" 5 #include "chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2. h"
6 6
7 #include "ash/desktop_background/desktop_background_resources.h" 7 #include "ash/desktop_background/desktop_background_resources.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/string_piece.h" 11 #include "base/string_piece.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
15 #include "chrome/browser/io_thread.h" 15 #include "chrome/browser/io_thread.h"
16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
17 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "grit/ui_resources.h" 19 #include "grit/ui_resources.h"
20 #include "net/base/mime_util.h" 20 #include "net/base/mime_util.h"
21 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
22 #include "ui/base/resource/resource_handle.h"
22 #include "ui/gfx/codec/png_codec.h" 23 #include "ui/gfx/codec/png_codec.h"
23 24
24 namespace chromeos { 25 namespace chromeos {
25 namespace options2 { 26 namespace options2 {
26 27
27 namespace { 28 namespace {
28 29
29 const char kDefaultWallpaperPrefix[] = "default_"; 30 const char kDefaultWallpaperPrefix[] = "default_";
30 31
31 // Parse an integer from |path| and save it to |index|. For example, deafult_20 32 // Parse an integer from |path| and save it to |index|. For example, deafult_20
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 WallpaperThumbnailSource::~WallpaperThumbnailSource() { 76 WallpaperThumbnailSource::~WallpaperThumbnailSource() {
76 } 77 }
77 78
78 void WallpaperThumbnailSource::StartDataRequest(const std::string& path, 79 void WallpaperThumbnailSource::StartDataRequest(const std::string& path,
79 bool is_incognito, 80 bool is_incognito,
80 int request_id) { 81 int request_id) {
81 int idr = PathToIDR(path); 82 int idr = PathToIDR(path);
82 if (idr != -1) { 83 if (idr != -1) {
83 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 84 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
84 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 85 const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
85 SendResponse(request_id, rb.LoadDataResourceBytes(idr)); 86 SendResponse(request_id, rb.LoadDataResourceBytes(idr,
87 ui::ResourceHandle::kScaleFactor100x));
86 } 88 }
87 } 89 }
88 90
89 std::string WallpaperThumbnailSource::GetMimeType(const std::string&) const { 91 std::string WallpaperThumbnailSource::GetMimeType(const std::string&) const {
90 return "images/png"; 92 return "images/png";
91 } 93 }
92 94
93 } // namespace options2 95 } // namespace options2
94 } // namespace chromeos 96 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698