| 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/browser_desktop_window_tree_host_win.h" | 5 #include "chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
| 11 #include "base/win/windows_version.h" | 11 #include "base/win/windows_version.h" |
| 12 #include "chrome/browser/lifetime/application_lifetime.h" | 12 #include "chrome/browser/lifetime/application_lifetime.h" |
| 13 #include "chrome/browser/themes/theme_service.h" | 13 #include "chrome/browser/themes/theme_service.h" |
| 14 #include "chrome/browser/themes/theme_service_factory.h" | 14 #include "chrome/browser/themes/theme_service_factory.h" |
| 15 #include "chrome/browser/ui/views/frame/browser_frame.h" | 15 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 16 #include "chrome/browser/ui/views/frame/browser_frame_common_win.h" | 16 #include "chrome/browser/ui/views/frame/browser_frame_common_win.h" |
| 17 #include "chrome/browser/ui/views/frame/browser_view.h" | 17 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 18 #include "chrome/browser/ui/views/frame/browser_window_property_manager_win.h" | 18 #include "chrome/browser/ui/views/frame/browser_window_property_manager_win.h" |
| 19 #include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h" | 19 #include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h" |
| 20 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 20 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 21 #include "chrome/common/chrome_constants.h" | 21 #include "chrome/common/chrome_constants.h" |
| 22 #include "ui/base/theme_provider.h" | 22 #include "ui/base/theme_provider.h" |
| 23 #include "ui/gfx/win/dpi.h" | 23 #include "ui/gfx/screen_win.h" |
| 24 #include "ui/views/controls/menu/native_menu_win.h" | 24 #include "ui/views/controls/menu/native_menu_win.h" |
| 25 | 25 |
| 26 #pragma comment(lib, "dwmapi.lib") | 26 #pragma comment(lib, "dwmapi.lib") |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 const int kClientEdgeThickness = 3; | 30 const int kClientEdgeThickness = 3; |
| 31 | 31 |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 margins.cxLeftWidth = kClientEdgeThickness + 1; | 271 margins.cxLeftWidth = kClientEdgeThickness + 1; |
| 272 margins.cxRightWidth = kClientEdgeThickness + 1; | 272 margins.cxRightWidth = kClientEdgeThickness + 1; |
| 273 margins.cyBottomHeight = kClientEdgeThickness + 1; | 273 margins.cyBottomHeight = kClientEdgeThickness + 1; |
| 274 } | 274 } |
| 275 } | 275 } |
| 276 // In maximized mode, we only have a titlebar strip of glass, no side/bottom | 276 // In maximized mode, we only have a titlebar strip of glass, no side/bottom |
| 277 // borders. | 277 // borders. |
| 278 if (!browser_view_->IsFullscreen()) { | 278 if (!browser_view_->IsFullscreen()) { |
| 279 gfx::Rect tabstrip_bounds( | 279 gfx::Rect tabstrip_bounds( |
| 280 browser_frame_->GetBoundsForTabStrip(browser_view_->tabstrip())); | 280 browser_frame_->GetBoundsForTabStrip(browser_view_->tabstrip())); |
| 281 tabstrip_bounds = gfx::win::DIPToScreenRect(tabstrip_bounds); | 281 tabstrip_bounds = gfx::ScreenWin::DIPToClientRect(GetHWND(), |
| 282 tabstrip_bounds); |
| 282 margins.cyTopHeight = tabstrip_bounds.bottom(); | 283 margins.cyTopHeight = tabstrip_bounds.bottom(); |
| 283 | 284 |
| 284 // On pre-Win 10, we need to offset the DWM frame into the toolbar so that | 285 // On pre-Win 10, we need to offset the DWM frame into the toolbar so that |
| 285 // the blackness doesn't show up on our rounded toolbar corners. In Win | 286 // the blackness doesn't show up on our rounded toolbar corners. In Win |
| 286 // 10 and above there are no rounded corners, so this is unnecessary. | 287 // 10 and above there are no rounded corners, so this is unnecessary. |
| 287 const int kDWMFrameTopOffset = 3; | 288 const int kDWMFrameTopOffset = 3; |
| 288 if (base::win::GetVersion() < base::win::VERSION_WIN10) | 289 if (base::win::GetVersion() < base::win::VERSION_WIN10) |
| 289 margins.cyTopHeight += kDWMFrameTopOffset; | 290 margins.cyTopHeight += kDWMFrameTopOffset; |
| 290 } | 291 } |
| 291 } | 292 } |
| 292 return margins; | 293 return margins; |
| 293 } | 294 } |
| 294 | 295 |
| 295 //////////////////////////////////////////////////////////////////////////////// | 296 //////////////////////////////////////////////////////////////////////////////// |
| 296 // BrowserDesktopWindowTreeHost, public: | 297 // BrowserDesktopWindowTreeHost, public: |
| 297 | 298 |
| 298 // static | 299 // static |
| 299 BrowserDesktopWindowTreeHost* | 300 BrowserDesktopWindowTreeHost* |
| 300 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( | 301 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( |
| 301 views::internal::NativeWidgetDelegate* native_widget_delegate, | 302 views::internal::NativeWidgetDelegate* native_widget_delegate, |
| 302 views::DesktopNativeWidgetAura* desktop_native_widget_aura, | 303 views::DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 303 BrowserView* browser_view, | 304 BrowserView* browser_view, |
| 304 BrowserFrame* browser_frame) { | 305 BrowserFrame* browser_frame) { |
| 305 return new BrowserDesktopWindowTreeHostWin(native_widget_delegate, | 306 return new BrowserDesktopWindowTreeHostWin(native_widget_delegate, |
| 306 desktop_native_widget_aura, | 307 desktop_native_widget_aura, |
| 307 browser_view, | 308 browser_view, |
| 308 browser_frame); | 309 browser_frame); |
| 309 } | 310 } |
| OLD | NEW |