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

Side by Side Diff: content/browser/webui/web_ui_data_source_impl.cc

Issue 2391073005: WebUIDataSource::AddInteger (like AddBoolean/AddString) (Closed)
Patch Set: Created 4 years, 2 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
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 "content/browser/webui/web_ui_data_source_impl.h" 5 #include "content/browser/webui/web_ui_data_source_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 void WebUIDataSourceImpl::AddBoolean(const std::string& name, bool value) { 135 void WebUIDataSourceImpl::AddBoolean(const std::string& name, bool value) {
136 localized_strings_.SetBoolean(name, value); 136 localized_strings_.SetBoolean(name, value);
137 // TODO(dschuyler): Change name of |localized_strings_| to |load_time_data_| 137 // TODO(dschuyler): Change name of |localized_strings_| to |load_time_data_|
138 // or similar. These values haven't been found as strings for 138 // or similar. These values haven't been found as strings for
139 // localization. The boolean values are not added to |replacements_| 139 // localization. The boolean values are not added to |replacements_|
140 // for the same reason, that they are used as flags, rather than string 140 // for the same reason, that they are used as flags, rather than string
141 // replacements. 141 // replacements.
142 } 142 }
143 143
144 void WebUIDataSourceImpl::AddInteger(const std::string& name, int value) {
145 localized_strings_.SetInteger(name, value);
146 }
147
144 void WebUIDataSourceImpl::SetJsonPath(const std::string& path) { 148 void WebUIDataSourceImpl::SetJsonPath(const std::string& path) {
145 json_path_ = path; 149 json_path_ = path;
146 } 150 }
147 151
148 void WebUIDataSourceImpl::AddResourcePath(const std::string &path, 152 void WebUIDataSourceImpl::AddResourcePath(const std::string &path,
149 int resource_id) { 153 int resource_id) {
150 path_to_idr_map_[path] = resource_id; 154 path_to_idr_map_[path] = resource_id;
151 } 155 }
152 156
153 void WebUIDataSourceImpl::SetDefaultResource(int resource_id) { 157 void WebUIDataSourceImpl::SetDefaultResource(int resource_id) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 265 }
262 266
263 void WebUIDataSourceImpl::SendLocalizedStringsAsJSON( 267 void WebUIDataSourceImpl::SendLocalizedStringsAsJSON(
264 const URLDataSource::GotDataCallback& callback) { 268 const URLDataSource::GotDataCallback& callback) {
265 std::string template_data; 269 std::string template_data;
266 webui::AppendJsonJS(&localized_strings_, &template_data); 270 webui::AppendJsonJS(&localized_strings_, &template_data);
267 callback.Run(base::RefCountedString::TakeString(&template_data)); 271 callback.Run(base::RefCountedString::TakeString(&template_data));
268 } 272 }
269 273
270 } // namespace content 274 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698