| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // Adds a localized string keyed by resource id to the dictionary. | 115 // Adds a localized string keyed by resource id to the dictionary. |
| 116 void AddString(base::DictionaryValue* dictionary, | 116 void AddString(base::DictionaryValue* dictionary, |
| 117 const std::string& key, | 117 const std::string& key, |
| 118 int resource_id) { | 118 int resource_id) { |
| 119 dictionary->SetString(key, l10n_util::GetStringUTF16(resource_id)); | 119 dictionary->SetString(key, l10n_util::GetStringUTF16(resource_id)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 // Adds a localized string for the Google searchbox placeholder text. | 122 // Adds a localized string for the Google searchbox placeholder text. |
| 123 void AddGoogleSearchboxPlaceholderString(base::DictionaryValue* dictionary) { | 123 void AddGoogleSearchboxPlaceholderString(base::DictionaryValue* dictionary) { |
| 124 base::string16 placeholder = l10n_util::GetStringFUTF16( | 124 base::string16 placeholder = l10n_util::GetStringFUTF16( |
| 125 IDS_OMNIBOX_EMPTY_HINT_WITH_DEFAULT_SEARCH_PROVIDER, | 125 IDS_SEARCH_BOX_EMPTY_HINT, |
| 126 base::ASCIIToUTF16("Google")); | 126 base::ASCIIToUTF16("Google")); |
| 127 dictionary->SetString("searchboxPlaceholder", placeholder); | 127 dictionary->SetString("searchboxPlaceholder", placeholder); |
| 128 } | 128 } |
| 129 | 129 |
| 130 // Populates |translated_strings| dictionary for the local NTP. |is_google| | 130 // Populates |translated_strings| dictionary for the local NTP. |is_google| |
| 131 // indicates that this page is the Google Local NTP. | 131 // indicates that this page is the Google Local NTP. |
| 132 scoped_ptr<base::DictionaryValue> GetTranslatedStrings(bool is_google) { | 132 scoped_ptr<base::DictionaryValue> GetTranslatedStrings(bool is_google) { |
| 133 scoped_ptr<base::DictionaryValue> translated_strings( | 133 scoped_ptr<base::DictionaryValue> translated_strings( |
| 134 new base::DictionaryValue()); | 134 new base::DictionaryValue()); |
| 135 | 135 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 return false; | 253 return false; |
| 254 } | 254 } |
| 255 | 255 |
| 256 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { | 256 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { |
| 257 // Allow embedding of most visited iframes. | 257 // Allow embedding of most visited iframes. |
| 258 return base::StringPrintf("frame-src %s;", | 258 return base::StringPrintf("frame-src %s;", |
| 259 chrome::kChromeSearchMostVisitedUrl); | 259 chrome::kChromeSearchMostVisitedUrl); |
| 260 } | 260 } |
| OLD | NEW |