| 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 "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" | 5 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> // kVK_Escape | 7 #include <Carbon/Carbon.h> // kVK_Escape |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 @implementation PanelTitlebarOverlayView | 57 @implementation PanelTitlebarOverlayView |
| 58 // Sometimes we do not want to bring chrome window to foreground when we click | 58 // Sometimes we do not want to bring chrome window to foreground when we click |
| 59 // on any part of the titlebar. To do this, we first postpone the window | 59 // on any part of the titlebar. To do this, we first postpone the window |
| 60 // reorder here (shouldDelayWindowOrderingForEvent is called during when mouse | 60 // reorder here (shouldDelayWindowOrderingForEvent is called during when mouse |
| 61 // button is pressed but before mouseDown: is dispatched) and then complete | 61 // button is pressed but before mouseDown: is dispatched) and then complete |
| 62 // canceling the reorder by [NSApp preventWindowOrdering] in mouseDown handler | 62 // canceling the reorder by [NSApp preventWindowOrdering] in mouseDown handler |
| 63 // of this view. | 63 // of this view. |
| 64 - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent*)theEvent { | 64 - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent*)theEvent { |
| 65 disableReordering_ = ![controller_ isActivationByClickingTitlebarEnabled]; | 65 disableReordering_ = ![controller_ canBecomeKeyWindow]; |
| 66 return disableReordering_; | 66 return disableReordering_; |
| 67 } | 67 } |
| 68 | 68 |
| 69 - (void)mouseDown:(NSEvent*)event { | 69 - (void)mouseDown:(NSEvent*)event { |
| 70 if (disableReordering_) | 70 if (disableReordering_) |
| 71 [NSApp preventWindowOrdering]; | 71 [NSApp preventWindowOrdering]; |
| 72 disableReordering_ = NO; | 72 disableReordering_ = NO; |
| 73 // Continue bubbling the event up the chain of responders. | 73 // Continue bubbling the event up the chain of responders. |
| 74 [super mouseDown:event]; | 74 [super mouseDown:event]; |
| 75 } | 75 } |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 - (void)cancelDragTitlebar { | 630 - (void)cancelDragTitlebar { |
| 631 [self endDrag:YES]; | 631 [self endDrag:YES]; |
| 632 } | 632 } |
| 633 | 633 |
| 634 - (void)finishDragTitlebar { | 634 - (void)finishDragTitlebar { |
| 635 [self endDrag:NO]; | 635 [self endDrag:NO]; |
| 636 } | 636 } |
| 637 | 637 |
| 638 @end | 638 @end |
| 639 | 639 |
| OLD | NEW |