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 #include "chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 BrowserCrApplication* app = base::mac::ObjCCast<BrowserCrApplication>( | 88 BrowserCrApplication* app = base::mac::ObjCCast<BrowserCrApplication>( |
89 [BrowserCrApplication sharedApplication]); | 89 [BrowserCrApplication sharedApplication]); |
90 | 90 |
91 // A Panel window can become the key window only in limited scenarios. | 91 // A Panel window can become the key window only in limited scenarios. |
92 // This prevents the system from always preferring a Panel window due | 92 // This prevents the system from always preferring a Panel window due |
93 // to its higher priority NSWindowLevel when selecting a window to make key. | 93 // to its higher priority NSWindowLevel when selecting a window to make key. |
94 return ([app isHandlingSendEvent] && [[app currentEvent] window] == self) || | 94 return ([app isHandlingSendEvent] && [[app currentEvent] window] == self) || |
95 [controller activationRequestedByPanel] || | 95 [controller activationRequestedByPanel] || |
96 [app isCyclingWindows] || | 96 [app isCyclingWindows] || |
97 [self isKeyWindow] || | 97 [self isKeyWindow] || |
98 [app previousKeyWindow] == self || | |
Scott Hess - ex-Googler
2016/01/12 22:29:54
AFAICT, the only reason |previousKeyWindows_| in c
| |
99 [[app windows] count] == static_cast<NSUInteger>([controller numPanels]); | 98 [[app windows] count] == static_cast<NSUInteger>([controller numPanels]); |
100 } | 99 } |
101 | 100 |
102 - (void)performMiniaturize:(id)sender { | 101 - (void)performMiniaturize:(id)sender { |
103 [[self windowController] minimizeButtonClicked:0]; | 102 [[self windowController] minimizeButtonClicked:0]; |
104 } | 103 } |
105 | 104 |
106 - (void)mouseMoved:(NSEvent*)event { | 105 - (void)mouseMoved:(NSEvent*)event { |
107 // Cocoa does not support letting the application determine the edges that | 106 // Cocoa does not support letting the application determine the edges that |
108 // can trigger the user resizing. To work around this, we track the mouse | 107 // can trigger the user resizing. To work around this, we track the mouse |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
957 if (![window canBecomeKeyWindow]) | 956 if (![window canBecomeKeyWindow]) |
958 continue; | 957 continue; |
959 | 958 |
960 [window makeKeyWindow]; | 959 [window makeKeyWindow]; |
961 } | 960 } |
962 return; | 961 return; |
963 } | 962 } |
964 } | 963 } |
965 | 964 |
966 @end | 965 @end |
OLD | NEW |