| Index: content/browser/web_contents/web_contents_view_mac.mm
|
| diff --git a/content/browser/web_contents/web_contents_view_mac.mm b/content/browser/web_contents/web_contents_view_mac.mm
|
| index 42348a97bca9cd9c2c15006740f5fcafc521d603..b2e3dd71a0f4da1173d3f42949c469493d0235bf 100644
|
| --- a/content/browser/web_contents/web_contents_view_mac.mm
|
| +++ b/content/browser/web_contents/web_contents_view_mac.mm
|
| @@ -8,6 +8,7 @@
|
|
|
| #include <string>
|
|
|
| +#include "base/mac/mac_util.h"
|
| #import "base/mac/scoped_sending_event.h"
|
| #include "base/message_loop/message_loop.h"
|
| #import "base/message_loop/message_pump_mac.h"
|
| @@ -594,4 +595,40 @@ void WebContentsViewMac::CloseTab() {
|
| [subview setFrame:self.bounds];
|
| }
|
|
|
| +- (void)viewWillMoveToWindow:(NSWindow*)newWindow {
|
| + // Occlusion notification is new in Mavericks.
|
| + if (base::mac::IsOSMavericksOrLater())
|
| + return;
|
| +
|
| + NSWindow* oldWindow = [self window];
|
| +
|
| + if (oldWindow) {
|
| + [[NSNotificationCenter defaultCenter]
|
| + removeObserver:self
|
| + name:NSWindowDidChangeOcclusionStateNotification
|
| + object:oldWindow];
|
| + }
|
| +
|
| + if (newWindow) {
|
| + [[NSNotificationCenter defaultCenter]
|
| + addObserver:self
|
| + selector:@selector(windowChangedOcclusionState:)
|
| + name:NSWindowDidChangeOcclusionStateNotification
|
| + object:newWindow];
|
| + }
|
| +}
|
| +
|
| +- (void)windowChangedOcclusionState:(NSNotification*)notification {
|
| + DCHECK(base::mac::IsOSMavericksOrLater());
|
| + NSWindow* window = [notification object];
|
| + WebContentsImpl* webContents = [self webContents];
|
| + if ([window occlusionState] & NSWindowOcclusionStateVisible) {
|
| + if (!webContents->should_normally_be_visible())
|
| + webContents->WasShown();
|
| + } else {
|
| + if (webContents->should_normally_be_visible())
|
| + webContents->WasHidden();
|
| + }
|
| +}
|
| +
|
| @end
|
|
|