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

Side by Side Diff: ui/base/resource/resource_bundle.cc

Issue 1969313005: [headless] Embed pak file into binary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated years in copyright Created 3 years, 10 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 | « ui/base/resource/resource_bundle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/base/resource/resource_bundle.h" 5 #include "ui/base/resource/resource_bundle.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 AddDataPackFromPathInternal(path, scale_factor, true); 262 AddDataPackFromPathInternal(path, scale_factor, true);
263 } 263 }
264 264
265 void ResourceBundle::AddDataPackFromFile(base::File file, 265 void ResourceBundle::AddDataPackFromFile(base::File file,
266 ScaleFactor scale_factor) { 266 ScaleFactor scale_factor) {
267 AddDataPackFromFileRegion(std::move(file), 267 AddDataPackFromFileRegion(std::move(file),
268 base::MemoryMappedFile::Region::kWholeFile, 268 base::MemoryMappedFile::Region::kWholeFile,
269 scale_factor); 269 scale_factor);
270 } 270 }
271 271
272 void ResourceBundle::AddDataPackFromBuffer(base::StringPiece buffer,
273 ScaleFactor scale_factor) {
274 std::unique_ptr<DataPack> data_pack(new DataPack(scale_factor));
275 if (data_pack->LoadFromBuffer(buffer)) {
276 AddDataPack(data_pack.release());
277 } else {
278 LOG(ERROR) << "Failed to load data pack from buffer";
279 }
280 }
281
272 void ResourceBundle::AddDataPackFromFileRegion( 282 void ResourceBundle::AddDataPackFromFileRegion(
273 base::File file, 283 base::File file,
274 const base::MemoryMappedFile::Region& region, 284 const base::MemoryMappedFile::Region& region,
275 ScaleFactor scale_factor) { 285 ScaleFactor scale_factor) {
276 std::unique_ptr<DataPack> data_pack(new DataPack(scale_factor)); 286 std::unique_ptr<DataPack> data_pack(new DataPack(scale_factor));
277 if (data_pack->LoadFromFileRegion(std::move(file), region)) { 287 if (data_pack->LoadFromFileRegion(std::move(file), region)) {
278 AddDataPack(data_pack.release()); 288 AddDataPack(data_pack.release());
279 } else { 289 } else {
280 LOG(ERROR) << "Failed to load data pack from file." 290 LOG(ERROR) << "Failed to load data pack from file."
281 << "\nSome features may not be available."; 291 << "\nSome features may not be available.";
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 // static 908 // static
899 bool ResourceBundle::DecodePNG(const unsigned char* buf, 909 bool ResourceBundle::DecodePNG(const unsigned char* buf,
900 size_t size, 910 size_t size,
901 SkBitmap* bitmap, 911 SkBitmap* bitmap,
902 bool* fell_back_to_1x) { 912 bool* fell_back_to_1x) {
903 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); 913 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size);
904 return gfx::PNGCodec::Decode(buf, size, bitmap); 914 return gfx::PNGCodec::Decode(buf, size, bitmap);
905 } 915 }
906 916
907 } // namespace ui 917 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698