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 <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
10 #import "base/mac/mac_util.h" | 10 #import "base/mac/mac_util.h" |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
483 EXPECT_TRUE(bridge()->target_fullscreen_state()); | 483 EXPECT_TRUE(bridge()->target_fullscreen_state()); |
484 [center postNotificationName:NSWindowDidExitFullScreenNotification | 484 [center postNotificationName:NSWindowDidExitFullScreenNotification |
485 object:window]; | 485 object:window]; |
486 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); | 486 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); |
487 EXPECT_FALSE(bridge()->target_fullscreen_state()); | 487 EXPECT_FALSE(bridge()->target_fullscreen_state()); |
488 | 488 |
489 // Cocoa follows up with a failure message sent to the NSWindowDelegate (there | 489 // Cocoa follows up with a failure message sent to the NSWindowDelegate (there |
490 // is no equivalent notification for failure). Called via id so that this | 490 // is no equivalent notification for failure). Called via id so that this |
491 // compiles on 10.6. | 491 // compiles on 10.6. |
492 id window_delegate = [window delegate]; | 492 id window_delegate = [window delegate]; |
493 [window_delegate windowDidFailToEnterFullScreen:window]; | 493 [window_delegate performSelector:@selector(windowDidFailToEnterFullScreen:) |
494 withObject:window]; | |
Nico
2015/05/12 22:29:38
why this change?
erikchen
2015/05/12 22:41:39
The method windowDidFailToEnterFullScreen: is only
Nico
2015/05/12 22:45:00
Huh, if you declare it it should be possible to ca
erikchen
2015/05/12 23:49:19
Just to confirm: You would prefer it if I cast win
Nico
2015/05/13 00:18:30
Are you sure that you need the cast and the export
erikchen
2015/05/13 00:26:21
Ah, they are not necessary.
One caveat: This cla
erikchen
2015/05/13 16:56:43
Hm. Removing NSWindowDelegateFullScreenAdditions f
| |
494 EXPECT_FALSE(bridge()->target_fullscreen_state()); | 495 EXPECT_FALSE(bridge()->target_fullscreen_state()); |
495 | 496 |
496 // Now perform a successful fullscreen operation. | 497 // Now perform a successful fullscreen operation. |
497 [center postNotificationName:NSWindowWillEnterFullScreenNotification | 498 [center postNotificationName:NSWindowWillEnterFullScreenNotification |
498 object:window]; | 499 object:window]; |
499 EXPECT_TRUE(bridge()->target_fullscreen_state()); | 500 EXPECT_TRUE(bridge()->target_fullscreen_state()); |
500 [center postNotificationName:NSWindowDidEnterFullScreenNotification | 501 [center postNotificationName:NSWindowDidEnterFullScreenNotification |
501 object:window]; | 502 object:window]; |
502 EXPECT_TRUE(bridge()->target_fullscreen_state()); | 503 EXPECT_TRUE(bridge()->target_fullscreen_state()); |
503 | 504 |
504 // And try to get out. | 505 // And try to get out. |
505 [center postNotificationName:NSWindowWillExitFullScreenNotification | 506 [center postNotificationName:NSWindowWillExitFullScreenNotification |
506 object:window]; | 507 object:window]; |
507 EXPECT_FALSE(bridge()->target_fullscreen_state()); | 508 EXPECT_FALSE(bridge()->target_fullscreen_state()); |
508 | 509 |
509 // On a failure, Cocoa sends a failure message, but then just dumps the window | 510 // On a failure, Cocoa sends a failure message, but then just dumps the window |
510 // out of fullscreen anyway (in that order). | 511 // out of fullscreen anyway (in that order). |
511 [window_delegate windowDidFailToExitFullScreen:window]; | 512 [window_delegate performSelector:@selector(windowDidFailToExitFullScreen:) |
513 withObject:window]; | |
512 EXPECT_FALSE(bridge()->target_fullscreen_state()); | 514 EXPECT_FALSE(bridge()->target_fullscreen_state()); |
513 [center postNotificationName:NSWindowDidExitFullScreenNotification | 515 [center postNotificationName:NSWindowDidExitFullScreenNotification |
514 object:window]; | 516 object:window]; |
515 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change. | 517 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change. |
516 EXPECT_FALSE(bridge()->target_fullscreen_state()); | 518 EXPECT_FALSE(bridge()->target_fullscreen_state()); |
517 | 519 |
518 widget_->CloseNow(); | 520 widget_->CloseNow(); |
519 } | 521 } |
520 | 522 |
521 } // namespace test | 523 } // namespace test |
522 } // namespace views | 524 } // namespace views |
OLD | NEW |