blob: b295b502742d43f7bf7563bafe2f1057146137db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/base/resource/resource_bundle_win.h"
#include "base/logging.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/resource/resource_data_dll_win.h"
namespace ui {
namespace {
HINSTANCE resources_data_dll;
HINSTANCE GetCurrentResourceDLL() {
if (resources_data_dll)
return resources_data_dll;
return GetModuleHandle(NULL);
}
} // end anonymous namespace
void ResourceBundle::LoadCommonResources() {
// As a convenience, add the current resource module as a data packs.
data_packs_.push_back(new ResourceDataDLL(GetCurrentResourceDLL()));
}
void ResourceBundle::LoadTestResources(const FilePath& path) {
// On Windows, the test resources are normally compiled into the binary
// itself.
}
gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) {
// Flipped image is not used on Windows.
DCHECK_EQ(rtl, RTL_DISABLED);
// Windows only uses SkBitmap for gfx::Image, so this is the same as
// GetImageNamed.
return GetImageNamed(resource_id);
}
void SetResourcesDataDLL(HINSTANCE handle) {
resources_data_dll = handle;
}
HICON LoadThemeIconFromResourcesDataDLL(int icon_id) {
return ::LoadIcon(GetCurrentResourceDLL(), MAKEINTRESOURCE(icon_id));
}
} // namespace ui;
|