| OLD | NEW |
| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 if (result != path_to_idr_map_.end()) | 225 if (result != path_to_idr_map_.end()) |
| 226 resource_id = result->second; | 226 resource_id = result->second; |
| 227 DCHECK_NE(resource_id, -1); | 227 DCHECK_NE(resource_id, -1); |
| 228 SendFromResourceBundle(callback, resource_id); | 228 SendFromResourceBundle(callback, resource_id); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void WebUIDataSourceImpl::SendLocalizedStringsAsJSON( | 231 void WebUIDataSourceImpl::SendLocalizedStringsAsJSON( |
| 232 const URLDataSource::GotDataCallback& callback) { | 232 const URLDataSource::GotDataCallback& callback) { |
| 233 std::string template_data; | 233 std::string template_data; |
| 234 if (!disable_set_font_strings_) | 234 if (!disable_set_font_strings_) |
| 235 webui::SetFontAndTextDirection(&localized_strings_); | 235 webui::SetTextDirection(&localized_strings_); |
| 236 | 236 |
| 237 webui::AppendJsonJS(&localized_strings_, &template_data); | 237 webui::AppendJsonJS(&localized_strings_, &template_data); |
| 238 callback.Run(base::RefCountedString::TakeString(&template_data)); | 238 callback.Run(base::RefCountedString::TakeString(&template_data)); |
| 239 } | 239 } |
| 240 | 240 |
| 241 void WebUIDataSourceImpl::SendFromResourceBundle( | 241 void WebUIDataSourceImpl::SendFromResourceBundle( |
| 242 const URLDataSource::GotDataCallback& callback, int idr) { | 242 const URLDataSource::GotDataCallback& callback, int idr) { |
| 243 scoped_refptr<base::RefCountedStaticMemory> response( | 243 scoped_refptr<base::RefCountedStaticMemory> response( |
| 244 GetContentClient()->GetDataResourceBytes(idr)); | 244 GetContentClient()->GetDataResourceBytes(idr)); |
| 245 callback.Run(response.get()); | 245 callback.Run(response.get()); |
| 246 } | 246 } |
| 247 | 247 |
| 248 } // namespace content | 248 } // namespace content |
| OLD | NEW |