Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: ui/views/window/custom_frame_view.cc

Issue 2190593002: [Win] CustomFrameView::IconSize() should return the value in dip unit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698