| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_ntp_source.h" | 5 #include "chrome/browser/search/local_ntp_source.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 // Adds a localized string keyed by resource id to the dictionary. | 91 // Adds a localized string keyed by resource id to the dictionary. |
| 92 void AddString(base::DictionaryValue* dictionary, | 92 void AddString(base::DictionaryValue* dictionary, |
| 93 const std::string& key, | 93 const std::string& key, |
| 94 int resource_id) { | 94 int resource_id) { |
| 95 dictionary->SetString(key, l10n_util::GetStringUTF16(resource_id)); | 95 dictionary->SetString(key, l10n_util::GetStringUTF16(resource_id)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Adds a localized string for the Google searchbox placeholder text. | 98 // Adds a localized string for the Google searchbox placeholder text. |
| 99 void AddGoogleSearchboxPlaceholderString(base::DictionaryValue* dictionary) { | 99 void AddGoogleSearchboxPlaceholderString(base::DictionaryValue* dictionary) { |
| 100 // TODO(treib): Remove the param from the string; it's only ever used with |
| 101 // "Google". |
| 100 base::string16 placeholder = l10n_util::GetStringFUTF16( | 102 base::string16 placeholder = l10n_util::GetStringFUTF16( |
| 101 IDS_SEARCH_BOX_EMPTY_HINT, | 103 IDS_SEARCH_BOX_EMPTY_HINT, |
| 102 base::ASCIIToUTF16("Google")); | 104 base::ASCIIToUTF16("Google")); |
| 103 dictionary->SetString("searchboxPlaceholder", placeholder); | 105 dictionary->SetString("searchboxPlaceholder", placeholder); |
| 104 } | 106 } |
| 105 | 107 |
| 106 // Populates |translated_strings| dictionary for the local NTP. |is_google| | 108 // Populates |translated_strings| dictionary for the local NTP. |is_google| |
| 107 // indicates that this page is the Google Local NTP. | 109 // indicates that this page is the Google Local NTP. |
| 108 std::unique_ptr<base::DictionaryValue> GetTranslatedStrings(bool is_google) { | 110 std::unique_ptr<base::DictionaryValue> GetTranslatedStrings(bool is_google) { |
| 109 std::unique_ptr<base::DictionaryValue> translated_strings( | 111 std::unique_ptr<base::DictionaryValue> translated_strings( |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 255 } |
| 254 } | 256 } |
| 255 return false; | 257 return false; |
| 256 } | 258 } |
| 257 | 259 |
| 258 std::string LocalNtpSource::GetContentSecurityPolicyChildSrc() const { | 260 std::string LocalNtpSource::GetContentSecurityPolicyChildSrc() const { |
| 259 // Allow embedding of most visited iframes. | 261 // Allow embedding of most visited iframes. |
| 260 return base::StringPrintf("child-src %s;", | 262 return base::StringPrintf("child-src %s;", |
| 261 chrome::kChromeSearchMostVisitedUrl); | 263 chrome::kChromeSearchMostVisitedUrl); |
| 262 } | 264 } |
| OLD | NEW |