Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: base/mac/mac_util.mm

Issue 11947002: Switch back to deprecated fullscreen APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/fullscreen_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/mac/mac_util.h" 5 #include "base/mac/mac_util.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #import <IOKit/IOKitLib.h> 8 #import <IOKit/IOKitLib.h>
9 9
10 #include <errno.h> 10 #include <errno.h>
(...skipping 13 matching lines...) Expand all
24 #include "base/string_piece.h" 24 #include "base/string_piece.h"
25 #include "base/sys_string_conversions.h" 25 #include "base/sys_string_conversions.h"
26 26
27 namespace base { 27 namespace base {
28 namespace mac { 28 namespace mac {
29 29
30 namespace { 30 namespace {
31 31
32 // The current count of outstanding requests for full screen mode from browser 32 // The current count of outstanding requests for full screen mode from browser
33 // windows, plugins, etc. 33 // windows, plugins, etc.
34 int g_full_screen_requests[kNumFullScreenModes] = { 0 }; 34 int g_full_screen_requests[kNumFullScreenModes] = { 0, 0, 0};
35 35
36 // Sets the appropriate application presentation option based on the current 36 // Sets the appropriate SystemUIMode based on the current full screen requests.
37 // full screen requests. Since only one presentation option can be active at a 37 // Since only one SystemUIMode can be active at a given time, full screen
38 // given time, full screen requests are ordered by priority. If there are no 38 // requests are ordered by priority. If there are no outstanding full screen
39 // outstanding full screen requests, reverts to normal mode. If the correct 39 // requests, reverts to normal mode. If the correct SystemUIMode is already
40 // presentation option is already set, does nothing. 40 // set, does nothing.
41 void SetUIMode() { 41 void SetUIMode() {
42 NSApplicationPresentationOptions current_options = 42 // Get the current UI mode.
43 [NSApp presentationOptions]; 43 SystemUIMode current_mode;
44 GetSystemUIMode(&current_mode, NULL);
44 45
45 // Determine which mode should be active, based on which requests are 46 // Determine which mode should be active, based on which requests are
46 // currently outstanding. More permissive requests take precedence. For 47 // currently outstanding. More permissive requests take precedence. For
47 // example, plugins request |kFullScreenModeAutoHideAll|, while browser 48 // example, plugins request |kFullScreenModeAutoHideAll|, while browser
48 // windows request |kFullScreenModeHideDock| when the fullscreen overlay is 49 // windows request |kFullScreenModeHideDock| when the fullscreen overlay is
49 // down. Precedence goes to plugins in this case, so AutoHideAll wins over 50 // down. Precedence goes to plugins in this case, so AutoHideAll wins over
50 // HideDock. 51 // HideDock.
51 NSApplicationPresentationOptions desired_options = 52 SystemUIMode desired_mode = kUIModeNormal;
52 NSApplicationPresentationDefault; 53 SystemUIOptions desired_options = 0;
53 if (g_full_screen_requests[kFullScreenModeAutoHideAll] > 0) { 54 if (g_full_screen_requests[kFullScreenModeAutoHideAll] > 0) {
54 desired_options = NSApplicationPresentationHideDock | 55 desired_mode = kUIModeAllHidden;
55 NSApplicationPresentationAutoHideMenuBar; 56 desired_options = kUIOptionAutoShowMenuBar;
56 } else if (g_full_screen_requests[kFullScreenModeHideDock] > 0) { 57 } else if (g_full_screen_requests[kFullScreenModeHideDock] > 0) {
57 desired_options = NSApplicationPresentationHideDock; 58 desired_mode = kUIModeContentHidden;
58 } else if (g_full_screen_requests[kFullScreenModeHideAll] > 0) { 59 } else if (g_full_screen_requests[kFullScreenModeHideAll] > 0) {
59 desired_options = NSApplicationPresentationHideDock | 60 desired_mode = kUIModeAllHidden;
60 NSApplicationPresentationHideMenuBar;
61 } 61 }
62 62
63 if (current_options != desired_options) 63 if (current_mode != desired_mode)
64 [NSApp setPresentationOptions:desired_options]; 64 SetSystemUIMode(desired_mode, desired_options);
65 } 65 }
66 66
67 // Looks into Shared File Lists corresponding to Login Items for the item 67 // Looks into Shared File Lists corresponding to Login Items for the item
68 // representing the current application. If such an item is found, returns a 68 // representing the current application. If such an item is found, returns a
69 // retained reference to it. Caller is responsible for releasing the reference. 69 // retained reference to it. Caller is responsible for releasing the reference.
70 LSSharedFileListItemRef GetLoginItemForApp() { 70 LSSharedFileListItemRef GetLoginItemForApp() {
71 ScopedCFTypeRef<LSSharedFileListRef> login_items(LSSharedFileListCreate( 71 ScopedCFTypeRef<LSSharedFileListRef> login_items(LSSharedFileListCreate(
72 NULL, kLSSharedFileListSessionLoginItems, NULL)); 72 NULL, kLSSharedFileListSessionLoginItems, NULL));
73 73
74 if (!login_items.get()) { 74 if (!login_items.get()) {
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) 666 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp))
667 return false; 667 return false;
668 *type = ident.substr(0, number_loc); 668 *type = ident.substr(0, number_loc);
669 *major = major_tmp; 669 *major = major_tmp;
670 *minor = minor_tmp; 670 *minor = minor_tmp;
671 return true; 671 return true;
672 } 672 }
673 673
674 } // namespace mac 674 } // namespace mac
675 } // namespace base 675 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/fullscreen_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698