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

Side by Side Diff: chrome/browser/ui/webui/shared_resources_data_source.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/ui/webui/shared_resources_data_source.h" 5 #include "chrome/browser/ui/webui/shared_resources_data_source.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 SharedResourcesDataSource::~SharedResourcesDataSource() { 69 SharedResourcesDataSource::~SharedResourcesDataSource() {
70 } 70 }
71 71
72 void SharedResourcesDataSource::StartDataRequest(const std::string& path, 72 void SharedResourcesDataSource::StartDataRequest(const std::string& path,
73 bool is_incognito, 73 bool is_incognito,
74 int request_id) { 74 int request_id) {
75 int idr = PathToIDR(path); 75 int idr = PathToIDR(path);
76 DCHECK_NE(-1, idr) << " path: " << path; 76 DCHECK_NE(-1, idr) << " path: " << path;
77 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 77 const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
78 scoped_refptr<base::RefCountedStaticMemory> bytes( 78 scoped_refptr<base::RefCountedStaticMemory> bytes(
79 rb.LoadDataResourceBytes(idr)); 79 rb.LoadDataResourceBytes(idr, ui::SCALE_FACTOR_NONE));
80 80
81 SendResponse(request_id, bytes); 81 SendResponse(request_id, bytes);
82 } 82 }
83 83
84 std::string SharedResourcesDataSource::GetMimeType( 84 std::string SharedResourcesDataSource::GetMimeType(
85 const std::string& path) const { 85 const std::string& path) const {
86 // Requests should not block on the disk! On Windows this goes to the 86 // Requests should not block on the disk! On Windows this goes to the
87 // registry. 87 // registry.
88 // http://code.google.com/p/chromium/issues/detail?id=59849 88 // http://code.google.com/p/chromium/issues/detail?id=59849
89 base::ThreadRestrictions::ScopedAllowIO allow_io; 89 base::ThreadRestrictions::ScopedAllowIO allow_io;
90 90
91 std::string mime_type; 91 std::string mime_type;
92 net::GetMimeTypeFromFile(FilePath().AppendASCII(path), &mime_type); 92 net::GetMimeTypeFromFile(FilePath().AppendASCII(path), &mime_type);
93 return mime_type; 93 return mime_type;
94 } 94 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698