Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(774)

Side by Side Diff: content/browser/web_contents/web_contents_view_mac.mm

Issue 853883007: Add occlusion support to WebContentsImpl and RenderWidgetHostView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove mac comment Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 599
600 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { 600 - (void)viewWillMoveToWindow:(NSWindow*)newWindow {
601 NSWindow* oldWindow = [self window]; 601 NSWindow* oldWindow = [self window];
602 602
603 NSNotificationCenter* notificationCenter = 603 NSNotificationCenter* notificationCenter =
604 [NSNotificationCenter defaultCenter]; 604 [NSNotificationCenter defaultCenter];
605 605
606 // Occlusion notification APIs are new in Mavericks. 606 // Occlusion notification APIs are new in Mavericks.
607 bool supportsOcclusionAPIs = base::mac::IsOSMavericksOrLater(); 607 bool supportsOcclusionAPIs = base::mac::IsOSMavericksOrLater();
608 608
609 // Use of occlusion APIs is causing bugs:
610 // http://crbug.com/430968: focus set incorrectly.
611 // http://crbug.com/431272: flashes of incorrect content.
612 // http://crbug.com/310374: white flashes (comment 22).
613 supportsOcclusionAPIs = false;
614
615 if (supportsOcclusionAPIs) { 609 if (supportsOcclusionAPIs) {
616 if (oldWindow) { 610 if (oldWindow) {
617 [notificationCenter 611 [notificationCenter
618 removeObserver:self 612 removeObserver:self
619 name:NSWindowDidChangeOcclusionStateNotification 613 name:NSWindowDidChangeOcclusionStateNotification
620 object:oldWindow]; 614 object:oldWindow];
621 } 615 }
622 if (newWindow) { 616 if (newWindow) {
623 [notificationCenter 617 [notificationCenter
624 addObserver:self 618 addObserver:self
625 selector:@selector(windowChangedOcclusionState:) 619 selector:@selector(windowChangedOcclusionState:)
626 name:NSWindowDidChangeOcclusionStateNotification 620 name:NSWindowDidChangeOcclusionStateNotification
627 object:newWindow]; 621 object:newWindow];
628 } 622 }
629 } 623 }
630 } 624 }
631 625
632 - (void)windowChangedOcclusionState:(NSNotification*)notification { 626 - (void)windowChangedOcclusionState:(NSNotification*)notification {
633 DCHECK(base::mac::IsOSMavericksOrLater()); 627 DCHECK(base::mac::IsOSMavericksOrLater());
634 NSWindow* window = [notification object]; 628 NSWindow* window = [notification object];
635 WebContentsImpl* webContents = [self webContents]; 629 WebContentsImpl* webContents = [self webContents];
636 if (window && webContents) { 630 if (window && webContents) {
637 if ([window occlusionState] & NSWindowOcclusionStateVisible) { 631 if ([window occlusionState] & NSWindowOcclusionStateVisible) {
638 if (!webContents->should_normally_be_visible()) 632 webContents->WasUnOccluded();
639 webContents->WasShown();
640 } else { 633 } else {
641 if (webContents->should_normally_be_visible()) 634 webContents->WasOccluded();
642 webContents->WasHidden();
643 } 635 }
644 } 636 }
645 } 637 }
646 638
647 @end 639 @end
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl_unittest.cc ('k') | content/public/browser/render_widget_host_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698