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

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

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Convert ptr to bool for win compile. Created 8 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 | Annotate | Revision Log
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 29 matching lines...) Expand all
40 40
41 // Writes a pack file containing |resources| to |path|. If there are any 41 // 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 42 // text resources to be written, their encoding must already agree to the
43 // |textEncodingType| specified. If no text resources are present, please 43 // |textEncodingType| specified. If no text resources are present, please
44 // indicate BINARY. 44 // indicate BINARY.
45 static bool WritePack(const FilePath& path, 45 static bool WritePack(const FilePath& path,
46 const std::map<uint16, base::StringPiece>& resources, 46 const std::map<uint16, base::StringPiece>& resources,
47 TextEncodingType textEncodingType); 47 TextEncodingType textEncodingType);
48 48
49 // ResourceHandle implementation: 49 // ResourceHandle implementation:
50 virtual bool HasResource(uint16 resource_id) const OVERRIDE;
50 virtual bool GetStringPiece(uint16 resource_id, 51 virtual bool GetStringPiece(uint16 resource_id,
51 base::StringPiece* data) const OVERRIDE; 52 base::StringPiece* data) const OVERRIDE;
52 virtual base::RefCountedStaticMemory* GetStaticMemory( 53 virtual base::RefCountedStaticMemory* GetStaticMemory(
53 uint16 resource_id) const OVERRIDE; 54 uint16 resource_id) const OVERRIDE;
54 virtual TextEncodingType GetTextEncodingType() const OVERRIDE; 55 virtual TextEncodingType GetTextEncodingType() const OVERRIDE;
55 virtual float GetScaleFactor() const OVERRIDE; 56 virtual float GetScaleFactor() const OVERRIDE;
56 57
57 private: 58 private:
58 // The memory-mapped data. 59 // The memory-mapped data.
59 scoped_ptr<file_util::MemoryMappedFile> mmap_; 60 scoped_ptr<file_util::MemoryMappedFile> mmap_;
60 61
61 // Number of resources in the data. 62 // Number of resources in the data.
62 size_t resource_count_; 63 size_t resource_count_;
63 64
64 // Type of encoding for text resources. 65 // Type of encoding for text resources.
65 TextEncodingType text_encoding_type_; 66 TextEncodingType text_encoding_type_;
66 67
67 // The scale of the image in this resource pack relative to images in the 1x 68 // The scale of the image in this resource pack relative to images in the 1x
68 // resource pak. 69 // resource pak.
69 float scale_factor_; 70 float scale_factor_;
70 71
71 DISALLOW_COPY_AND_ASSIGN(DataPack); 72 DISALLOW_COPY_AND_ASSIGN(DataPack);
72 }; 73 };
73 74
74 } // namespace ui 75 } // namespace ui
75 76
76 #endif // UI_BASE_RESOURCE_DATA_PACK_H_ 77 #endif // UI_BASE_RESOURCE_DATA_PACK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698