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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 AddString(translated_strings.get(), "title", IDS_NEW_TAB_TITLE); | 141 AddString(translated_strings.get(), "title", IDS_NEW_TAB_TITLE); |
142 if (is_google) | 142 if (is_google) |
143 AddGoogleSearchboxPlaceholderString(translated_strings.get()); | 143 AddGoogleSearchboxPlaceholderString(translated_strings.get()); |
144 | 144 |
145 return translated_strings; | 145 return translated_strings; |
146 } | 146 } |
147 | 147 |
148 // Returns a JS dictionary of configuration data for the local NTP. | 148 // Returns a JS dictionary of configuration data for the local NTP. |
149 std::string GetConfigData(Profile* profile) { | 149 std::string GetConfigData(Profile* profile) { |
150 base::DictionaryValue config_data; | 150 base::DictionaryValue config_data; |
151 bool is_google = DefaultSearchProviderIsGoogle(profile) && | 151 bool is_google = DefaultSearchProviderIsGoogle(profile); |
152 search::ShouldShowGoogleLocalNTP(); | |
153 config_data.Set("translatedStrings", | 152 config_data.Set("translatedStrings", |
154 GetTranslatedStrings(is_google).release()); | 153 GetTranslatedStrings(is_google).release()); |
155 config_data.SetBoolean("isGooglePage", is_google); | 154 config_data.SetBoolean("isGooglePage", is_google); |
156 config_data.SetBoolean("useIcons", IsIconNTPEnabled()); | 155 config_data.SetBoolean("useIcons", IsIconNTPEnabled()); |
157 | 156 |
158 // Serialize the dictionary. | 157 // Serialize the dictionary. |
159 std::string js_text; | 158 std::string js_text; |
160 JSONStringValueSerializer serializer(&js_text); | 159 JSONStringValueSerializer serializer(&js_text); |
161 serializer.Serialize(config_data); | 160 serializer.Serialize(config_data); |
162 | 161 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 266 } |
268 } | 267 } |
269 return false; | 268 return false; |
270 } | 269 } |
271 | 270 |
272 std::string LocalNtpSource::GetContentSecurityPolicyChildSrc() const { | 271 std::string LocalNtpSource::GetContentSecurityPolicyChildSrc() const { |
273 // Allow embedding of most visited iframes. | 272 // Allow embedding of most visited iframes. |
274 return base::StringPrintf("child-src %s;", | 273 return base::StringPrintf("child-src %s;", |
275 chrome::kChromeSearchMostVisitedUrl); | 274 chrome::kChromeSearchMostVisitedUrl); |
276 } | 275 } |
OLD | NEW |