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