OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/search/contextual_search_promo_source_android.h" | 5 #include "chrome/browser/search/contextual_search_promo_source_android.h" |
6 | 6 |
7 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 callback.Run(response.get()); | 84 callback.Run(response.get()); |
85 } | 85 } |
86 | 86 |
87 void ContextualSearchPromoSourceAndroid::SendHtmlWithStrings( | 87 void ContextualSearchPromoSourceAndroid::SendHtmlWithStrings( |
88 const content::URLDataSource::GotDataCallback& callback) { | 88 const content::URLDataSource::GotDataCallback& callback) { |
89 base::DictionaryValue strings_data; | 89 base::DictionaryValue strings_data; |
90 strings_data.SetString( | 90 strings_data.SetString( |
91 "description", | 91 "description", |
92 l10n_util::GetStringUTF16(IDS_CONTEXTUAL_SEARCH_PROMO_DESCRIPTION)); | 92 l10n_util::GetStringUTF16(IDS_CONTEXTUAL_SEARCH_PROMO_DESCRIPTION)); |
93 strings_data.SetString( | 93 strings_data.SetString( |
| 94 "heading", l10n_util::GetStringUTF16(IDS_CONTEXTUAL_SEARCH_HEADER)); |
| 95 strings_data.SetString( |
94 "optIn", l10n_util::GetStringUTF16(IDS_CONTEXTUAL_SEARCH_PROMO_OPTIN)); | 96 "optIn", l10n_util::GetStringUTF16(IDS_CONTEXTUAL_SEARCH_PROMO_OPTIN)); |
95 strings_data.SetString( | 97 strings_data.SetString( |
96 "optOut", l10n_util::GetStringUTF16(IDS_CONTEXTUAL_SEARCH_PROMO_OPTOUT)); | 98 "optOut", l10n_util::GetStringUTF16(IDS_CONTEXTUAL_SEARCH_PROMO_OPTOUT)); |
97 base::StringPiece html( | 99 base::StringPiece html( |
98 ResourceBundle::GetSharedInstance().GetRawDataResource( | 100 ResourceBundle::GetSharedInstance().GetRawDataResource( |
99 IDR_CONTEXTUAL_SEARCH_PROMO_HTML)); | 101 IDR_CONTEXTUAL_SEARCH_PROMO_HTML)); |
100 webui::UseVersion2 version; | 102 webui::UseVersion2 version; |
101 std::string response(webui::GetI18nTemplateHtml(html, &strings_data)); | 103 std::string response(webui::GetI18nTemplateHtml(html, &strings_data)); |
102 callback.Run(base::RefCountedString::TakeString(&response)); | 104 callback.Run(base::RefCountedString::TakeString(&response)); |
103 } | 105 } |
OLD | NEW |