| 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 "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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 resource_id = result->second; | 144 resource_id = result->second; |
| 145 DCHECK_NE(resource_id, -1); | 145 DCHECK_NE(resource_id, -1); |
| 146 SendFromResourceBundle(callback, resource_id); | 146 SendFromResourceBundle(callback, resource_id); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void ChromeWebUIDataSource::SendLocalizedStringsAsJSON( | 149 void ChromeWebUIDataSource::SendLocalizedStringsAsJSON( |
| 150 const content::URLDataSource::GotDataCallback& callback) { | 150 const content::URLDataSource::GotDataCallback& callback) { |
| 151 std::string template_data; | 151 std::string template_data; |
| 152 web_ui_util::SetFontAndTextDirection(&localized_strings_); | 152 web_ui_util::SetFontAndTextDirection(&localized_strings_); |
| 153 | 153 |
| 154 scoped_ptr<jstemplate_builder::UseVersion2> version2; | 154 scoped_ptr<webui::UseVersion2> version2; |
| 155 if (json_js_format_v2_) | 155 if (json_js_format_v2_) |
| 156 version2.reset(new jstemplate_builder::UseVersion2); | 156 version2.reset(new webui::UseVersion2); |
| 157 | 157 |
| 158 jstemplate_builder::AppendJsonJS(&localized_strings_, &template_data); | 158 webui::AppendJsonJS(&localized_strings_, &template_data); |
| 159 callback.Run(base::RefCountedString::TakeString(&template_data)); | 159 callback.Run(base::RefCountedString::TakeString(&template_data)); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void ChromeWebUIDataSource::SendFromResourceBundle( | 162 void ChromeWebUIDataSource::SendFromResourceBundle( |
| 163 const content::URLDataSource::GotDataCallback& callback, int idr) { | 163 const content::URLDataSource::GotDataCallback& callback, int idr) { |
| 164 scoped_refptr<base::RefCountedStaticMemory> response( | 164 scoped_refptr<base::RefCountedStaticMemory> response( |
| 165 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 165 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
| 166 idr)); | 166 idr)); |
| 167 callback.Run(response); | 167 callback.Run(response); |
| 168 } | 168 } |
| OLD | NEW |