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 #include "ui/base/resource/resource_data_dll_win.h" | 5 #include "ui/base/resource/resource_data_dll_win.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 #include "base/win/resource_util.h" | 9 #include "base/win/resource_util.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
12 | 12 |
13 ResourceDataDLL::ResourceDataDLL(HINSTANCE module) : module_(module) { | 13 ResourceDataDLL::ResourceDataDLL(HINSTANCE module) : module_(module) { |
14 DCHECK(module_); | 14 DCHECK(module_); |
15 } | 15 } |
16 | 16 |
17 ResourceDataDLL::~ResourceDataDLL() { | 17 ResourceDataDLL::~ResourceDataDLL() { |
18 } | 18 } |
19 | 19 |
| 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); |
| 27 } |
| 28 |
20 bool ResourceDataDLL::GetStringPiece(uint16 resource_id, | 29 bool ResourceDataDLL::GetStringPiece(uint16 resource_id, |
21 base::StringPiece* data) const { | 30 base::StringPiece* data) const { |
22 DCHECK(data); | 31 DCHECK(data); |
23 void* data_ptr; | 32 void* data_ptr; |
24 size_t data_size; | 33 size_t data_size; |
25 if (base::win::GetDataResourceFromModule(module_, | 34 if (base::win::GetDataResourceFromModule(module_, |
26 resource_id, | 35 resource_id, |
27 &data_ptr, | 36 &data_ptr, |
28 &data_size)) { | 37 &data_size)) { |
29 data->set(static_cast<const char*>(data_ptr), data_size); | 38 data->set(static_cast<const char*>(data_ptr), data_size); |
(...skipping 11 matching lines...) Expand all Loading... |
41 return new base::RefCountedStaticMemory( | 50 return new base::RefCountedStaticMemory( |
42 reinterpret_cast<const unsigned char*>(data_ptr), data_size); | 51 reinterpret_cast<const unsigned char*>(data_ptr), data_size); |
43 } | 52 } |
44 return NULL; | 53 return NULL; |
45 } | 54 } |
46 | 55 |
47 ResourceHandle::TextEncodingType ResourceDataDLL::GetTextEncodingType() const { | 56 ResourceHandle::TextEncodingType ResourceDataDLL::GetTextEncodingType() const { |
48 return BINARY; | 57 return BINARY; |
49 } | 58 } |
50 | 59 |
51 float ResourceDataDLL::GetScaleFactor() const { | 60 ScaleFactor ResourceDataDLL::GetScaleFactor() const { |
52 return 1.0; | 61 return ui::SCALE_FACTOR_NONE; |
53 } | 62 } |
54 | 63 |
55 } // namespace ui | 64 } // namespace ui |
OLD | NEW |