Chromium Code Reviews| Index: base/mac/mac_util.mm |
| diff --git a/base/mac/mac_util.mm b/base/mac/mac_util.mm |
| index 8870dc0ac23f4b4816ddd7bc9dea3dbb07e70f4c..a0fee532435058b4e64ff52b061bd2a3870d7d3e 100644 |
| --- a/base/mac/mac_util.mm |
| +++ b/base/mac/mac_util.mm |
| @@ -31,17 +31,16 @@ namespace { |
| // The current count of outstanding requests for full screen mode from browser |
| // windows, plugins, etc. |
| -int g_full_screen_requests[kNumFullScreenModes] = { 0, 0, 0}; |
| +int g_full_screen_requests[kNumFullScreenModes] = { 0 }; |
| -// Sets the appropriate SystemUIMode based on the current full screen requests. |
| -// Since only one SystemUIMode can be active at a given time, full screen |
| -// requests are ordered by priority. If there are no outstanding full screen |
| -// requests, reverts to normal mode. If the correct SystemUIMode is already |
| -// set, does nothing. |
| +// Sets the appropriate application presentation option based on the current |
| +// full screen requests. Since only one presentation option can be active at a |
| +// given time, full screen requests are ordered by priority. If there are no |
| +// outstanding full screen requests, reverts to normal mode. If the correct |
| +// presentation option is already set, does nothing. |
| void SetUIMode() { |
| - // Get the current UI mode. |
| - SystemUIMode current_mode; |
| - GetSystemUIMode(¤t_mode, NULL); |
| + NSApplicationPresentationOptions current_options = |
| + [NSApp presentationOptions]; |
| // Determine which mode should be active, based on which requests are |
| // currently outstanding. More permissive requests take precedence. For |
| @@ -49,19 +48,20 @@ void SetUIMode() { |
| // windows request |kFullScreenModeHideDock| when the fullscreen overlay is |
| // down. Precedence goes to plugins in this case, so AutoHideAll wins over |
| // HideDock. |
| - SystemUIMode desired_mode = kUIModeNormal; |
| - SystemUIOptions desired_options = 0; |
| + NSApplicationPresentationOptions desired_options = |
| + NSApplicationPresentationDefault; |
| if (g_full_screen_requests[kFullScreenModeAutoHideAll] > 0) { |
| - desired_mode = kUIModeAllHidden; |
| - desired_options = kUIOptionAutoShowMenuBar; |
| + desired_options = NSApplicationPresentationHideDock | |
|
Nico
2013/01/23 21:35:21
Should this be AutoHideDock? From what I understan
Avi (use Gerrit)
2013/01/23 21:48:21
Incorrect; it was completely possible with the old
|
| + NSApplicationPresentationAutoHideMenuBar; |
| } else if (g_full_screen_requests[kFullScreenModeHideDock] > 0) { |
| - desired_mode = kUIModeContentHidden; |
| + desired_options = NSApplicationPresentationHideDock; |
| } else if (g_full_screen_requests[kFullScreenModeHideAll] > 0) { |
| - desired_mode = kUIModeAllHidden; |
| + desired_options = NSApplicationPresentationHideDock | |
| + NSApplicationPresentationHideMenuBar; |
| } |
| - if (current_mode != desired_mode) |
| - SetSystemUIMode(desired_mode, desired_options); |
| + if (current_options != desired_options) |
| + [NSApp setPresentationOptions:desired_options]; |
| } |
| // Looks into Shared File Lists corresponding to Login Items for the item |