| 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 #import <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
| 6 | 6 |
| 7 #import "content/browser/web_contents/web_contents_view_mac.h" | 7 #import "content/browser/web_contents/web_contents_view_mac.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 [notificationCenter | 653 [notificationCenter |
| 654 addObserver:self | 654 addObserver:self |
| 655 selector:@selector(windowChangedOcclusionState:) | 655 selector:@selector(windowChangedOcclusionState:) |
| 656 name:NSWindowDidChangeOcclusionStateNotification | 656 name:NSWindowDidChangeOcclusionStateNotification |
| 657 object:newWindow]; | 657 object:newWindow]; |
| 658 } | 658 } |
| 659 } | 659 } |
| 660 } | 660 } |
| 661 | 661 |
| 662 - (void)windowChangedOcclusionState:(NSNotification*)notification { | 662 - (void)windowChangedOcclusionState:(NSNotification*)notification { |
| 663 DCHECK(base::mac::IsOSMavericksOrLater()); | |
| 664 NSWindow* window = [notification object]; | 663 NSWindow* window = [notification object]; |
| 665 WebContentsImpl* webContents = [self webContents]; | 664 WebContentsImpl* webContents = [self webContents]; |
| 666 if (window && webContents && !webContents->IsBeingDestroyed()) { | 665 if (window && webContents && !webContents->IsBeingDestroyed()) { |
| 667 if ([window occlusionState] & NSWindowOcclusionStateVisible) { | 666 if ([window occlusionState] & NSWindowOcclusionStateVisible) { |
| 668 webContents->WasUnOccluded(); | 667 webContents->WasUnOccluded(); |
| 669 } else { | 668 } else { |
| 670 webContents->WasOccluded(); | 669 webContents->WasOccluded(); |
| 671 } | 670 } |
| 672 } | 671 } |
| 673 } | 672 } |
| 674 | 673 |
| 675 - (void)viewDidMoveToWindow { | 674 - (void)viewDidMoveToWindow { |
| 676 [self updateWebContentsVisibility]; | 675 [self updateWebContentsVisibility]; |
| 677 } | 676 } |
| 678 | 677 |
| 679 - (void)viewDidHide { | 678 - (void)viewDidHide { |
| 680 [self updateWebContentsVisibility]; | 679 [self updateWebContentsVisibility]; |
| 681 } | 680 } |
| 682 | 681 |
| 683 - (void)viewDidUnhide { | 682 - (void)viewDidUnhide { |
| 684 [self updateWebContentsVisibility]; | 683 [self updateWebContentsVisibility]; |
| 685 } | 684 } |
| 686 | 685 |
| 687 @end | 686 @end |
| OLD | NEW |