| 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/native_theme/native_theme_win.h" | 5 #include "ui/native_theme/native_theme_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <uxtheme.h> | 8 #include <uxtheme.h> |
| 9 #include <vsstyle.h> | 9 #include <vsstyle.h> |
| 10 #include <vssym32.h> | 10 #include <vssym32.h> |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 226 |
| 227 gfx::Size NativeThemeWin::GetPartSize(Part part, | 227 gfx::Size NativeThemeWin::GetPartSize(Part part, |
| 228 State state, | 228 State state, |
| 229 const ExtraParams& extra) const { | 229 const ExtraParams& extra) const { |
| 230 gfx::Size part_size = CommonThemeGetPartSize(part, state, extra); | 230 gfx::Size part_size = CommonThemeGetPartSize(part, state, extra); |
| 231 if (!part_size.IsEmpty()) | 231 if (!part_size.IsEmpty()) |
| 232 return part_size; | 232 return part_size; |
| 233 | 233 |
| 234 // The GetThemePartSize call below returns the default size without | 234 // The GetThemePartSize call below returns the default size without |
| 235 // accounting for user customization (crbug/218291). | 235 // accounting for user customization (crbug/218291). |
| 236 SIZE size; | |
| 237 switch (part) { | 236 switch (part) { |
| 238 case kScrollbarDownArrow: | 237 case kScrollbarDownArrow: |
| 239 case kScrollbarLeftArrow: | 238 case kScrollbarLeftArrow: |
| 240 case kScrollbarRightArrow: | 239 case kScrollbarRightArrow: |
| 241 case kScrollbarUpArrow: | 240 case kScrollbarUpArrow: |
| 242 case kScrollbarHorizontalThumb: | 241 case kScrollbarHorizontalThumb: |
| 243 case kScrollbarVerticalThumb: | 242 case kScrollbarVerticalThumb: |
| 244 case kScrollbarHorizontalTrack: | 243 case kScrollbarHorizontalTrack: |
| 245 case kScrollbarVerticalTrack: | 244 case kScrollbarVerticalTrack: { |
| 246 size.cx = size.cy = gfx::win::GetSystemMetricsInDIP(SM_CXVSCROLL); | 245 int size = gfx::win::GetSystemMetricsInDIP(SM_CXVSCROLL); |
| 247 return gfx::Size(size.cx, size.cy); | 246 if (size == 0) |
| 247 size = 17; |
| 248 return gfx::Size(size, size); |
| 249 } |
| 248 } | 250 } |
| 249 | 251 |
| 250 int part_id = GetWindowsPart(part, state, extra); | 252 int part_id = GetWindowsPart(part, state, extra); |
| 251 int state_id = GetWindowsState(part, state, extra); | 253 int state_id = GetWindowsState(part, state, extra); |
| 252 | 254 |
| 255 SIZE size; |
| 253 HDC hdc = GetDC(NULL); | 256 HDC hdc = GetDC(NULL); |
| 254 HRESULT hr = GetThemePartSize(GetThemeName(part), hdc, part_id, state_id, | 257 HRESULT hr = GetThemePartSize(GetThemeName(part), hdc, part_id, state_id, |
| 255 NULL, TS_TRUE, &size); | 258 NULL, TS_TRUE, &size); |
| 256 ReleaseDC(NULL, hdc); | 259 ReleaseDC(NULL, hdc); |
| 257 | 260 |
| 258 if (FAILED(hr)) { | 261 if (FAILED(hr)) { |
| 259 // TODO(rogerta): For now, we need to support radio buttons and checkboxes | 262 // TODO(rogerta): For now, we need to support radio buttons and checkboxes |
| 260 // when theming is not enabled. Support for other parts can be added | 263 // when theming is not enabled. Support for other parts can be added |
| 261 // if/when needed. | 264 // if/when needed. |
| 262 switch (part) { | 265 switch (part) { |
| (...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2089 handle = open_theme_(NULL, L"Spin"); | 2092 handle = open_theme_(NULL, L"Spin"); |
| 2090 break; | 2093 break; |
| 2091 default: | 2094 default: |
| 2092 NOTREACHED(); | 2095 NOTREACHED(); |
| 2093 } | 2096 } |
| 2094 theme_handles_[theme_name] = handle; | 2097 theme_handles_[theme_name] = handle; |
| 2095 return handle; | 2098 return handle; |
| 2096 } | 2099 } |
| 2097 | 2100 |
| 2098 } // namespace ui | 2101 } // namespace ui |
| OLD | NEW |