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 "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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 gfx::Rect new_rect(saved_window_info_.window_rect); | 83 gfx::Rect new_rect(saved_window_info_.window_rect); |
84 SetWindowPos(hwnd_, NULL, new_rect.x(), new_rect.y(), new_rect.width(), | 84 SetWindowPos(hwnd_, NULL, new_rect.x(), new_rect.y(), new_rect.width(), |
85 new_rect.height(), | 85 new_rect.height(), |
86 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); | 86 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); |
87 } | 87 } |
88 | 88 |
89 if (!task_bar_list_) { | 89 if (!task_bar_list_) { |
90 HRESULT hr = ::CoCreateInstance(CLSID_TaskbarList, NULL, | 90 HRESULT hr = ::CoCreateInstance(CLSID_TaskbarList, NULL, |
91 CLSCTX_INPROC_SERVER, | 91 CLSCTX_INPROC_SERVER, |
92 IID_PPV_ARGS(&task_bar_list_)); | 92 IID_PPV_ARGS(&task_bar_list_)); |
93 CHECK(SUCCEEDED(hr)); | 93 if (SUCCEEDED(hr) && FAILED(task_bar_list_->HrInit())) |
94 task_bar_list_ = nullptr; | |
msw
2017/07/10 18:53:31
Maybe we should have a flag to avoid retrying crea
| |
94 } | 95 } |
95 | 96 |
96 // As per MSDN marking the window as fullscreen should ensure that the | 97 // 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 | 98 // taskbar is moved to the bottom of the Z-order when the fullscreen window |
98 // is activated. If the window is not fullscreen, the Shell falls back to | 99 // 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 // heuristics to determine how the window should be treated, which means |
100 // that it could still consider the window as fullscreen. :( | 101 // that it could still consider the window as fullscreen. :( |
101 task_bar_list_->MarkFullscreenWindow(hwnd_, !!fullscreen); | 102 if (task_bar_list_) |
103 task_bar_list_->MarkFullscreenWindow(hwnd_, !!fullscreen); | |
102 } | 104 } |
103 | 105 |
104 } // namespace views | 106 } // namespace views |
OLD | NEW |