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_bundle_win.h" | 5 #include "ui/base/resource/resource_bundle_win.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "ui/base/layout.h" | 10 #include "ui/base/layout.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 bool use_hidpi = false; | 42 bool use_hidpi = false; |
43 #if defined(ENABLE_HIDPI) | 43 #if defined(ENABLE_HIDPI) |
44 // If we're running in HiDPI mode at a scale larger than 150%, we switch | 44 // If we're running in HiDPI mode at a scale larger than 150%, we switch |
45 // to 2x resources for desktop layouts. | 45 // to 2x resources for desktop layouts. |
46 use_hidpi = ui::GetDPIScale() > 1.5; | 46 use_hidpi = ui::GetDPIScale() > 1.5; |
47 #endif | 47 #endif |
48 | 48 |
49 switch (ui::GetDisplayLayout()) { | 49 switch (ui::GetDisplayLayout()) { |
50 case ui::LAYOUT_TOUCH: | 50 case ui::LAYOUT_TOUCH: |
51 AddDataPackFromPath( | 51 AddDataPackFromPath( |
52 GetResourcesPakFilePath("theme_resources_touch_1x.pak"), | 52 GetResourcesPakFilePath("theme_resources_touch_100_percent.pak"), |
53 SCALE_FACTOR_100P); | 53 SCALE_FACTOR_100P); |
54 AddDataPackFromPath( | 54 AddDataPackFromPath( |
55 GetResourcesPakFilePath("ui_resources_standard.pak"), | 55 GetResourcesPakFilePath("ui_resources_100_percent.pak"), |
56 SCALE_FACTOR_100P); | 56 SCALE_FACTOR_100P); |
57 break; | 57 break; |
58 default: | 58 default: |
59 if (use_hidpi) { | 59 if (use_hidpi) { |
60 AddDataPackFromPath(GetResourcesPakFilePath("theme_resources_2x.pak"), | 60 AddDataPackFromPath(GetResourcesPakFilePath( |
| 61 "theme_resources_200_percent.pak"), |
61 SCALE_FACTOR_200P); | 62 SCALE_FACTOR_200P); |
62 AddDataPackFromPath(GetResourcesPakFilePath("ui_resources_2x.pak"), | 63 AddDataPackFromPath(GetResourcesPakFilePath( |
| 64 "ui_resources_200_percent.pak"), |
63 SCALE_FACTOR_200P); | 65 SCALE_FACTOR_200P); |
64 } else { | 66 } else { |
65 AddDataPackFromPath( | 67 AddDataPackFromPath( |
66 GetResourcesPakFilePath("theme_resources_standard.pak"), | 68 GetResourcesPakFilePath("theme_resources_100_percent.pak"), |
67 SCALE_FACTOR_100P); | 69 SCALE_FACTOR_100P); |
68 AddDataPackFromPath( | 70 AddDataPackFromPath( |
69 GetResourcesPakFilePath("ui_resources_standard.pak"), | 71 GetResourcesPakFilePath("ui_resources_100_percent.pak"), |
70 SCALE_FACTOR_100P); | 72 SCALE_FACTOR_100P); |
71 } | 73 } |
72 break; | 74 break; |
73 } | 75 } |
74 } | 76 } |
75 | 77 |
76 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { | 78 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { |
77 // Flipped image is not used on Windows. | 79 // Flipped image is not used on Windows. |
78 DCHECK_EQ(rtl, RTL_DISABLED); | 80 DCHECK_EQ(rtl, RTL_DISABLED); |
79 | 81 |
80 // Windows only uses SkBitmap for gfx::Image, so this is the same as | 82 // Windows only uses SkBitmap for gfx::Image, so this is the same as |
81 // GetImageNamed. | 83 // GetImageNamed. |
82 return GetImageNamed(resource_id); | 84 return GetImageNamed(resource_id); |
83 } | 85 } |
84 | 86 |
85 void SetResourcesDataDLL(HINSTANCE handle) { | 87 void SetResourcesDataDLL(HINSTANCE handle) { |
86 resources_data_dll = handle; | 88 resources_data_dll = handle; |
87 } | 89 } |
88 | 90 |
89 HICON LoadThemeIconFromResourcesDataDLL(int icon_id) { | 91 HICON LoadThemeIconFromResourcesDataDLL(int icon_id) { |
90 return ::LoadIcon(GetCurrentResourceDLL(), MAKEINTRESOURCE(icon_id)); | 92 return ::LoadIcon(GetCurrentResourceDLL(), MAKEINTRESOURCE(icon_id)); |
91 } | 93 } |
92 | 94 |
93 } // namespace ui; | 95 } // namespace ui; |
OLD | NEW |