OLD | NEW |
1 // Copyright (c) 2010 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 APP_DATA_PACK_H_ | 9 #ifndef UI_BASE_RESOURCE_DATA_PACK_H_ |
10 #define APP_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/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
17 | 17 |
| 18 class FilePath; |
| 19 class RefCountedStaticMemory; |
| 20 |
18 namespace base { | 21 namespace base { |
19 class StringPiece; | 22 class StringPiece; |
20 } | 23 } |
21 | 24 |
22 namespace file_util { | 25 namespace file_util { |
23 class MemoryMappedFile; | 26 class MemoryMappedFile; |
24 } | 27 } |
25 | 28 |
26 class FilePath; | 29 namespace ui { |
27 class RefCountedStaticMemory; | |
28 | |
29 | |
30 namespace app { | |
31 | 30 |
32 class DataPack { | 31 class DataPack { |
33 public: | 32 public: |
34 DataPack(); | 33 DataPack(); |
35 ~DataPack(); | 34 ~DataPack(); |
36 | 35 |
37 // Load a pack file from |path|, returning false on error. | 36 // Load a pack file from |path|, returning false on error. |
38 bool Load(const FilePath& path); | 37 bool Load(const FilePath& path); |
39 | 38 |
40 // Get resource by id |resource_id|, filling in |data|. | 39 // Get resource by id |resource_id|, filling in |data|. |
(...skipping 13 matching lines...) Expand all Loading... |
54 private: | 53 private: |
55 // The memory-mapped data. | 54 // The memory-mapped data. |
56 scoped_ptr<file_util::MemoryMappedFile> mmap_; | 55 scoped_ptr<file_util::MemoryMappedFile> mmap_; |
57 | 56 |
58 // Number of resources in the data. | 57 // Number of resources in the data. |
59 size_t resource_count_; | 58 size_t resource_count_; |
60 | 59 |
61 DISALLOW_COPY_AND_ASSIGN(DataPack); | 60 DISALLOW_COPY_AND_ASSIGN(DataPack); |
62 }; | 61 }; |
63 | 62 |
64 } // namespace app | 63 } // namespace ui |
65 | 64 |
66 #endif // APP_DATA_PACK_H_ | 65 #endif // UI_BASE_RESOURCE_DATA_PACK_H_ |
OLD | NEW |