Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / base / resource / resource_data_dll_win.cc
blob1b8ff45f19363623bc358133adb6e152e7e8dd70
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"
11 namespace ui {
13 ResourceDataDLL::ResourceDataDLL(HINSTANCE module) : module_(module) {
14 DCHECK(module_);
17 ResourceDataDLL::~ResourceDataDLL() {
20 bool ResourceDataDLL::HasResource(uint16 resource_id) const {
21 void* data_ptr;
22 size_t data_size;
23 return base::win::GetDataResourceFromModule(module_,
24 resource_id,
25 &data_ptr,
26 &data_size);
29 bool ResourceDataDLL::GetStringPiece(uint16 resource_id,
30 base::StringPiece* data) const {
31 DCHECK(data);
32 void* data_ptr;
33 size_t data_size;
34 if (base::win::GetDataResourceFromModule(module_,
35 resource_id,
36 &data_ptr,
37 &data_size)) {
38 data->set(static_cast<const char*>(data_ptr), data_size);
39 return true;
41 return false;
44 base::RefCountedStaticMemory* ResourceDataDLL::GetStaticMemory(
45 uint16 resource_id) const {
46 void* data_ptr;
47 size_t data_size;
48 if (base::win::GetDataResourceFromModule(module_, resource_id, &data_ptr,
49 &data_size)) {
50 return new base::RefCountedStaticMemory(data_ptr, data_size);
52 return NULL;
55 ResourceHandle::TextEncodingType ResourceDataDLL::GetTextEncodingType() const {
56 return BINARY;
59 ScaleFactor ResourceDataDLL::GetScaleFactor() const {
60 return ui::SCALE_FACTOR_NONE;
63 bool ResourceDataDLL::HasOnlyMaterialDesignAssets() const {
64 return false;
67 } // namespace ui