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

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

Issue 1996723002: Switch ResourceBundle LoadDataResourceBytes to return RefCountedMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update to address newly added use Created 4 years, 7 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/iframe_source.cc ('k') | chrome/browser/ui/webui/ntp/new_tab_ui.cc » ('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 <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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/search/iframe_source.cc ('k') | chrome/browser/ui/webui/ntp/new_tab_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698