| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ui/base/test/scoped_fake_nswindow_fullscreen.h" | 5 #import "ui/base/test/scoped_fake_nswindow_fullscreen.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // Starting in 10.11, calling -[NSWindow setStyleMask:] can actually invoke | 189 // Starting in 10.11, calling -[NSWindow setStyleMask:] can actually invoke |
| 190 // the fullscreen transitions we want to fake. So, when set, this will include | 190 // the fullscreen transitions we want to fake. So, when set, this will include |
| 191 // NSFullScreenWindowMask in the swizzled styleMask so that client code can | 191 // NSFullScreenWindowMask in the swizzled styleMask so that client code can |
| 192 // read it. | 192 // read it. |
| 193 bool style_as_fullscreen_ = false; | 193 bool style_as_fullscreen_ = false; |
| 194 | 194 |
| 195 DISALLOW_COPY_AND_ASSIGN(Impl); | 195 DISALLOW_COPY_AND_ASSIGN(Impl); |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 ScopedFakeNSWindowFullscreen::ScopedFakeNSWindowFullscreen() { | 198 ScopedFakeNSWindowFullscreen::ScopedFakeNSWindowFullscreen() { |
| 199 // -[NSWindow toggleFullScreen:] does not exist on 10.6, so do nothing. | |
| 200 if (base::mac::IsOSSnowLeopard()) | |
| 201 return; | |
| 202 | |
| 203 DCHECK(!g_fake_fullscreen_impl); | 199 DCHECK(!g_fake_fullscreen_impl); |
| 204 impl_.reset(new Impl); | 200 impl_.reset(new Impl); |
| 205 g_fake_fullscreen_impl = impl_.get(); | 201 g_fake_fullscreen_impl = impl_.get(); |
| 206 } | 202 } |
| 207 | 203 |
| 208 ScopedFakeNSWindowFullscreen::~ScopedFakeNSWindowFullscreen() { | 204 ScopedFakeNSWindowFullscreen::~ScopedFakeNSWindowFullscreen() { |
| 209 g_fake_fullscreen_impl = nullptr; | 205 g_fake_fullscreen_impl = nullptr; |
| 210 } | 206 } |
| 211 | 207 |
| 212 } // namespace test | 208 } // namespace test |
| (...skipping 18 matching lines...) Expand all Loading... |
| 231 if ((newMask ^ currentMask) & NSFullScreenWindowMask) { | 227 if ((newMask ^ currentMask) & NSFullScreenWindowMask) { |
| 232 // Since 10.11, OSX triggers fullscreen transitions via setStyleMask, but | 228 // Since 10.11, OSX triggers fullscreen transitions via setStyleMask, but |
| 233 // the faker doesn't attempt to fake them yet. | 229 // the faker doesn't attempt to fake them yet. |
| 234 NOTREACHED() << "Can't set NSFullScreenWindowMask while faking fullscreen."; | 230 NOTREACHED() << "Can't set NSFullScreenWindowMask while faking fullscreen."; |
| 235 } | 231 } |
| 236 newMask &= ~NSFullScreenWindowMask; | 232 newMask &= ~NSFullScreenWindowMask; |
| 237 g_fake_fullscreen_impl->SetStyleMaskImplementation()(self, _cmd, newMask); | 233 g_fake_fullscreen_impl->SetStyleMaskImplementation()(self, _cmd, newMask); |
| 238 } | 234 } |
| 239 | 235 |
| 240 @end | 236 @end |
| OLD | NEW |