Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: ui/base/resource/resource_handle.h

Issue 10151025: Add scale factor tag to data packs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "ui/base/ui_export.h" 11 #include "ui/base/ui_export.h"
12 12
13 namespace base { 13 namespace base {
14 class RefCountedStaticMemory; 14 class RefCountedStaticMemory;
15 } 15 }
16 16
17 namespace ui { 17 namespace ui {
18 18
19 class UI_EXPORT ResourceHandle { 19 class UI_EXPORT ResourceHandle {
20 public: 20 public:
21 // What type of encoding the text resources use. 21 // What type of encoding the text resources use.
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.
29 static const float kScaleFactor1x;
Jói 2012/04/26 11:02:05 Idea: Using percentage-based naming might make fo
sail 2012/05/01 04:16:02 Done.
30 static const float kScaleFactor2x;
oshima 2012/04/26 15:32:10 I *think* you can just do static const float kScal
sail 2012/05/01 04:16:02 Unfortunately this only works for ints. For floats
31
28 virtual ~ResourceHandle() {} 32 virtual ~ResourceHandle() {}
29 33
30 // Get resource by id |resource_id|, filling in |data|. 34 // Get resource by id |resource_id|, filling in |data|.
31 // The data is owned by the DataPack object and should not be modified. 35 // The data is owned by the DataPack object and should not be modified.
32 // Returns false if the resource id isn't found. 36 // Returns false if the resource id isn't found.
33 virtual bool GetStringPiece(uint16 resource_id, 37 virtual bool GetStringPiece(uint16 resource_id,
34 base::StringPiece* data) const = 0; 38 base::StringPiece* data) const = 0;
35 39
36 // Like GetStringPiece(), but returns a reference to memory. 40 // Like GetStringPiece(), but returns a reference to memory.
37 // Caller owns the returned object. 41 // Caller owns the returned object.
38 virtual base::RefCountedStaticMemory* GetStaticMemory( 42 virtual base::RefCountedStaticMemory* GetStaticMemory(
39 uint16 resource_id) const = 0; 43 uint16 resource_id) const = 0;
40 44
41 // Get the encoding type of text resources. 45 // Get the encoding type of text resources.
42 virtual TextEncodingType GetTextEncodingType() const = 0; 46 virtual TextEncodingType GetTextEncodingType() const = 0;
47
48 // The scale of images in this resource pack relative to images in the 1x
49 // resource pak.
50 virtual float GetScaleFactor() const = 0;
43 }; 51 };
44 52
45 } // namespace ui 53 } // namespace ui
46 54
47 #endif // UI_BASE_RESOURCE_RESOURCE_HANDLE_H_ 55 #endif // UI_BASE_RESOURCE_RESOURCE_HANDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698