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

Side by Side Diff: ui/views/win/fullscreen_handler.cc

Issue 2972963004: Another attempt at fixing the fullscreen issues with Chrome. (Closed)
Patch Set: Address review comments Created 3 years, 5 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 | « ui/views/win/fullscreen_handler.h ('k') | 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 "ui/views/win/fullscreen_handler.h" 5 #include "ui/views/win/fullscreen_handler.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/win/win_util.h" 10 #include "base/win/win_util.h"
(...skipping 21 matching lines...) Expand all
32 gfx::Rect FullscreenHandler::GetRestoreBounds() const { 32 gfx::Rect FullscreenHandler::GetRestoreBounds() const {
33 return gfx::Rect(saved_window_info_.window_rect); 33 return gfx::Rect(saved_window_info_.window_rect);
34 } 34 }
35 35
36 //////////////////////////////////////////////////////////////////////////////// 36 ////////////////////////////////////////////////////////////////////////////////
37 // FullscreenHandler, private: 37 // FullscreenHandler, private:
38 38
39 void FullscreenHandler::SetFullscreenImpl(bool fullscreen) { 39 void FullscreenHandler::SetFullscreenImpl(bool fullscreen) {
40 std::unique_ptr<ScopedFullscreenVisibility> visibility; 40 std::unique_ptr<ScopedFullscreenVisibility> visibility;
41 41
42 if (!task_bar_list_) {
msw 2017/07/06 19:33:52 optional nit: move this down to just above the tas
ananta 2017/07/06 20:03:17 Done.
43 HRESULT hr = ::CoCreateInstance(CLSID_TaskbarList, NULL,
44 CLSCTX_INPROC_SERVER,
45 IID_PPV_ARGS(&task_bar_list_));
46 CHECK(SUCCEEDED(hr));
47 }
48
42 // With Aero enabled disabling the visibility causes the window to disappear 49 // With Aero enabled disabling the visibility causes the window to disappear
43 // for several frames, which looks worse than doing other updates 50 // for several frames, which looks worse than doing other updates
44 // non-atomically. 51 // non-atomically.
45 if (!ui::win::IsAeroGlassEnabled()) 52 if (!ui::win::IsAeroGlassEnabled())
46 visibility.reset(new ScopedFullscreenVisibility(hwnd_)); 53 visibility.reset(new ScopedFullscreenVisibility(hwnd_));
47 54
48 // Save current window state if not already fullscreen. 55 // Save current window state if not already fullscreen.
49 if (!fullscreen_) { 56 if (!fullscreen_) {
50 saved_window_info_.style = GetWindowLong(hwnd_, GWL_STYLE); 57 saved_window_info_.style = GetWindowLong(hwnd_, GWL_STYLE);
51 saved_window_info_.ex_style = GetWindowLong(hwnd_, GWL_EXSTYLE); 58 saved_window_info_.ex_style = GetWindowLong(hwnd_, GWL_EXSTYLE);
(...skipping 26 matching lines...) Expand all
78 // repainted. Better-looking methods welcome. 85 // repainted. Better-looking methods welcome.
79 SetWindowLong(hwnd_, GWL_STYLE, saved_window_info_.style); 86 SetWindowLong(hwnd_, GWL_STYLE, saved_window_info_.style);
80 SetWindowLong(hwnd_, GWL_EXSTYLE, saved_window_info_.ex_style); 87 SetWindowLong(hwnd_, GWL_EXSTYLE, saved_window_info_.ex_style);
81 88
82 // On restore, resize to the previous saved rect size. 89 // On restore, resize to the previous saved rect size.
83 gfx::Rect new_rect(saved_window_info_.window_rect); 90 gfx::Rect new_rect(saved_window_info_.window_rect);
84 SetWindowPos(hwnd_, NULL, new_rect.x(), new_rect.y(), new_rect.width(), 91 SetWindowPos(hwnd_, NULL, new_rect.x(), new_rect.y(), new_rect.width(),
85 new_rect.height(), 92 new_rect.height(),
86 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); 93 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
87 } 94 }
95
96 // As per MSDN marking the window as fullscreen should ensure that the
97 // taskbar is moved to the bottom of the Z- order when the fullscreen window
msw 2017/07/06 19:33:52 nit: no space after hyphen ('Z-order')
ananta 2017/07/06 20:03:17 Thanks done.
98 // is activated. If the window is not fullscreen, the Shell falls back to
99 // heuristics to determine how the window should be treated, which means
100 // that it could still consider the window as fullscreen. :(
101 task_bar_list_->MarkFullscreenWindow(hwnd_, !!fullscreen);
88 } 102 }
89 103
90 } // namespace views 104 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/win/fullscreen_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698