Remove profile-based per-host & default zoom level migration code.
[chromium-blink-merge.git] / ui / base / resource / resource_handle.h
blob4795834376074afe6d7207d1b55f8b62f449a21a
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
3 // found in the LICENSE file.
5 #ifndef UI_BASE_RESOURCE_RESOURCE_HANDLE_H_
6 #define UI_BASE_RESOURCE_RESOURCE_HANDLE_H_
8 #include "base/basictypes.h"
9 #include "base/strings/string_piece.h"
10 #include "ui/base/layout.h"
11 #include "ui/base/ui_base_export.h"
13 namespace base {
14 class RefCountedStaticMemory;
17 namespace ui {
19 class UI_BASE_EXPORT ResourceHandle {
20 public:
21 // What type of encoding the text resources use.
22 enum TextEncodingType {
23 BINARY,
24 UTF8,
25 UTF16
28 virtual ~ResourceHandle() {}
30 // Returns true if the DataPack contains a resource with id |resource_id|.
31 virtual bool HasResource(uint16 resource_id) const = 0;
33 // Get resource by id |resource_id|, filling in |data|.
34 // The data is owned by the DataPack object and should not be modified.
35 // Returns false if the resource id isn't found.
36 virtual bool GetStringPiece(uint16 resource_id,
37 base::StringPiece* data) const = 0;
39 // Like GetStringPiece(), but returns a reference to memory.
40 // Caller owns the returned object.
41 virtual base::RefCountedStaticMemory* GetStaticMemory(
42 uint16 resource_id) const = 0;
44 // Get the encoding type of text resources.
45 virtual TextEncodingType GetTextEncodingType() const = 0;
47 // The scale of images in this resource pack relative to images in the 1x
48 // resource pak.
49 virtual ScaleFactor GetScaleFactor() const = 0;
51 // Returns true if the only resources contained within this DataPack are
52 // material design image assets.
53 virtual bool HasOnlyMaterialDesignAssets() const = 0;
56 } // namespace ui
58 #endif // UI_BASE_RESOURCE_RESOURCE_HANDLE_H_