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/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
| 10 #include "base/win/windows_version.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 11 #include "chrome/browser/lifetime/application_lifetime.h" |
11 #include "chrome/browser/themes/theme_service.h" | 12 #include "chrome/browser/themes/theme_service.h" |
12 #include "chrome/browser/themes/theme_service_factory.h" | 13 #include "chrome/browser/themes/theme_service_factory.h" |
13 #include "chrome/browser/ui/views/frame/browser_frame.h" | 14 #include "chrome/browser/ui/views/frame/browser_frame.h" |
14 #include "chrome/browser/ui/views/frame/browser_frame_common_win.h" | 15 #include "chrome/browser/ui/views/frame/browser_frame_common_win.h" |
15 #include "chrome/browser/ui/views/frame/browser_view.h" | 16 #include "chrome/browser/ui/views/frame/browser_view.h" |
16 #include "chrome/browser/ui/views/frame/browser_window_property_manager_win.h" | 17 #include "chrome/browser/ui/views/frame/browser_window_property_manager_win.h" |
17 #include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h" | 18 #include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h" |
18 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 19 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
19 #include "chrome/browser/ui/views/theme_image_mapper.h" | 20 #include "chrome/browser/ui/views/theme_image_mapper.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 MARGINS BrowserDesktopWindowTreeHostWin::GetDWMFrameMargins() const { | 324 MARGINS BrowserDesktopWindowTreeHostWin::GetDWMFrameMargins() const { |
324 MARGINS margins = { 0 }; | 325 MARGINS margins = { 0 }; |
325 | 326 |
326 // If the opaque frame is visible, we use the default (zero) margins. | 327 // If the opaque frame is visible, we use the default (zero) margins. |
327 // Otherwise, we need to figure out how to extend the glass in. | 328 // Otherwise, we need to figure out how to extend the glass in. |
328 if (GetWidget()->ShouldUseNativeFrame()) { | 329 if (GetWidget()->ShouldUseNativeFrame()) { |
329 // In fullscreen mode, we don't extend glass into the client area at all, | 330 // In fullscreen mode, we don't extend glass into the client area at all, |
330 // because the GDI-drawn text in the web content composited over it will | 331 // because the GDI-drawn text in the web content composited over it will |
331 // become semi-transparent over any glass area. | 332 // become semi-transparent over any glass area. |
332 if (!IsMaximized() && !GetWidget()->IsFullscreen()) { | 333 if (!IsMaximized() && !GetWidget()->IsFullscreen()) { |
333 margins.cxLeftWidth = kClientEdgeThickness + 1; | |
334 margins.cxRightWidth = kClientEdgeThickness + 1; | |
335 margins.cyBottomHeight = kClientEdgeThickness + 1; | |
336 margins.cyTopHeight = kClientEdgeThickness + 1; | 334 margins.cyTopHeight = kClientEdgeThickness + 1; |
| 335 // On Windows 10, we don't draw our own window border, so don't extend the |
| 336 // nonclient area in for it. The top is extended so that the MARGINS isn't |
| 337 // treated as an empty (ignored) extension. |
| 338 if (base::win::GetVersion() >= base::win::VERSION_WIN10) { |
| 339 margins.cxLeftWidth = 0; |
| 340 margins.cxRightWidth = 0; |
| 341 margins.cyBottomHeight = 0; |
| 342 } else { |
| 343 margins.cxLeftWidth = kClientEdgeThickness + 1; |
| 344 margins.cxRightWidth = kClientEdgeThickness + 1; |
| 345 margins.cyBottomHeight = kClientEdgeThickness + 1; |
| 346 } |
337 } | 347 } |
338 // In maximized mode, we only have a titlebar strip of glass, no side/bottom | 348 // In maximized mode, we only have a titlebar strip of glass, no side/bottom |
339 // borders. | 349 // borders. |
340 if (!browser_view_->IsFullscreen()) { | 350 if (!browser_view_->IsFullscreen()) { |
341 gfx::Rect tabstrip_bounds( | 351 gfx::Rect tabstrip_bounds( |
342 browser_frame_->GetBoundsForTabStrip(browser_view_->tabstrip())); | 352 browser_frame_->GetBoundsForTabStrip(browser_view_->tabstrip())); |
343 tabstrip_bounds = gfx::win::DIPToScreenRect(tabstrip_bounds); | 353 tabstrip_bounds = gfx::win::DIPToScreenRect(tabstrip_bounds); |
344 margins.cyTopHeight = tabstrip_bounds.bottom() + kDWMFrameTopOffset; | 354 margins.cyTopHeight = tabstrip_bounds.bottom() + kDWMFrameTopOffset; |
345 } | 355 } |
346 } | 356 } |
347 return margins; | 357 return margins; |
348 } | 358 } |
349 | 359 |
350 //////////////////////////////////////////////////////////////////////////////// | 360 //////////////////////////////////////////////////////////////////////////////// |
351 // BrowserDesktopWindowTreeHost, public: | 361 // BrowserDesktopWindowTreeHost, public: |
352 | 362 |
353 // static | 363 // static |
354 BrowserDesktopWindowTreeHost* | 364 BrowserDesktopWindowTreeHost* |
355 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( | 365 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( |
356 views::internal::NativeWidgetDelegate* native_widget_delegate, | 366 views::internal::NativeWidgetDelegate* native_widget_delegate, |
357 views::DesktopNativeWidgetAura* desktop_native_widget_aura, | 367 views::DesktopNativeWidgetAura* desktop_native_widget_aura, |
358 BrowserView* browser_view, | 368 BrowserView* browser_view, |
359 BrowserFrame* browser_frame) { | 369 BrowserFrame* browser_frame) { |
360 return new BrowserDesktopWindowTreeHostWin(native_widget_delegate, | 370 return new BrowserDesktopWindowTreeHostWin(native_widget_delegate, |
361 desktop_native_widget_aura, | 371 desktop_native_widget_aura, |
362 browser_view, | 372 browser_view, |
363 browser_frame); | 373 browser_frame); |
364 } | 374 } |
OLD | NEW |