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_100_percent.pak"), | 52 GetResourcesPakFilePath("chrome_touch_100_percent.pak"), |
53 SCALE_FACTOR_100P); | |
54 AddDataPackFromPath( | |
55 GetResourcesPakFilePath("ui_resources_100_percent.pak"), | |
56 SCALE_FACTOR_100P); | 53 SCALE_FACTOR_100P); |
57 break; | 54 break; |
58 default: | 55 default: |
59 if (use_hidpi) { | 56 if (use_hidpi) { |
60 AddDataPackFromPath(GetResourcesPakFilePath( | 57 AddDataPackFromPath(GetResourcesPakFilePath( |
61 "theme_resources_200_percent.pak"), | 58 "chrome_200_percent.pak"), |
62 SCALE_FACTOR_200P); | |
63 AddDataPackFromPath(GetResourcesPakFilePath( | |
64 "ui_resources_200_percent.pak"), | |
65 SCALE_FACTOR_200P); | 59 SCALE_FACTOR_200P); |
66 } else { | 60 } else { |
67 AddDataPackFromPath( | 61 AddDataPackFromPath( |
68 GetResourcesPakFilePath("theme_resources_100_percent.pak"), | 62 GetResourcesPakFilePath("chrome_100_percent.pak"), |
69 SCALE_FACTOR_100P); | |
70 AddDataPackFromPath( | |
71 GetResourcesPakFilePath("ui_resources_100_percent.pak"), | |
72 SCALE_FACTOR_100P); | 63 SCALE_FACTOR_100P); |
73 } | 64 } |
74 break; | 65 break; |
75 } | 66 } |
76 } | 67 } |
77 | 68 |
78 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { | 69 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { |
79 // Flipped image is not used on Windows. | 70 // Flipped image is not used on Windows. |
80 DCHECK_EQ(rtl, RTL_DISABLED); | 71 DCHECK_EQ(rtl, RTL_DISABLED); |
81 | 72 |
82 // Windows only uses SkBitmap for gfx::Image, so this is the same as | 73 // Windows only uses SkBitmap for gfx::Image, so this is the same as |
83 // GetImageNamed. | 74 // GetImageNamed. |
84 return GetImageNamed(resource_id); | 75 return GetImageNamed(resource_id); |
85 } | 76 } |
86 | 77 |
87 void SetResourcesDataDLL(HINSTANCE handle) { | 78 void SetResourcesDataDLL(HINSTANCE handle) { |
88 resources_data_dll = handle; | 79 resources_data_dll = handle; |
89 } | 80 } |
90 | 81 |
91 HICON LoadThemeIconFromResourcesDataDLL(int icon_id) { | 82 HICON LoadThemeIconFromResourcesDataDLL(int icon_id) { |
92 return ::LoadIcon(GetCurrentResourceDLL(), MAKEINTRESOURCE(icon_id)); | 83 return ::LoadIcon(GetCurrentResourceDLL(), MAKEINTRESOURCE(icon_id)); |
93 } | 84 } |
94 | 85 |
95 } // namespace ui; | 86 } // namespace ui; |
OLD | NEW |