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 #ifndef UI_BASE_RESOURCE_RESOURCE_HANDLE_H_ | 5 #ifndef UI_BASE_RESOURCE_RESOURCE_HANDLE_H_ |
6 #define UI_BASE_RESOURCE_RESOURCE_HANDLE_H_ | 6 #define UI_BASE_RESOURCE_RESOURCE_HANDLE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 enum TextEncodingType { | 22 enum TextEncodingType { |
23 BINARY, | 23 BINARY, |
24 UTF8, | 24 UTF8, |
25 UTF16 | 25 UTF16 |
26 }; | 26 }; |
27 | 27 |
28 // The scale factors for image resources. | 28 // The scale factors for image resources. |
29 static const float kScaleFactor100x; | 29 static const float kScaleFactor100x; |
30 static const float kScaleFactor200x; | 30 static const float kScaleFactor200x; |
31 | 31 |
32 // This scale factor is used for non-image resources. | |
33 static const float kScaleFactorNone; | |
tony
2012/05/11 21:22:03
Can we combine the scale factors into an enum? Th
sail
2012/05/11 21:28:50
This used to be 1x and 2x but Joi made a good poin
| |
34 | |
32 virtual ~ResourceHandle() {} | 35 virtual ~ResourceHandle() {} |
33 | 36 |
37 // Returns true if the DataPack contains a resource with id |resource_id|. | |
38 virtual bool HasResource(uint16 resource_id) const = 0; | |
39 | |
34 // Get resource by id |resource_id|, filling in |data|. | 40 // Get resource by id |resource_id|, filling in |data|. |
35 // 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. |
36 // Returns false if the resource id isn't found. | 42 // Returns false if the resource id isn't found. |
37 virtual bool GetStringPiece(uint16 resource_id, | 43 virtual bool GetStringPiece(uint16 resource_id, |
38 base::StringPiece* data) const = 0; | 44 base::StringPiece* data) const = 0; |
39 | 45 |
40 // Like GetStringPiece(), but returns a reference to memory. | 46 // Like GetStringPiece(), but returns a reference to memory. |
41 // Caller owns the returned object. | 47 // Caller owns the returned object. |
42 virtual base::RefCountedStaticMemory* GetStaticMemory( | 48 virtual base::RefCountedStaticMemory* GetStaticMemory( |
43 uint16 resource_id) const = 0; | 49 uint16 resource_id) const = 0; |
44 | 50 |
45 // Get the encoding type of text resources. | 51 // Get the encoding type of text resources. |
46 virtual TextEncodingType GetTextEncodingType() const = 0; | 52 virtual TextEncodingType GetTextEncodingType() const = 0; |
47 | 53 |
48 // The scale of images in this resource pack relative to images in the 1x | 54 // The scale of images in this resource pack relative to images in the 1x |
49 // resource pak. | 55 // resource pak. |
50 virtual float GetScaleFactor() const = 0; | 56 virtual float GetScaleFactor() const = 0; |
51 }; | 57 }; |
52 | 58 |
53 } // namespace ui | 59 } // namespace ui |
54 | 60 |
55 #endif // UI_BASE_RESOURCE_RESOURCE_HANDLE_H_ | 61 #endif // UI_BASE_RESOURCE_RESOURCE_HANDLE_H_ |
OLD | NEW |