| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |