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/views/window/custom_frame_view.h" | 5 #include "ui/views/window/custom_frame_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 #include "ui/views/views_delegate.h" | 24 #include "ui/views/views_delegate.h" |
25 #include "ui/views/widget/native_widget_private.h" | 25 #include "ui/views/widget/native_widget_private.h" |
26 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
27 #include "ui/views/widget/widget_delegate.h" | 27 #include "ui/views/widget/widget_delegate.h" |
28 #include "ui/views/window/client_view.h" | 28 #include "ui/views/window/client_view.h" |
29 #include "ui/views/window/frame_background.h" | 29 #include "ui/views/window/frame_background.h" |
30 #include "ui/views/window/window_button_order_provider.h" | 30 #include "ui/views/window/window_button_order_provider.h" |
31 #include "ui/views/window/window_resources.h" | 31 #include "ui/views/window/window_resources.h" |
32 #include "ui/views/window/window_shape.h" | 32 #include "ui/views/window/window_shape.h" |
33 | 33 |
34 #if defined(OS_WIN) | |
35 #include "ui/display/win/dpi.h" | |
36 #endif | |
37 | |
34 namespace views { | 38 namespace views { |
35 | 39 |
36 namespace { | 40 namespace { |
37 | 41 |
38 // The frame border is only visible in restored mode and is hardcoded to 4 px on | 42 // The frame border is only visible in restored mode and is hardcoded to 4 px on |
39 // each side regardless of the system window border size. | 43 // each side regardless of the system window border size. |
40 const int kFrameBorderThickness = 4; | 44 const int kFrameBorderThickness = 4; |
41 // In the window corners, the resize areas don't actually expand bigger, but the | 45 // In the window corners, the resize areas don't actually expand bigger, but the |
42 // 16 px at the end of each edge triggers diagonal resizing. | 46 // 16 px at the end of each edge triggers diagonal resizing. |
43 const int kResizeAreaCornerSize = 16; | 47 const int kResizeAreaCornerSize = 16; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 | 301 |
298 int CustomFrameView::TitlebarBottomThickness() const { | 302 int CustomFrameView::TitlebarBottomThickness() const { |
299 return kTitlebarTopAndBottomEdgeThickness + | 303 return kTitlebarTopAndBottomEdgeThickness + |
300 (ShouldShowClientEdge() ? kClientEdgeThickness : 0); | 304 (ShouldShowClientEdge() ? kClientEdgeThickness : 0); |
301 } | 305 } |
302 | 306 |
303 int CustomFrameView::IconSize() const { | 307 int CustomFrameView::IconSize() const { |
304 #if defined(OS_WIN) | 308 #if defined(OS_WIN) |
305 // This metric scales up if either the titlebar height or the titlebar font | 309 // This metric scales up if either the titlebar height or the titlebar font |
306 // size are increased. | 310 // size are increased. |
307 return GetSystemMetrics(SM_CYSMICON); | 311 return display::win::GetSystemMetricsInDIP(SM_CYSMICON); |
sky
2016/07/27 15:30:15
The conversion may vary between HWNDs. You should
| |
308 #else | 312 #else |
309 return std::max(GetTitleFontList().GetHeight(), kIconMinimumSize); | 313 return std::max(GetTitleFontList().GetHeight(), kIconMinimumSize); |
310 #endif | 314 #endif |
311 } | 315 } |
312 | 316 |
313 gfx::Rect CustomFrameView::IconBounds() const { | 317 gfx::Rect CustomFrameView::IconBounds() const { |
314 int size = IconSize(); | 318 int size = IconSize(); |
315 int frame_thickness = FrameBorderThickness(); | 319 int frame_thickness = FrameBorderThickness(); |
316 // Our frame border has a different "3D look" than Windows'. Theirs has a | 320 // Our frame border has a different "3D look" than Windows'. Theirs has a |
317 // more complex gradient on the top that they push their icon/title below; | 321 // more complex gradient on the top that they push their icon/title below; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
630 } | 634 } |
631 case views::FRAME_BUTTON_CLOSE: { | 635 case views::FRAME_BUTTON_CLOSE: { |
632 button = close_button_; | 636 button = close_button_; |
633 break; | 637 break; |
634 } | 638 } |
635 } | 639 } |
636 return button; | 640 return button; |
637 } | 641 } |
638 | 642 |
639 } // namespace views | 643 } // namespace views |
OLD | NEW |