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

Side by Side Diff: chrome/browser/ui/webui/chrome_web_ui_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/chrome_web_ui_data_source.h" 5 #include "chrome/browser/ui/webui/chrome_web_ui_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/string_util.h" 10 #include "base/string_util.h"
11 #include "chrome/common/jstemplate_builder.h" 11 #include "chrome/common/jstemplate_builder.h"
12 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/base/layout.h"
13 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
14 15
15 ChromeWebUIDataSource::ChromeWebUIDataSource(const std::string& source_name) 16 ChromeWebUIDataSource::ChromeWebUIDataSource(const std::string& source_name)
16 : DataSource(source_name, MessageLoop::current()), 17 : DataSource(source_name, MessageLoop::current()),
17 default_resource_(-1), 18 default_resource_(-1),
18 json_js_format_v2_(false) { 19 json_js_format_v2_(false) {
19 } 20 }
20 21
21 ChromeWebUIDataSource::ChromeWebUIDataSource(const std::string& source_name, 22 ChromeWebUIDataSource::ChromeWebUIDataSource(const std::string& source_name,
22 MessageLoop* loop) 23 MessageLoop* loop)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 scoped_ptr<jstemplate_builder::UseVersion2> version2; 80 scoped_ptr<jstemplate_builder::UseVersion2> version2;
80 if (json_js_format_v2_) 81 if (json_js_format_v2_)
81 version2.reset(new jstemplate_builder::UseVersion2); 82 version2.reset(new jstemplate_builder::UseVersion2);
82 83
83 jstemplate_builder::AppendJsonJS(&localized_strings_, &template_data); 84 jstemplate_builder::AppendJsonJS(&localized_strings_, &template_data);
84 SendResponse(request_id, base::RefCountedString::TakeString(&template_data)); 85 SendResponse(request_id, base::RefCountedString::TakeString(&template_data));
85 } 86 }
86 87
87 void ChromeWebUIDataSource::SendFromResourceBundle(int request_id, int idr) { 88 void ChromeWebUIDataSource::SendFromResourceBundle(int request_id, int idr) {
88 scoped_refptr<base::RefCountedStaticMemory> response( 89 scoped_refptr<base::RefCountedStaticMemory> response(
89 ResourceBundle::GetSharedInstance().LoadDataResourceBytes(idr)); 90 ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
91 idr, ui::SCALE_FACTOR_NONE));
90 SendResponse(request_id, response); 92 SendResponse(request_id, response);
91 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698