| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/win/windows_version.h" | 11 #include "base/win/windows_version.h" |
| 12 | 12 |
| 13 #if defined(USE_ASH) | 13 #if defined(USE_ASH) |
| 14 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 15 #include "chrome/browser/ui/host_desktop.h" | 15 #include "chrome/browser/ui/host_desktop.h" |
| 16 #include "ui/aura/window.h" |
| 16 #endif | 17 #endif |
| 17 | 18 |
| 18 static bool IsPlatformFullScreenMode() { | 19 static bool IsPlatformFullScreenMode() { |
| 19 // SHQueryUserNotificationState is only available for Vista and above. | 20 // SHQueryUserNotificationState is only available for Vista and above. |
| 20 #if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_VISTA) | 21 #if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_VISTA) |
| 21 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 22 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
| 22 return false; | 23 return false; |
| 23 | 24 |
| 24 typedef HRESULT(WINAPI *SHQueryUserNotificationStatePtr)( | 25 typedef HRESULT(WINAPI *SHQueryUserNotificationStatePtr)( |
| 25 QUERY_USER_NOTIFICATION_STATE* state); | 26 QUERY_USER_NOTIFICATION_STATE* state); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 if (!::AttachConsole(pid)) | 94 if (!::AttachConsole(pid)) |
| 94 return false; | 95 return false; |
| 95 | 96 |
| 96 DWORD modes = 0; | 97 DWORD modes = 0; |
| 97 ::GetConsoleDisplayMode(&modes); | 98 ::GetConsoleDisplayMode(&modes); |
| 98 ::FreeConsole(); | 99 ::FreeConsole(); |
| 99 | 100 |
| 100 return (modes & (CONSOLE_FULLSCREEN | CONSOLE_FULLSCREEN_HARDWARE)) != 0; | 101 return (modes & (CONSOLE_FULLSCREEN | CONSOLE_FULLSCREEN_HARDWARE)) != 0; |
| 101 } | 102 } |
| 102 | 103 |
| 104 #if defined(USE_ASH) |
| 105 // Returns true if the active window or one its ancestors is fullscreen. |
| 106 static bool IsActiveWindowFullscreen() { |
| 107 aura::Window* window = ash::wm::GetActiveWindow(); |
| 108 while (window) { |
| 109 if (ash::wm::IsWindowFullscreen(window)) |
| 110 return true; |
| 111 window = window->parent(); |
| 112 } |
| 113 return false; |
| 114 } |
| 115 #endif |
| 116 |
| 103 bool IsFullScreenMode() { | 117 bool IsFullScreenMode() { |
| 104 #if defined(USE_ASH) | 118 #if defined(USE_ASH) |
| 105 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) | 119 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 106 return ash::wm::IsActiveWindowFullscreen(); | 120 return IsActiveWindowFullscreen(); |
| 107 #endif | 121 #endif |
| 108 return IsPlatformFullScreenMode() || | 122 return IsPlatformFullScreenMode() || |
| 109 IsFullScreenWindowMode() || | 123 IsFullScreenWindowMode() || |
| 110 IsFullScreenConsoleMode(); | 124 IsFullScreenConsoleMode(); |
| 111 } | 125 } |
| OLD | NEW |