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 |
11 #include "base/command_line.h" | |
11 #import "base/mac/mac_util.h" | 12 #import "base/mac/mac_util.h" |
12 #import "base/mac/scoped_sending_event.h" | 13 #import "base/mac/scoped_sending_event.h" |
13 #include "base/mac/sdk_forward_declarations.h" | 14 #include "base/mac/sdk_forward_declarations.h" |
14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
15 #import "base/message_loop/message_pump_mac.h" | 16 #import "base/message_loop/message_pump_mac.h" |
16 #include "content/browser/frame_host/popup_menu_helper_mac.h" | 17 #include "content/browser/frame_host/popup_menu_helper_mac.h" |
17 #include "content/browser/renderer_host/render_view_host_factory.h" | 18 #include "content/browser/renderer_host/render_view_host_factory.h" |
18 #include "content/browser/renderer_host/render_view_host_impl.h" | 19 #include "content/browser/renderer_host/render_view_host_impl.h" |
19 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 20 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
20 #include "content/browser/web_contents/web_contents_impl.h" | 21 #include "content/browser/web_contents/web_contents_impl.h" |
21 #import "content/browser/web_contents/web_drag_dest_mac.h" | 22 #import "content/browser/web_contents/web_drag_dest_mac.h" |
22 #import "content/browser/web_contents/web_drag_source_mac.h" | 23 #import "content/browser/web_contents/web_drag_source_mac.h" |
23 #include "content/common/view_messages.h" | 24 #include "content/common/view_messages.h" |
24 #include "content/public/browser/web_contents_delegate.h" | 25 #include "content/public/browser/web_contents_delegate.h" |
25 #include "content/public/browser/web_contents_view_delegate.h" | 26 #include "content/public/browser/web_contents_view_delegate.h" |
27 #include "content/public/common/content_switches.h" | |
26 #include "skia/ext/skia_utils_mac.h" | 28 #include "skia/ext/skia_utils_mac.h" |
27 #import "third_party/mozilla/NSPasteboard+Utils.h" | 29 #import "third_party/mozilla/NSPasteboard+Utils.h" |
28 #include "ui/base/clipboard/custom_data_helper.h" | 30 #include "ui/base/clipboard/custom_data_helper.h" |
29 #import "ui/base/cocoa/focus_tracker.h" | 31 #import "ui/base/cocoa/focus_tracker.h" |
30 #include "ui/base/dragdrop/cocoa_dnd_util.h" | 32 #include "ui/base/dragdrop/cocoa_dnd_util.h" |
31 #include "ui/gfx/image/image_skia_util_mac.h" | 33 #include "ui/gfx/image/image_skia_util_mac.h" |
32 | 34 |
33 using blink::WebDragOperation; | 35 using blink::WebDragOperation; |
34 using blink::WebDragOperationsMask; | 36 using blink::WebDragOperationsMask; |
35 using content::DropData; | 37 using content::DropData; |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
629 for (NSView* subview in self.subviews) | 631 for (NSView* subview in self.subviews) |
630 [subview setFrame:self.bounds]; | 632 [subview setFrame:self.bounds]; |
631 } | 633 } |
632 | 634 |
633 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { | 635 - (void)viewWillMoveToWindow:(NSWindow*)newWindow { |
634 NSWindow* oldWindow = [self window]; | 636 NSWindow* oldWindow = [self window]; |
635 | 637 |
636 NSNotificationCenter* notificationCenter = | 638 NSNotificationCenter* notificationCenter = |
637 [NSNotificationCenter defaultCenter]; | 639 [NSNotificationCenter defaultCenter]; |
638 | 640 |
639 // Occlusion notification APIs are new in Mavericks. | 641 // Occlusion is highly undesirable for browser tests, since it will |
640 bool supportsOcclusionAPIs = base::mac::IsOSMavericksOrLater(); | 642 // flakily change behavior. |
Noel Gordon
2016/03/04 01:57:32
"change" - > "change test" ?
ccameron
2016/03/06 23:09:08
Done.
| |
643 static bool isDisabled = base::CommandLine::ForCurrentProcess()->HasSwitch( | |
Noel Gordon
2016/03/04 01:57:32
Is using a static safe for all test scenarios?
ccameron
2016/03/06 23:09:08
I tested single and multi-process and both worked.
| |
644 switches::kDisableBackgroundingOccludedWindows); | |
641 | 645 |
642 if (supportsOcclusionAPIs) { | 646 if (!isDisabled) { |
643 if (oldWindow) { | 647 if (oldWindow) { |
644 [notificationCenter | 648 [notificationCenter |
645 removeObserver:self | 649 removeObserver:self |
646 name:NSWindowDidChangeOcclusionStateNotification | 650 name:NSWindowDidChangeOcclusionStateNotification |
647 object:oldWindow]; | 651 object:oldWindow]; |
648 } | 652 } |
649 if (newWindow) { | 653 if (newWindow) { |
650 [notificationCenter | 654 [notificationCenter |
651 addObserver:self | 655 addObserver:self |
652 selector:@selector(windowChangedOcclusionState:) | 656 selector:@selector(windowChangedOcclusionState:) |
(...skipping 22 matching lines...) Expand all Loading... | |
675 | 679 |
676 - (void)viewDidHide { | 680 - (void)viewDidHide { |
677 [self updateWebContentsVisibility]; | 681 [self updateWebContentsVisibility]; |
678 } | 682 } |
679 | 683 |
680 - (void)viewDidUnhide { | 684 - (void)viewDidUnhide { |
681 [self updateWebContentsVisibility]; | 685 [self updateWebContentsVisibility]; |
682 } | 686 } |
683 | 687 |
684 @end | 688 @end |
OLD | NEW |