Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: chrome/browser/search/local_ntp_source.cc

Issue 1260033003: Partially componentize //chrome/browser/search/search.{h,cc} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on iOS Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/search/instant_unittest_base.cc ('k') | chrome/browser/search/search.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/search/instant_unittest_base.cc ('k') | chrome/browser/search/search.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698