| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/views/cocoa/bridged_native_widget.h" | 5 #import "ui/views/cocoa/bridged_native_widget.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 // toggleFullScreen:]. Unfortunately, this change happens after AppKit calls | 699 // toggleFullScreen:]. Unfortunately, this change happens after AppKit calls |
| 700 // -[NSWindowDelegate windowWillEnterFullScreen:], and AppKit doesn't send an | 700 // -[NSWindowDelegate windowWillEnterFullScreen:], and AppKit doesn't send an |
| 701 // orderWindow message. So intercepting the implicit change is hard. | 701 // orderWindow message. So intercepting the implicit change is hard. |
| 702 // Luckily, to trigger externally, the window typically needs to be visible in | 702 // Luckily, to trigger externally, the window typically needs to be visible in |
| 703 // the first place. So we can just ensure the window is visible here instead | 703 // the first place. So we can just ensure the window is visible here instead |
| 704 // of relying on AppKit to do it, and not worry that OnVisibilityChanged() | 704 // of relying on AppKit to do it, and not worry that OnVisibilityChanged() |
| 705 // won't be called for externally triggered fullscreen requests. | 705 // won't be called for externally triggered fullscreen requests. |
| 706 if (!window_visible_) | 706 if (!window_visible_) |
| 707 SetVisibilityState(SHOW_INACTIVE); | 707 SetVisibilityState(SHOW_INACTIVE); |
| 708 | 708 |
| 709 if (base::mac::IsOSSnowLeopard()) { | |
| 710 NOTIMPLEMENTED(); | |
| 711 return; // TODO(tapted): Implement this for Snow Leopard. | |
| 712 } | |
| 713 | |
| 714 // Enable fullscreen collection behavior because: | 709 // Enable fullscreen collection behavior because: |
| 715 // 1: -[NSWindow toggleFullscreen:] would otherwise be ignored, | 710 // 1: -[NSWindow toggleFullscreen:] would otherwise be ignored, |
| 716 // 2: the fullscreen button must be enabled so the user can leave fullscreen. | 711 // 2: the fullscreen button must be enabled so the user can leave fullscreen. |
| 717 // This will be reset when a transition out of fullscreen completes. | 712 // This will be reset when a transition out of fullscreen completes. |
| 718 gfx::SetNSWindowCanFullscreen(window_, true); | 713 gfx::SetNSWindowCanFullscreen(window_, true); |
| 719 | 714 |
| 720 [window_ toggleFullScreen:nil]; | 715 [window_ toggleFullScreen:nil]; |
| 721 } | 716 } |
| 722 | 717 |
| 723 void BridgedNativeWidget::OnSizeChanged() { | 718 void BridgedNativeWidget::OnSizeChanged() { |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1303 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
| 1309 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1304 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
| 1310 // changes. Previously we tried adding an NSView and removing it, but for some | 1305 // changes. Previously we tried adding an NSView and removing it, but for some |
| 1311 // reason it required reposting the mouse-down event, and didn't always work. | 1306 // reason it required reposting the mouse-down event, and didn't always work. |
| 1312 // Calling the below seems to be an effective solution. | 1307 // Calling the below seems to be an effective solution. |
| 1313 [window_ setMovableByWindowBackground:NO]; | 1308 [window_ setMovableByWindowBackground:NO]; |
| 1314 [window_ setMovableByWindowBackground:YES]; | 1309 [window_ setMovableByWindowBackground:YES]; |
| 1315 } | 1310 } |
| 1316 | 1311 |
| 1317 } // namespace views | 1312 } // namespace views |
| OLD | NEW |