[email protected] | fe00717 | 2014-02-26 00:44:42 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/fullscreen.h" |
| 6 | |
| 7 | #include <vector> |
| 8 | |
| 9 | #include "ui/gfx/native_widget_types.h" |
Maksim Sisov | 46356f3 | 2019-10-20 20:23:39 | [diff] [blame] | 10 | #include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h" |
[email protected] | fe00717 | 2014-02-26 00:44:42 | [diff] [blame] | 11 | #include "ui/views/widget/widget.h" |
| 12 | |
Evan Stade | 714657b | 2017-11-01 21:50:46 | [diff] [blame] | 13 | bool IsFullScreenMode() { |
[email protected] | fe00717 | 2014-02-26 00:44:42 | [diff] [blame] | 14 | std::vector<aura::Window*> all_windows = |
Maksim Sisov | 46356f3 | 2019-10-20 20:23:39 | [diff] [blame] | 15 | views::DesktopWindowTreeHostLinux::GetAllOpenWindows(); |
[email protected] | fe00717 | 2014-02-26 00:44:42 | [diff] [blame] | 16 | // Only the topmost window is checked. This works fine in the most cases, but |
| 17 | // it may return false when there are multiple displays and one display has |
| 18 | // a fullscreen window but others don't. See: crbug.com/345484 |
| 19 | if (all_windows.empty()) |
| 20 | return false; |
| 21 | |
| 22 | views::Widget* widget = |
| 23 | views::Widget::GetWidgetForNativeWindow(all_windows[0]); |
| 24 | return widget && widget->IsFullscreen(); |
[email protected] | fe00717 | 2014-02-26 00:44:42 | [diff] [blame] | 25 | } |