OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ |
11 #pragma once | 11 #pragma once |
12 | 12 |
13 #include <map> | 13 #include <map> |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "ui/ui_api.h" |
17 | 18 |
18 class FilePath; | 19 class FilePath; |
19 class RefCountedStaticMemory; | 20 class RefCountedStaticMemory; |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 class StringPiece; | 23 class StringPiece; |
23 } | 24 } |
24 | 25 |
25 namespace file_util { | 26 namespace file_util { |
26 class MemoryMappedFile; | 27 class MemoryMappedFile; |
27 } | 28 } |
28 | 29 |
29 namespace ui { | 30 namespace ui { |
30 | 31 |
31 class DataPack { | 32 class UI_API DataPack { |
32 public: | 33 public: |
33 DataPack(); | 34 DataPack(); |
34 ~DataPack(); | 35 ~DataPack(); |
35 | 36 |
36 // Load a pack file from |path|, returning false on error. | 37 // Load a pack file from |path|, returning false on error. |
37 bool Load(const FilePath& path); | 38 bool Load(const FilePath& path); |
38 | 39 |
39 // Get resource by id |resource_id|, filling in |data|. | 40 // Get resource by id |resource_id|, filling in |data|. |
40 // The data is owned by the DataPack object and should not be modified. | 41 // The data is owned by the DataPack object and should not be modified. |
41 // Returns false if the resource id isn't found. | 42 // Returns false if the resource id isn't found. |
(...skipping 14 matching lines...) Expand all Loading... |
56 | 57 |
57 // Number of resources in the data. | 58 // Number of resources in the data. |
58 size_t resource_count_; | 59 size_t resource_count_; |
59 | 60 |
60 DISALLOW_COPY_AND_ASSIGN(DataPack); | 61 DISALLOW_COPY_AND_ASSIGN(DataPack); |
61 }; | 62 }; |
62 | 63 |
63 } // namespace ui | 64 } // namespace ui |
64 | 65 |
65 #endif // UI_BASE_RESOURCE_DATA_PACK_H_ | 66 #endif // UI_BASE_RESOURCE_DATA_PACK_H_ |
OLD | NEW |