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

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

Issue 2266693002: Implement "streaming" $i18n{} replacer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compress-webui2
Patch Set: Created 4 years, 4 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
« no previous file with comments | « content/browser/webui/web_ui_data_source_impl.h ('k') | net/filter/filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 182 }
183 183
184 void WebUIDataSourceImpl::DisableDenyXFrameOptions() { 184 void WebUIDataSourceImpl::DisableDenyXFrameOptions() {
185 deny_xframe_options_ = false; 185 deny_xframe_options_ = false;
186 } 186 }
187 187
188 void WebUIDataSourceImpl::DisableI18nAndUseGzipForAllPaths() { 188 void WebUIDataSourceImpl::DisableI18nAndUseGzipForAllPaths() {
189 use_gzip_for_all_paths_ = true; 189 use_gzip_for_all_paths_ = true;
190 } 190 }
191 191
192 const ui::TemplateReplacements* WebUIDataSourceImpl::GetTemplateReplacements() c onst {
193 return replacements_.empty() ? nullptr : &replacements_;
194 }
195
192 std::string WebUIDataSourceImpl::GetSource() const { 196 std::string WebUIDataSourceImpl::GetSource() const {
193 return source_name_; 197 return source_name_;
194 } 198 }
195 199
196 std::string WebUIDataSourceImpl::GetMimeType(const std::string& path) const { 200 std::string WebUIDataSourceImpl::GetMimeType(const std::string& path) const {
197 // Remove the query string for to determine the mime type. 201 // Remove the query string for to determine the mime type.
198 std::string file_path = path.substr(0, path.find_first_of('?')); 202 std::string file_path = path.substr(0, path.find_first_of('?'));
199 203
200 if (base::EndsWith(file_path, ".css", base::CompareCase::INSENSITIVE_ASCII)) 204 if (base::EndsWith(file_path, ".css", base::CompareCase::INSENSITIVE_ASCII))
201 return "text/css"; 205 return "text/css";
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 267 }
264 268
265 void WebUIDataSourceImpl::SendLocalizedStringsAsJSON( 269 void WebUIDataSourceImpl::SendLocalizedStringsAsJSON(
266 const URLDataSource::GotDataCallback& callback) { 270 const URLDataSource::GotDataCallback& callback) {
267 std::string template_data; 271 std::string template_data;
268 webui::AppendJsonJS(&localized_strings_, &template_data); 272 webui::AppendJsonJS(&localized_strings_, &template_data);
269 callback.Run(base::RefCountedString::TakeString(&template_data)); 273 callback.Run(base::RefCountedString::TakeString(&template_data));
270 } 274 }
271 275
272 } // namespace content 276 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_data_source_impl.h ('k') | net/filter/filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698