Disabling NativeViewAcccessibilityWinTest.RetrieveAllAlerts.
[chromium-blink-merge.git] / chrome / browser / fullscreen_mac.mm
blob4dafe8e3db463251b7883de133371c9f9a1ddc99
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.
5 #import "chrome/browser/fullscreen.h"
7 #import <Cocoa/Cocoa.h>
9 #include "base/command_line.h"
10 #include "base/mac/mac_util.h"
11 #include "base/mac/sdk_forward_declarations.h"
12 #include "chrome/common/chrome_switches.h"
14 bool IsFullScreenMode() {
15   // Check if the main display has been captured (by games in particular).
16   if (CGDisplayIsCaptured(CGMainDisplayID()))
17     return true;
19   NSApplicationPresentationOptions options =
20       [NSApp currentSystemPresentationOptions];
22   bool dock_hidden = (options & NSApplicationPresentationHideDock) ||
23                      (options & NSApplicationPresentationAutoHideDock);
25   bool menu_hidden = (options & NSApplicationPresentationHideMenuBar) ||
26                      (options & NSApplicationPresentationAutoHideMenuBar);
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;
33   if (options & NSApplicationPresentationFullScreen)
34     return true;
36   return false;
39 namespace chrome {
40 namespace mac {
42 bool SupportsSystemFullscreen() {
43   const base::CommandLine* command_line =
44       base::CommandLine::ForCurrentProcess();
45   if (command_line->HasSwitch(switches::kDisableSystemFullscreenForTesting))
46     return false;
48   return base::mac::IsOSLionOrLater();
51 }  // namespace mac
52 }  // namespace chrome