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

Side by Side Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc

Issue 2183103002: [Win] OBFV::GetIconSize() should return the value in dip unit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments 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 "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/themes/theme_properties.h" 8 #include "chrome/browser/themes/theme_properties.h"
9 #include "chrome/browser/themes/theme_service_factory.h" 9 #include "chrome/browser/themes/theme_service_factory.h"
10 #include "chrome/browser/ui/views/frame/browser_frame.h" 10 #include "chrome/browser/ui/views/frame/browser_frame.h"
(...skipping 24 matching lines...) Expand all
35 #include "ui/views/controls/label.h" 35 #include "ui/views/controls/label.h"
36 #include "ui/views/resources/grit/views_resources.h" 36 #include "ui/views/resources/grit/views_resources.h"
37 #include "ui/views/views_delegate.h" 37 #include "ui/views/views_delegate.h"
38 #include "ui/views/window/frame_background.h" 38 #include "ui/views/window/frame_background.h"
39 #include "ui/views/window/window_shape.h" 39 #include "ui/views/window/window_shape.h"
40 40
41 #if defined(OS_LINUX) 41 #if defined(OS_LINUX)
42 #include "ui/views/controls/menu/menu_runner.h" 42 #include "ui/views/controls/menu/menu_runner.h"
43 #endif 43 #endif
44 44
45 #if defined(OS_WIN)
46 #include "ui/display/win/dpi.h"
47 #endif
48
45 using content::WebContents; 49 using content::WebContents;
46 50
47 namespace { 51 namespace {
48 52
49 // In the window corners, the resize areas don't actually expand bigger, but the 53 // In the window corners, the resize areas don't actually expand bigger, but the
50 // 16 px at the end of each edge triggers diagonal resizing. 54 // 16 px at the end of each edge triggers diagonal resizing.
51 const int kResizeAreaCornerSize = 16; 55 const int kResizeAreaCornerSize = 16;
52 56
53 #if !defined(OS_WIN)
54 // The icon never shrinks below 16 px on a side.
55 const int kIconMinimumSize = 16;
56 #endif
57
58 } // namespace 57 } // namespace
59 58
60 /////////////////////////////////////////////////////////////////////////////// 59 ///////////////////////////////////////////////////////////////////////////////
61 // OpaqueBrowserFrameView, public: 60 // OpaqueBrowserFrameView, public:
62 61
63 OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, 62 OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame,
64 BrowserView* browser_view) 63 BrowserView* browser_view)
65 : BrowserNonClientFrameView(frame, browser_view), 64 : BrowserNonClientFrameView(frame, browser_view),
66 layout_(new OpaqueBrowserFrameViewLayout(this)), 65 layout_(new OpaqueBrowserFrameViewLayout(this)),
67 minimize_button_(nullptr), 66 minimize_button_(nullptr),
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 343 }
345 344
346 base::string16 OpaqueBrowserFrameView::GetWindowTitle() const { 345 base::string16 OpaqueBrowserFrameView::GetWindowTitle() const {
347 return frame()->widget_delegate()->GetWindowTitle(); 346 return frame()->widget_delegate()->GetWindowTitle();
348 } 347 }
349 348
350 int OpaqueBrowserFrameView::GetIconSize() const { 349 int OpaqueBrowserFrameView::GetIconSize() const {
351 #if defined(OS_WIN) 350 #if defined(OS_WIN)
352 // This metric scales up if either the titlebar height or the titlebar font 351 // This metric scales up if either the titlebar height or the titlebar font
353 // size are increased. 352 // size are increased.
354 return GetSystemMetrics(SM_CYSMICON); 353 return display::win::GetSystemMetricsInDIP(SM_CYSMICON);
355 #else 354 #else
355 // The icon never shrinks below 16 px on a side.
356 const int kIconMinimumSize = 16;
356 return std::max(BrowserFrame::GetTitleFontList().GetHeight(), 357 return std::max(BrowserFrame::GetTitleFontList().GetHeight(),
357 kIconMinimumSize); 358 kIconMinimumSize);
358 #endif 359 #endif
359 } 360 }
360 361
361 gfx::Size OpaqueBrowserFrameView::GetBrowserViewMinimumSize() const { 362 gfx::Size OpaqueBrowserFrameView::GetBrowserViewMinimumSize() const {
362 return browser_view()->GetMinimumSize(); 363 return browser_view()->GetMinimumSize();
363 } 364 }
364 365
365 bool OpaqueBrowserFrameView::ShouldShowCaptionButtons() const { 366 bool OpaqueBrowserFrameView::ShouldShowCaptionButtons() const {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 gfx::Rect side(x, y, kClientEdgeThickness, h); 809 gfx::Rect side(x, y, kClientEdgeThickness, h);
809 canvas->FillRect(side, color); 810 canvas->FillRect(side, color);
810 if (draw_bottom) { 811 if (draw_bottom) {
811 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), 812 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness),
812 kClientEdgeThickness), 813 kClientEdgeThickness),
813 color); 814 color);
814 } 815 }
815 side.Offset(w + kClientEdgeThickness, 0); 816 side.Offset(w + kClientEdgeThickness, 0);
816 canvas->FillRect(side, color); 817 canvas->FillRect(side, color);
817 } 818 }
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