OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/ntp/new_tab_ui.h" | 5 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 resource_map_.find(resource); | 221 resource_map_.find(resource); |
222 if (it != resource_map_.end()) | 222 if (it != resource_map_.end()) |
223 return it->second.first; | 223 return it->second.first; |
224 return "text/html"; | 224 return "text/html"; |
225 } | 225 } |
226 | 226 |
227 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { | 227 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { |
228 return false; | 228 return false; |
229 } | 229 } |
230 | 230 |
231 bool NewTabUI::NewTabHTMLSource::ShouldAddContentSecurityPolicy() const { | 231 std::string NewTabUI::NewTabHTMLSource::GetContentSecurityPolicyScriptSrc() |
232 return false; | 232 const { |
233 // Add 'unsafe-inline' and google resources to script-src. | |
234 return "script-src chrome://resources 'self' 'unsafe-eval' 'unsafe-inline' " | |
235 "*.google.com *.gstatic.com;"; | |
Dan Beam
2016/05/31 21:46:09
why is this wrapped here?
wychen
2016/05/31 23:04:34
Otherwise it couldn't fit in 80 chars. The whole s
Dan Beam
2016/05/31 23:13:14
i meant: the indent should be 4 \s for a continuat
wychen
2016/06/01 00:19:19
Oh. I see what you meant. I aligned the 2nd line w
| |
236 } | |
237 | |
238 std::string NewTabUI::NewTabHTMLSource::GetContentSecurityPolicyStyleSrc() | |
239 const { | |
240 return "style-src 'self' chrome://resources 'unsafe-inline' chrome://theme;"; | |
241 } | |
242 | |
243 std::string NewTabUI::NewTabHTMLSource::GetContentSecurityPolicyImgSrc() | |
244 const { | |
245 return "img-src chrome-search://thumb chrome-search://thumb2 data:;"; | |
246 } | |
247 | |
248 std::string NewTabUI::NewTabHTMLSource::GetContentSecurityPolicyFrameSrc() | |
249 const { | |
250 return "frame-src chrome-search://most-visited;"; | |
233 } | 251 } |
234 | 252 |
235 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, | 253 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, |
236 const char* mime_type, | 254 const char* mime_type, |
237 int resource_id) { | 255 int resource_id) { |
238 DCHECK(resource); | 256 DCHECK(resource); |
239 DCHECK(mime_type); | 257 DCHECK(mime_type); |
240 resource_map_[std::string(resource)] = | 258 resource_map_[std::string(resource)] = |
241 std::make_pair(std::string(mime_type), resource_id); | 259 std::make_pair(std::string(mime_type), resource_id); |
242 } | 260 } |
243 | 261 |
244 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} | 262 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} |
OLD | NEW |