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 #include "ui/base/resource/resource_data_dll_win.h"
7 #include "base/logging.h"
8 #include "base/memory/ref_counted_memory.h"
9 #include "base/win/resource_util.h"
13 ResourceDataDLL::ResourceDataDLL(HINSTANCE module
) : module_(module
) {
17 ResourceDataDLL::~ResourceDataDLL() {
20 bool ResourceDataDLL::HasResource(uint16 resource_id
) const {
23 return base::win::GetDataResourceFromModule(module_
,
29 bool ResourceDataDLL::GetStringPiece(uint16 resource_id
,
30 base::StringPiece
* data
) const {
34 if (base::win::GetDataResourceFromModule(module_
,
38 data
->set(static_cast<const char*>(data_ptr
), data_size
);
44 base::RefCountedStaticMemory
* ResourceDataDLL::GetStaticMemory(
45 uint16 resource_id
) const {
48 if (base::win::GetDataResourceFromModule(module_
, resource_id
, &data_ptr
,
50 return new base::RefCountedStaticMemory(data_ptr
, data_size
);
55 ResourceHandle::TextEncodingType
ResourceDataDLL::GetTextEncodingType() const {
59 ScaleFactor
ResourceDataDLL::GetScaleFactor() const {
60 return ui::SCALE_FACTOR_NONE
;
63 bool ResourceDataDLL::HasOnlyMaterialDesignAssets() const {