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

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

Issue 1492423003: Rejigger ThemeService: move exposure of ThemeProvider interface to a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: respond to comments Created 5 years 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
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 serializer.Serialize(config_data); 158 serializer.Serialize(config_data);
159 159
160 std::string config_data_js; 160 std::string config_data_js;
161 config_data_js.append("var configData = "); 161 config_data_js.append("var configData = ");
162 config_data_js.append(js_text); 162 config_data_js.append(js_text);
163 config_data_js.append(";"); 163 config_data_js.append(";");
164 return config_data_js; 164 return config_data_js;
165 } 165 }
166 166
167 std::string GetThemeCSS(Profile* profile) { 167 std::string GetThemeCSS(Profile* profile) {
168 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile);
169 SkColor background_color = 168 SkColor background_color =
170 theme_service->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND); 169 ThemeService::GetThemeProviderForProfile(profile)
170 .GetColor(ThemeProperties::COLOR_NTP_BACKGROUND);
171 171
172 return base::StringPrintf("body { background-color: #%02X%02X%02X; }", 172 return base::StringPrintf("body { background-color: #%02X%02X%02X; }",
173 SkColorGetR(background_color), 173 SkColorGetR(background_color),
174 SkColorGetG(background_color), 174 SkColorGetG(background_color),
175 SkColorGetB(background_color)); 175 SkColorGetB(background_color));
176 } 176 }
177 177
178 std::string GetLocalNtpPath() { 178 std::string GetLocalNtpPath() {
179 return std::string(chrome::kChromeSearchScheme) + "://" + 179 return std::string(chrome::kChromeSearchScheme) + "://" +
180 std::string(chrome::kChromeSearchLocalNtpHost) + "/"; 180 std::string(chrome::kChromeSearchLocalNtpHost) + "/";
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 264 }
265 } 265 }
266 return false; 266 return false;
267 } 267 }
268 268
269 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { 269 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const {
270 // Allow embedding of most visited iframes. 270 // Allow embedding of most visited iframes.
271 return base::StringPrintf("frame-src %s;", 271 return base::StringPrintf("frame-src %s;",
272 chrome::kChromeSearchMostVisitedUrl); 272 chrome::kChromeSearchMostVisitedUrl);
273 } 273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698