| 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/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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 ChromeWebUIDataSource::~ChromeWebUIDataSource() { | 29 ChromeWebUIDataSource::~ChromeWebUIDataSource() { |
| 30 } | 30 } |
| 31 | 31 |
| 32 void ChromeWebUIDataSource::AddString(const std::string& name, | 32 void ChromeWebUIDataSource::AddString(const std::string& name, |
| 33 const string16& value) { | 33 const string16& value) { |
| 34 localized_strings_.SetString(name, value); | 34 localized_strings_.SetString(name, value); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void ChromeWebUIDataSource::AddString(const std::string& name, |
| 38 const std::string& value) { |
| 39 localized_strings_.SetString(name, value); |
| 40 } |
| 41 |
| 37 void ChromeWebUIDataSource::AddLocalizedString(const std::string& name, | 42 void ChromeWebUIDataSource::AddLocalizedString(const std::string& name, |
| 38 int ids) { | 43 int ids) { |
| 39 localized_strings_.SetString(name, l10n_util::GetStringUTF16(ids)); | 44 localized_strings_.SetString(name, l10n_util::GetStringUTF16(ids)); |
| 40 } | 45 } |
| 41 | 46 |
| 42 void ChromeWebUIDataSource::AddLocalizedStrings( | 47 void ChromeWebUIDataSource::AddLocalizedStrings( |
| 43 const DictionaryValue& localized_strings) { | 48 const DictionaryValue& localized_strings) { |
| 44 localized_strings_.MergeDictionary(&localized_strings); | 49 localized_strings_.MergeDictionary(&localized_strings); |
| 45 } | 50 } |
| 46 | 51 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 jstemplate_builder::AppendJsonJS(&localized_strings_, &template_data); | 89 jstemplate_builder::AppendJsonJS(&localized_strings_, &template_data); |
| 85 SendResponse(request_id, base::RefCountedString::TakeString(&template_data)); | 90 SendResponse(request_id, base::RefCountedString::TakeString(&template_data)); |
| 86 } | 91 } |
| 87 | 92 |
| 88 void ChromeWebUIDataSource::SendFromResourceBundle(int request_id, int idr) { | 93 void ChromeWebUIDataSource::SendFromResourceBundle(int request_id, int idr) { |
| 89 scoped_refptr<base::RefCountedStaticMemory> response( | 94 scoped_refptr<base::RefCountedStaticMemory> response( |
| 90 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 95 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
| 91 idr, ui::SCALE_FACTOR_NONE)); | 96 idr, ui::SCALE_FACTOR_NONE)); |
| 92 SendResponse(request_id, response); | 97 SendResponse(request_id, response); |
| 93 } | 98 } |
| OLD | NEW |