| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/fullscreen.h" | 5 #include "chrome/browser/fullscreen.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "chrome/browser/ui/host_desktop.h" | 10 #include "chrome/browser/ui/host_desktop.h" |
| 11 #include "ui/gfx/host_desktop_type.h" |
| 11 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 12 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" | 13 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
| 13 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
| 14 | 15 |
| 15 bool IsFullScreenMode() { | 16 bool IsFullScreenMode() { |
| 16 #if defined(USE_ASH) | 17 #if defined(USE_ASH) |
| 17 if (chrome::GetActiveDesktop() == ui::HOST_DESKTOP_TYPE_ASH) { | 18 if (chrome::GetActiveDesktop() == ui::HOST_DESKTOP_TYPE_ASH) { |
| 18 ash::RootWindowController* controller = | 19 ash::RootWindowController* controller = |
| 19 ash::RootWindowController::ForTargetRootWindow(); | 20 ash::RootWindowController::ForTargetRootWindow(); |
| 20 return controller && controller->GetWindowForFullscreenMode(); | 21 return controller && controller->GetWindowForFullscreenMode(); |
| 21 } | 22 } |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 std::vector<aura::Window*> all_windows = | 25 std::vector<aura::Window*> all_windows = |
| 25 views::DesktopWindowTreeHostX11::GetAllOpenWindows(); | 26 views::DesktopWindowTreeHostX11::GetAllOpenWindows(); |
| 26 // Only the topmost window is checked. This works fine in the most cases, but | 27 // Only the topmost window is checked. This works fine in the most cases, but |
| 27 // it may return false when there are multiple displays and one display has | 28 // it may return false when there are multiple displays and one display has |
| 28 // a fullscreen window but others don't. See: crbug.com/345484 | 29 // a fullscreen window but others don't. See: crbug.com/345484 |
| 29 if (all_windows.empty()) | 30 if (all_windows.empty()) |
| 30 return false; | 31 return false; |
| 31 | 32 |
| 32 views::Widget* widget = | 33 views::Widget* widget = |
| 33 views::Widget::GetWidgetForNativeWindow(all_windows[0]); | 34 views::Widget::GetWidgetForNativeWindow(all_windows[0]); |
| 34 return widget && widget->IsFullscreen(); | 35 return widget && widget->IsFullscreen(); |
| 35 } | 36 } |
| OLD | NEW |