Chromium Code Reviews| 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 "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 Loading... | |
| 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) | 57 #if !defined(OS_WIN) |
| 54 // The icon never shrinks below 16 px on a side. | 58 // The icon never shrinks below 16 px on a side. |
| 55 const int kIconMinimumSize = 16; | 59 const int kIconMinimumSize = 16; |
|
Peter Kasting
2016/07/26 22:31:08
Nit: While here, can you move this into the block
Sungmann Cho
2016/07/26 23:05:25
Done.
| |
| 56 #endif | 60 #endif |
| 57 | 61 |
| 58 } // namespace | 62 } // namespace |
| 59 | 63 |
| 60 /////////////////////////////////////////////////////////////////////////////// | 64 /////////////////////////////////////////////////////////////////////////////// |
| 61 // OpaqueBrowserFrameView, public: | 65 // OpaqueBrowserFrameView, public: |
| 62 | 66 |
| 63 OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, | 67 OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, |
| 64 BrowserView* browser_view) | 68 BrowserView* browser_view) |
| 65 : BrowserNonClientFrameView(frame, browser_view), | 69 : BrowserNonClientFrameView(frame, browser_view), |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 } | 348 } |
| 345 | 349 |
| 346 base::string16 OpaqueBrowserFrameView::GetWindowTitle() const { | 350 base::string16 OpaqueBrowserFrameView::GetWindowTitle() const { |
| 347 return frame()->widget_delegate()->GetWindowTitle(); | 351 return frame()->widget_delegate()->GetWindowTitle(); |
| 348 } | 352 } |
| 349 | 353 |
| 350 int OpaqueBrowserFrameView::GetIconSize() const { | 354 int OpaqueBrowserFrameView::GetIconSize() const { |
| 351 #if defined(OS_WIN) | 355 #if defined(OS_WIN) |
| 352 // This metric scales up if either the titlebar height or the titlebar font | 356 // This metric scales up if either the titlebar height or the titlebar font |
| 353 // size are increased. | 357 // size are increased. |
| 354 return GetSystemMetrics(SM_CYSMICON); | 358 return display::win::GetSystemMetricsInDIP(SM_CYSMICON); |
| 355 #else | 359 #else |
| 356 return std::max(BrowserFrame::GetTitleFontList().GetHeight(), | 360 return std::max(BrowserFrame::GetTitleFontList().GetHeight(), |
| 357 kIconMinimumSize); | 361 kIconMinimumSize); |
| 358 #endif | 362 #endif |
| 359 } | 363 } |
| 360 | 364 |
| 361 gfx::Size OpaqueBrowserFrameView::GetBrowserViewMinimumSize() const { | 365 gfx::Size OpaqueBrowserFrameView::GetBrowserViewMinimumSize() const { |
| 362 return browser_view()->GetMinimumSize(); | 366 return browser_view()->GetMinimumSize(); |
| 363 } | 367 } |
| 364 | 368 |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 808 gfx::Rect side(x, y, kClientEdgeThickness, h); | 812 gfx::Rect side(x, y, kClientEdgeThickness, h); |
| 809 canvas->FillRect(side, color); | 813 canvas->FillRect(side, color); |
| 810 if (draw_bottom) { | 814 if (draw_bottom) { |
| 811 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), | 815 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), |
| 812 kClientEdgeThickness), | 816 kClientEdgeThickness), |
| 813 color); | 817 color); |
| 814 } | 818 } |
| 815 side.Offset(w + kClientEdgeThickness, 0); | 819 side.Offset(w + kClientEdgeThickness, 0); |
| 816 canvas->FillRect(side, color); | 820 canvas->FillRect(side, color); |
| 817 } | 821 } |
| OLD | NEW |