OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_VARIATIONS_SERVICE_UI_STRING_OVERRIDER_H_ | 5 #ifndef COMPONENTS_VARIATIONS_SERVICE_UI_STRING_OVERRIDER_H_ |
6 #define COMPONENTS_VARIATIONS_SERVICE_UI_STRING_OVERRIDER_H_ | 6 #define COMPONENTS_VARIATIONS_SERVICE_UI_STRING_OVERRIDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 | 11 |
12 namespace variations { | 12 namespace variations { |
13 | 13 |
14 // Provides a mapping from hashes of generated resource names to their IDs. The | 14 // Provides a mapping from hashes of generated resource names to their IDs. The |
15 // mapping is provided by the embedder as two arrays |resource_hashes|, a sorted | 15 // mapping is provided by the embedder as two arrays |resource_hashes|, a sorted |
16 // array of resource name hashes, and |resource_indices| an array of resource | 16 // array of resource name hashes, and |resource_indices| an array of resource |
17 // indices in the same order. | 17 // indices in the same order. |
18 // | 18 // |
19 // The mapping is created by generate_resources_map.py based on generated | 19 // The mapping is created by generate_ui_string_overrider.py based on generated |
20 // resources header files. The script ensure that if one header file contains | 20 // resources header files. The script ensure that if one header file contains |
21 // |#define IDS_FOO 12345| then for some index |i|, |resource_hashes[i]| will | 21 // |#define IDS_FOO 12345| then for some index |i|, |resource_hashes[i]| will |
22 // be equal to |HASH("IDS_FOO")| and |resource_indices[i]| will be equal to | 22 // be equal to |HASH("IDS_FOO")| and |resource_indices[i]| will be equal to |
23 // |12345|. | 23 // |12345|. |
24 // | 24 // |
25 // Both array must have the same length |num_resources|. They are not owned by | 25 // Both array must have the same length |num_resources|. They are not owned by |
26 // the UIStringOverrider and the embedder is responsible for their lifetime | 26 // the UIStringOverrider and the embedder is responsible for their lifetime |
27 // (usually by passing pointer to static data). | 27 // (usually by passing pointer to static data). |
28 // | 28 // |
29 // This class is copy-constructible by design as it does not owns the array | 29 // This class is copy-constructible by design as it does not owns the array |
(...skipping 18 matching lines...) Expand all Loading... |
48 const uint32_t* const resource_hashes_; | 48 const uint32_t* const resource_hashes_; |
49 const int* const resource_indices_; | 49 const int* const resource_indices_; |
50 size_t const num_resources_; | 50 size_t const num_resources_; |
51 | 51 |
52 DISALLOW_ASSIGN(UIStringOverrider); | 52 DISALLOW_ASSIGN(UIStringOverrider); |
53 }; | 53 }; |
54 | 54 |
55 } // namespace variations | 55 } // namespace variations |
56 | 56 |
57 #endif // COMPONENTS_VARIATIONS_SERVICE_UI_STRING_OVERRIDER_H_ | 57 #endif // COMPONENTS_VARIATIONS_SERVICE_UI_STRING_OVERRIDER_H_ |
OLD | NEW |