| OLD | NEW |
| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/mac/mac_util.h" | 6 #include "base/mac/mac_util.h" |
| 7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/fullscreen.h" |
| 10 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 12 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" | 13 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" |
| 13 #include "chrome/browser/ui/panels/display_settings_provider.h" | 14 #include "chrome/browser/ui/panels/display_settings_provider.h" |
| 14 #import "chrome/browser/app_controller_mac.h" | 15 #import "chrome/browser/app_controller_mac.h" |
| 15 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 17 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 18 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
| 19 #include "ui/base/work_area_watcher_observer.h" | 20 #include "ui/base/work_area_watcher_observer.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 removeObserver:active_space_change_]; | 87 removeObserver:active_space_change_]; |
| 87 } | 88 } |
| 88 | 89 |
| 89 bool DisplaySettingsProviderCocoa::NeedsPeriodicFullScreenCheck() const { | 90 bool DisplaySettingsProviderCocoa::NeedsPeriodicFullScreenCheck() const { |
| 90 // Lion system introduces fullscreen support. When a window of an application | 91 // Lion system introduces fullscreen support. When a window of an application |
| 91 // enters fullscreen mode, the system will automatically hide all other | 92 // enters fullscreen mode, the system will automatically hide all other |
| 92 // windows, even including topmost windows that come from other applications. | 93 // windows, even including topmost windows that come from other applications. |
| 93 // So we don't need to do anything when any other application enters | 94 // So we don't need to do anything when any other application enters |
| 94 // fullscreen mode. We still need to handle the case when chrome enters | 95 // fullscreen mode. We still need to handle the case when chrome enters |
| 95 // fullscreen mode and our topmost windows will not get hided by the system. | 96 // fullscreen mode and our topmost windows will not get hided by the system. |
| 96 return !base::mac::IsOSLionOrLater(); | 97 return !chrome::mac::SupportsSystemFullscreen(); |
| 97 } | 98 } |
| 98 | 99 |
| 99 bool DisplaySettingsProviderCocoa::IsFullScreen() { | 100 bool DisplaySettingsProviderCocoa::IsFullScreen() { |
| 100 // For Lion and later, we only need to check if chrome enters fullscreen mode | 101 // For Lion and later, we only need to check if chrome enters fullscreen mode |
| 101 // (see detailed reason above in NeedsPeriodicFullScreenCheck). | 102 // (see detailed reason above in NeedsPeriodicFullScreenCheck). |
| 102 if (!base::mac::IsOSLionOrLater()) | 103 if (!chrome::mac::SupportsSystemFullscreen()) |
| 103 return DisplaySettingsProvider::IsFullScreen(); | 104 return DisplaySettingsProvider::IsFullScreen(); |
| 104 | 105 |
| 105 Browser* browser = chrome::GetLastActiveBrowser(); | 106 Browser* browser = chrome::GetLastActiveBrowser(); |
| 106 if (!browser) | 107 if (!browser) |
| 107 return false; | 108 return false; |
| 108 BrowserWindow* browser_window = browser->window(); | 109 BrowserWindow* browser_window = browser->window(); |
| 109 if (!browser_window->IsFullscreen()) | 110 if (!browser_window->IsFullscreen()) |
| 110 return false; | 111 return false; |
| 111 | 112 |
| 112 // If the user switches to another space where the fullscreen browser window | 113 // If the user switches to another space where the fullscreen browser window |
| (...skipping 30 matching lines...) Expand all Loading... |
| 143 PERFORM_FULLSCREEN_CHECK), | 144 PERFORM_FULLSCREEN_CHECK), |
| 144 base::TimeDelta::FromMilliseconds(kCheckFullScreenDelayTimeMs)); | 145 base::TimeDelta::FromMilliseconds(kCheckFullScreenDelayTimeMs)); |
| 145 } | 146 } |
| 146 | 147 |
| 147 } // namespace | 148 } // namespace |
| 148 | 149 |
| 149 // static | 150 // static |
| 150 DisplaySettingsProvider* DisplaySettingsProvider::Create() { | 151 DisplaySettingsProvider* DisplaySettingsProvider::Create() { |
| 151 return new DisplaySettingsProviderCocoa(); | 152 return new DisplaySettingsProviderCocoa(); |
| 152 } | 153 } |
| OLD | NEW |