| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 if (is_google) | 134 if (is_google) |
| 135 AddGoogleSearchboxPlaceholderString(translated_strings.get()); | 135 AddGoogleSearchboxPlaceholderString(translated_strings.get()); |
| 136 | 136 |
| 137 return translated_strings.Pass(); | 137 return translated_strings.Pass(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 // Returns a JS dictionary of configuration data for the local NTP. | 140 // Returns a JS dictionary of configuration data for the local NTP. |
| 141 std::string GetConfigData(Profile* profile) { | 141 std::string GetConfigData(Profile* profile) { |
| 142 base::DictionaryValue config_data; | 142 base::DictionaryValue config_data; |
| 143 bool is_google = DefaultSearchProviderIsGoogle(profile) && | 143 bool is_google = DefaultSearchProviderIsGoogle(profile) && |
| 144 chrome::ShouldShowGoogleLocalNTP(); | 144 search::ShouldShowGoogleLocalNTP(); |
| 145 config_data.Set("translatedStrings", | 145 config_data.Set("translatedStrings", |
| 146 GetTranslatedStrings(is_google).release()); | 146 GetTranslatedStrings(is_google).release()); |
| 147 config_data.SetBoolean("isGooglePage", is_google); | 147 config_data.SetBoolean("isGooglePage", is_google); |
| 148 config_data.SetBoolean("useIcons", IsIconNTPEnabled()); | 148 config_data.SetBoolean("useIcons", IsIconNTPEnabled()); |
| 149 | 149 |
| 150 // Serialize the dictionary. | 150 // Serialize the dictionary. |
| 151 std::string js_text; | 151 std::string js_text; |
| 152 JSONStringValueSerializer serializer(&js_text); | 152 JSONStringValueSerializer serializer(&js_text); |
| 153 serializer.Serialize(config_data); | 153 serializer.Serialize(config_data); |
| 154 | 154 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 return false; | 245 return false; |
| 246 } | 246 } |
| 247 | 247 |
| 248 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { | 248 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { |
| 249 // Allow embedding of most visited iframes. | 249 // Allow embedding of most visited iframes. |
| 250 return base::StringPrintf("frame-src %s;", | 250 return base::StringPrintf("frame-src %s;", |
| 251 chrome::kChromeSearchMostVisitedUrl); | 251 chrome::kChromeSearchMostVisitedUrl); |
| 252 } | 252 } |
| OLD | NEW |