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

Side by Side Diff: ui/base/resource/resource_data_dll_win.cc

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac and win compile errors. Created 8 years, 7 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 #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 if (base::win::GetDataResourceFromModule(module_,
tony 2012/05/15 20:19:56 Can you just return the results of this function c
flackr 2012/05/16 13:39:23 Done.
24 resource_id,
25 &data_ptr,
26 &data_size)) {
27 return true;
28 }
29 return false;
30 }
31
20 bool ResourceDataDLL::GetStringPiece(uint16 resource_id, 32 bool ResourceDataDLL::GetStringPiece(uint16 resource_id,
21 base::StringPiece* data) const { 33 base::StringPiece* data) const {
22 DCHECK(data); 34 DCHECK(data);
23 void* data_ptr; 35 void* data_ptr;
24 size_t data_size; 36 size_t data_size;
25 if (base::win::GetDataResourceFromModule(module_, 37 if (base::win::GetDataResourceFromModule(module_,
26 resource_id, 38 resource_id,
27 &data_ptr, 39 &data_ptr,
28 &data_size)) { 40 &data_size)) {
29 data->set(static_cast<const char*>(data_ptr), data_size); 41 data->set(static_cast<const char*>(data_ptr), data_size);
(...skipping 11 matching lines...) Expand all
41 return new base::RefCountedStaticMemory( 53 return new base::RefCountedStaticMemory(
42 reinterpret_cast<const unsigned char*>(data_ptr), data_size); 54 reinterpret_cast<const unsigned char*>(data_ptr), data_size);
43 } 55 }
44 return NULL; 56 return NULL;
45 } 57 }
46 58
47 ResourceHandle::TextEncodingType ResourceDataDLL::GetTextEncodingType() const { 59 ResourceHandle::TextEncodingType ResourceDataDLL::GetTextEncodingType() const {
48 return BINARY; 60 return BINARY;
49 } 61 }
50 62
51 float ResourceDataDLL::GetScaleFactor() const { 63 ScaleFactor ResourceDataDLL::GetScaleFactor() const {
52 return 1.0; 64 return ui::kScaleFactorNone;
53 } 65 }
54 66
55 } // namespace ui 67 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698