[email protected] | 3c64537 | 2011-01-25 20:54:06 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #import "chrome/browser/fullscreen.h" | ||||
6 | |||||
[email protected] | 3c64537 | 2011-01-25 20:54:06 | [diff] [blame] | 7 | #import <Cocoa/Cocoa.h> |
8 | |||||
[email protected] | ee6a527 | 2013-07-15 21:14:01 | [diff] [blame] | 9 | #include "base/command_line.h" |
10 | #include "base/mac/mac_util.h" | ||||
[email protected] | 2f30167 | 2014-06-07 00:58:52 | [diff] [blame] | 11 | #include "base/mac/sdk_forward_declarations.h" |
[email protected] | ee6a527 | 2013-07-15 21:14:01 | [diff] [blame] | 12 | #include "chrome/common/chrome_switches.h" |
13 | |||||
[email protected] | 3c64537 | 2011-01-25 20:54:06 | [diff] [blame] | 14 | bool IsFullScreenMode() { |
[email protected] | d621e70 | 2013-01-24 01:43:00 | [diff] [blame] | 15 | // Check if the main display has been captured (by games in particular). |
[email protected] | 3c64537 | 2011-01-25 20:54:06 | [diff] [blame] | 16 | if (CGDisplayIsCaptured(CGMainDisplayID())) |
17 | return true; | ||||
18 | |||||
[email protected] | d621e70 | 2013-01-24 01:43:00 | [diff] [blame] | 19 | NSApplicationPresentationOptions options = |
20 | [NSApp currentSystemPresentationOptions]; | ||||
21 | |||||
22 | bool dock_hidden = (options & NSApplicationPresentationHideDock) || | ||||
23 | (options & NSApplicationPresentationAutoHideDock); | ||||
24 | |||||
25 | bool menu_hidden = (options & NSApplicationPresentationHideMenuBar) || | ||||
26 | (options & NSApplicationPresentationAutoHideMenuBar); | ||||
27 | |||||
28 | // If both dock and menu bar are hidden, that is the equivalent of the Carbon | ||||
29 | // SystemUIMode (or Info.plist's LSUIPresentationMode) kUIModeAllHidden. | ||||
30 | if (dock_hidden && menu_hidden) | ||||
31 | return true; | ||||
32 | |||||
33 | if (options & NSApplicationPresentationFullScreen) | ||||
34 | return true; | ||||
35 | |||||
36 | return false; | ||||
[email protected] | 3c64537 | 2011-01-25 20:54:06 | [diff] [blame] | 37 | } |
[email protected] | ee6a527 | 2013-07-15 21:14:01 | [diff] [blame] | 38 | |
39 | namespace chrome { | ||||
40 | namespace mac { | ||||
41 | |||||
42 | bool SupportsSystemFullscreen() { | ||||
[email protected] | ee6a527 | 2013-07-15 21:14:01 | [diff] [blame] | 43 | return base::mac::IsOSLionOrLater(); |
44 | } | ||||
45 | |||||
46 | } // namespace mac | ||||
47 | } // namespace chrome |