| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 #endif // !defined(GOOGLE_CHROME_BUILD) | 226 #endif // !defined(GOOGLE_CHROME_BUILD) |
| 227 | 227 |
| 228 float scale = 1.0f; | 228 float scale = 1.0f; |
| 229 std::string filename; | 229 std::string filename; |
| 230 webui::ParsePathAndScale( | 230 webui::ParsePathAndScale( |
| 231 GURL(GetLocalNtpPath() + stripped_path), &filename, &scale); | 231 GURL(GetLocalNtpPath() + stripped_path), &filename, &scale); |
| 232 ui::ScaleFactor scale_factor = ui::GetSupportedScaleFactor(scale); | 232 ui::ScaleFactor scale_factor = ui::GetSupportedScaleFactor(scale); |
| 233 | 233 |
| 234 for (size_t i = 0; i < arraysize(kResources); ++i) { | 234 for (size_t i = 0; i < arraysize(kResources); ++i) { |
| 235 if (filename == kResources[i].filename) { | 235 if (filename == kResources[i].filename) { |
| 236 scoped_refptr<base::RefCountedStaticMemory> response( | 236 scoped_refptr<base::RefCountedMemory> response( |
| 237 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 237 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
| 238 kResources[i].identifier, scale_factor)); | 238 kResources[i].identifier, scale_factor)); |
| 239 callback.Run(response.get()); | 239 callback.Run(response.get()); |
| 240 return; | 240 return; |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 callback.Run(NULL); | 243 callback.Run(NULL); |
| 244 } | 244 } |
| 245 | 245 |
| 246 std::string LocalNtpSource::GetMimeType( | 246 std::string LocalNtpSource::GetMimeType( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 return false; | 270 return false; |
| 271 } | 271 } |
| 272 | 272 |
| 273 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { | 273 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { |
| 274 // Allow embedding of most visited iframes. | 274 // Allow embedding of most visited iframes. |
| 275 return base::StringPrintf("frame-src %s;", | 275 return base::StringPrintf("frame-src %s;", |
| 276 chrome::kChromeSearchMostVisitedUrl); | 276 chrome::kChromeSearchMostVisitedUrl); |
| 277 } | 277 } |
| OLD | NEW |