OLD | NEW |
---|---|
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 GetStringPiece(uint16 resource_id, | 50 virtual bool GetStringPiece(uint16 resource_id, |
51 base::StringPiece* data) const OVERRIDE; | 51 base::StringPiece* data) const OVERRIDE; |
52 virtual base::RefCountedStaticMemory* GetStaticMemory( | 52 virtual base::RefCountedStaticMemory* GetStaticMemory( |
53 uint16 resource_id) const OVERRIDE; | 53 uint16 resource_id) const OVERRIDE; |
54 virtual TextEncodingType GetTextEncodingType() const OVERRIDE; | 54 virtual TextEncodingType GetTextEncodingType() const OVERRIDE; |
55 virtual float GetScaleFactor() const OVERRIDE; | |
56 | |
57 void set_scale_factor(float scale_factor) { scale_factor_ = scale_factor; } | |
sky
2012/04/25 21:11:42
Do you really need a setter here? A setter implies
sail
2012/04/25 22:18:35
Done.
Removed setter.
| |
55 | 58 |
56 private: | 59 private: |
57 // The memory-mapped data. | 60 // The memory-mapped data. |
58 scoped_ptr<file_util::MemoryMappedFile> mmap_; | 61 scoped_ptr<file_util::MemoryMappedFile> mmap_; |
59 | 62 |
60 // Number of resources in the data. | 63 // Number of resources in the data. |
61 size_t resource_count_; | 64 size_t resource_count_; |
62 | 65 |
63 // Type of encoding for text resources. | 66 // Type of encoding for text resources. |
64 TextEncodingType text_encoding_type_; | 67 TextEncodingType text_encoding_type_; |
65 | 68 |
69 // The scale factor of image resources. | |
sky
2012/04/25 21:11:42
This isn't really clear. It reads like all images
sail
2012/04/25 22:18:35
Done.
| |
70 float scale_factor_; | |
71 | |
66 DISALLOW_COPY_AND_ASSIGN(DataPack); | 72 DISALLOW_COPY_AND_ASSIGN(DataPack); |
67 }; | 73 }; |
68 | 74 |
69 } // namespace ui | 75 } // namespace ui |
70 | 76 |
71 #endif // UI_BASE_RESOURCE_DATA_PACK_H_ | 77 #endif // UI_BASE_RESOURCE_DATA_PACK_H_ |
OLD | NEW |