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 "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 AddString(translated_strings.get(), "undoThumbnailRemove", | 134 AddString(translated_strings.get(), "undoThumbnailRemove", |
135 IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE); | 135 IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE); |
136 AddString(translated_strings.get(), "restoreThumbnailsShort", | 136 AddString(translated_strings.get(), "restoreThumbnailsShort", |
137 IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK); | 137 IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK); |
138 AddString(translated_strings.get(), "attributionIntro", | 138 AddString(translated_strings.get(), "attributionIntro", |
139 IDS_NEW_TAB_ATTRIBUTION_INTRO); | 139 IDS_NEW_TAB_ATTRIBUTION_INTRO); |
140 AddString(translated_strings.get(), "title", IDS_NEW_TAB_TITLE); | 140 AddString(translated_strings.get(), "title", IDS_NEW_TAB_TITLE); |
141 if (is_google) | 141 if (is_google) |
142 AddGoogleSearchboxPlaceholderString(translated_strings.get()); | 142 AddGoogleSearchboxPlaceholderString(translated_strings.get()); |
143 | 143 |
144 return translated_strings.Pass(); | 144 return translated_strings; |
145 } | 145 } |
146 | 146 |
147 // Returns a JS dictionary of configuration data for the local NTP. | 147 // Returns a JS dictionary of configuration data for the local NTP. |
148 std::string GetConfigData(Profile* profile) { | 148 std::string GetConfigData(Profile* profile) { |
149 base::DictionaryValue config_data; | 149 base::DictionaryValue config_data; |
150 bool is_google = DefaultSearchProviderIsGoogle(profile) && | 150 bool is_google = DefaultSearchProviderIsGoogle(profile) && |
151 search::ShouldShowGoogleLocalNTP(); | 151 search::ShouldShowGoogleLocalNTP(); |
152 config_data.Set("translatedStrings", | 152 config_data.Set("translatedStrings", |
153 GetTranslatedStrings(is_google).release()); | 153 GetTranslatedStrings(is_google).release()); |
154 config_data.SetBoolean("isGooglePage", is_google); | 154 config_data.SetBoolean("isGooglePage", is_google); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 } | 266 } |
267 } | 267 } |
268 return false; | 268 return false; |
269 } | 269 } |
270 | 270 |
271 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { | 271 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { |
272 // Allow embedding of most visited iframes. | 272 // Allow embedding of most visited iframes. |
273 return base::StringPrintf("frame-src %s;", | 273 return base::StringPrintf("frame-src %s;", |
274 chrome::kChromeSearchMostVisitedUrl); | 274 chrome::kChromeSearchMostVisitedUrl); |
275 } | 275 } |
OLD | NEW |