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

Side by Side Diff: ui/base/resource/data_pack.h

Issue 394313002: Add support for loading pak files from arbitrary file regions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Win implementation Created 6 years, 5 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
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 // DataPack represents a read-only view onto an on-disk file that contains 5 // DataPack represents a read-only view onto an on-disk file that contains
6 // (key, value) pairs of data. It's used to store static resources like 6 // (key, value) pairs of data. It's used to store static resources like
7 // translation strings and images. 7 // translation strings and images.
8 8
9 #ifndef UI_BASE_RESOURCE_DATA_PACK_H_ 9 #ifndef UI_BASE_RESOURCE_DATA_PACK_H_
10 #define UI_BASE_RESOURCE_DATA_PACK_H_ 10 #define UI_BASE_RESOURCE_DATA_PACK_H_
(...skipping 20 matching lines...) Expand all
31 public: 31 public:
32 DataPack(ui::ScaleFactor scale_factor); 32 DataPack(ui::ScaleFactor scale_factor);
33 virtual ~DataPack(); 33 virtual ~DataPack();
34 34
35 // Load a pack file from |path|, returning false on error. 35 // Load a pack file from |path|, returning false on error.
36 bool LoadFromPath(const base::FilePath& path); 36 bool LoadFromPath(const base::FilePath& path);
37 37
38 // Loads a pack file from |file|, returning false on error. 38 // Loads a pack file from |file|, returning false on error.
39 bool LoadFromFile(base::File file); 39 bool LoadFromFile(base::File file);
40 40
41 // Loads a pack file from |region| of |file|, returning false on error.
42 bool LoadFromFileRegion(base::File file, const base::File::Region& region);
43
41 // Writes a pack file containing |resources| to |path|. If there are any 44 // Writes a pack file containing |resources| to |path|. If there are any
42 // text resources to be written, their encoding must already agree to the 45 // text resources to be written, their encoding must already agree to the
43 // |textEncodingType| specified. If no text resources are present, please 46 // |textEncodingType| specified. If no text resources are present, please
44 // indicate BINARY. 47 // indicate BINARY.
45 static bool WritePack(const base::FilePath& path, 48 static bool WritePack(const base::FilePath& path,
46 const std::map<uint16, base::StringPiece>& resources, 49 const std::map<uint16, base::StringPiece>& resources,
47 TextEncodingType textEncodingType); 50 TextEncodingType textEncodingType);
48 51
49 // ResourceHandle implementation: 52 // ResourceHandle implementation:
50 virtual bool HasResource(uint16 resource_id) const OVERRIDE; 53 virtual bool HasResource(uint16 resource_id) const OVERRIDE;
(...skipping 20 matching lines...) Expand all
71 // The scale of the image in this resource pack relative to images in the 1x 74 // The scale of the image in this resource pack relative to images in the 1x
72 // resource pak. 75 // resource pak.
73 ui::ScaleFactor scale_factor_; 76 ui::ScaleFactor scale_factor_;
74 77
75 DISALLOW_COPY_AND_ASSIGN(DataPack); 78 DISALLOW_COPY_AND_ASSIGN(DataPack);
76 }; 79 };
77 80
78 } // namespace ui 81 } // namespace ui
79 82
80 #endif // UI_BASE_RESOURCE_DATA_PACK_H_ 83 #endif // UI_BASE_RESOURCE_DATA_PACK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698