blob: 212e0d4d1946f65e886d8821c667275ad4658f0c [file] [log] [blame]
[email protected]3c645372011-01-25 20:54:061// 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]3c645372011-01-25 20:54:067#import <Cocoa/Cocoa.h>
8
[email protected]ee6a5272013-07-15 21:14:019#include "base/command_line.h"
10#include "base/mac/mac_util.h"
[email protected]2f301672014-06-07 00:58:5211#include "base/mac/sdk_forward_declarations.h"
[email protected]ee6a5272013-07-15 21:14:0112#include "chrome/common/chrome_switches.h"
13
[email protected]3c645372011-01-25 20:54:0614bool IsFullScreenMode() {
[email protected]d621e702013-01-24 01:43:0015 // Check if the main display has been captured (by games in particular).
[email protected]3c645372011-01-25 20:54:0616 if (CGDisplayIsCaptured(CGMainDisplayID()))
17 return true;
18
[email protected]d621e702013-01-24 01:43:0019 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]3c645372011-01-25 20:54:0637}
[email protected]ee6a5272013-07-15 21:14:0138
39namespace chrome {
40namespace mac {
41
42bool SupportsSystemFullscreen() {
[email protected]ee6a5272013-07-15 21:14:0143 return base::mac::IsOSLionOrLater();
44}
45
46} // namespace mac
47} // namespace chrome