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/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" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 GetClientRect(hwnd, &client_rect); | 192 GetClientRect(hwnd, &client_rect); |
| 193 HBRUSH brush = CreateSolidBrush(0); | 193 HBRUSH brush = CreateSolidBrush(0); |
| 194 RECT rect = {0, 0, client_rect.right, margins.cyTopHeight}; | 194 RECT rect = {0, 0, client_rect.right, margins.cyTopHeight}; |
| 195 FillRect(dc, &rect, brush); | 195 FillRect(dc, &rect, brush); |
| 196 DeleteObject(brush); | 196 DeleteObject(brush); |
| 197 ReleaseDC(hwnd, dc); | 197 ReleaseDC(hwnd, dc); |
| 198 did_gdi_clear_ = true; | 198 did_gdi_clear_ = true; |
| 199 } | 199 } |
| 200 break; | 200 break; |
| 201 } | 201 } |
| 202 case WM_DWMCOLORIZATIONCOLORCHANGED: | |
| 203 // Activation border may have changed color. | |
| 204 if (GetWidget()->non_client_view()) | |
|
Peter Kasting
2016/10/01 05:00:14
Nit: Consider a temp (maybe with auto*) to avoid d
| |
| 205 GetWidget()->non_client_view()->SchedulePaint(); | |
| 206 break; | |
| 202 } | 207 } |
| 203 } | 208 } |
| 204 | 209 |
| 205 views::FrameMode BrowserDesktopWindowTreeHostWin::GetFrameMode() const { | 210 views::FrameMode BrowserDesktopWindowTreeHostWin::GetFrameMode() const { |
| 206 const views::FrameMode system_frame_mode = | 211 const views::FrameMode system_frame_mode = |
| 207 browser_frame_->CustomDrawSystemTitlebar() | 212 browser_frame_->CustomDrawSystemTitlebar() |
| 208 ? views::FrameMode::SYSTEM_DRAWN_NO_CONTROLS | 213 ? views::FrameMode::SYSTEM_DRAWN_NO_CONTROLS |
| 209 : views::FrameMode::SYSTEM_DRAWN; | 214 : views::FrameMode::SYSTEM_DRAWN; |
| 210 | 215 |
| 211 // We don't theme popup or app windows, so regardless of whether or not a | 216 // We don't theme popup or app windows, so regardless of whether or not a |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 // With a custom titlebar we want the margins to always be 2 pixels, because | 258 // With a custom titlebar we want the margins to always be 2 pixels, because |
| 254 // that gives us the 1 pixel accent color border around the window (a 1 pixel | 259 // that gives us the 1 pixel accent color border around the window (a 1 pixel |
| 255 // margin is not sufficient, it will draw a messed-up-looking border instead). | 260 // margin is not sufficient, it will draw a messed-up-looking border instead). |
| 256 // The other pixel ends up being 1-pixel-thick native titlebar (including | 261 // The other pixel ends up being 1-pixel-thick native titlebar (including |
| 257 // caption buttons) but since we draw over that pixel in | 262 // caption buttons) but since we draw over that pixel in |
| 258 // GlassBrowserFrameView::PaintTitlebar() it will be invisible and won't get | 263 // GlassBrowserFrameView::PaintTitlebar() it will be invisible and won't get |
| 259 // mouse events. | 264 // mouse events. |
| 260 if (browser_frame_->CustomDrawSystemTitlebar() && ShouldUseNativeFrame() && | 265 if (browser_frame_->CustomDrawSystemTitlebar() && ShouldUseNativeFrame() && |
| 261 !GetWidget()->IsFullscreen()) { | 266 !GetWidget()->IsFullscreen()) { |
| 262 MARGINS margins = {2, 2, 2, 2}; | 267 MARGINS margins = {2, 2, 2, 2}; |
| 263 DwmExtendFrameIntoClientArea(GetHWND(), &margins); | 268 DwmExtendFrameIntoClientArea(GetHWND(), &margins); |
|
Bret
2016/10/01 19:53:08
If the client area is fully opaque then this block
| |
| 264 return; | 269 return; |
| 265 } | 270 } |
| 266 | 271 |
| 267 // For "normal" windows on Aero, we always need to reset the glass area | 272 // For "normal" windows on Aero, we always need to reset the glass area |
| 268 // correctly, even if we're not currently showing the native frame (e.g. | 273 // correctly, even if we're not currently showing the native frame (e.g. |
| 269 // because a theme is showing), so we explicitly check for that case rather | 274 // because a theme is showing), so we explicitly check for that case rather |
| 270 // than checking browser_frame_->ShouldUseNativeFrame() here. Using that here | 275 // than checking browser_frame_->ShouldUseNativeFrame() here. Using that here |
| 271 // would mean we wouldn't reset the glass area to zero when moving from the | 276 // would mean we wouldn't reset the glass area to zero when moving from the |
| 272 // native frame to an opaque frame, leading to graphical glitches behind the | 277 // native frame to an opaque frame, leading to graphical glitches behind the |
| 273 // opaque frame. Instead, we use that function below to tell us whether the | 278 // opaque frame. Instead, we use that function below to tell us whether the |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( | 343 BrowserDesktopWindowTreeHost::CreateBrowserDesktopWindowTreeHost( |
| 339 views::internal::NativeWidgetDelegate* native_widget_delegate, | 344 views::internal::NativeWidgetDelegate* native_widget_delegate, |
| 340 views::DesktopNativeWidgetAura* desktop_native_widget_aura, | 345 views::DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 341 BrowserView* browser_view, | 346 BrowserView* browser_view, |
| 342 BrowserFrame* browser_frame) { | 347 BrowserFrame* browser_frame) { |
| 343 return new BrowserDesktopWindowTreeHostWin(native_widget_delegate, | 348 return new BrowserDesktopWindowTreeHostWin(native_widget_delegate, |
| 344 desktop_native_widget_aura, | 349 desktop_native_widget_aura, |
| 345 browser_view, | 350 browser_view, |
| 346 browser_frame); | 351 browser_frame); |
| 347 } | 352 } |
| OLD | NEW |