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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 Panel* panel = windowShim_->panel(); | 772 Panel* panel = windowShim_->panel(); |
773 panel->OnTitlebarClicked((modifierFlags & NSShiftKeyMask) ? | 773 panel->OnTitlebarClicked((modifierFlags & NSShiftKeyMask) ? |
774 panel::APPLY_TO_ALL : panel::NO_MODIFIER); | 774 panel::APPLY_TO_ALL : panel::NO_MODIFIER); |
775 } | 775 } |
776 | 776 |
777 - (int)titlebarHeightInScreenCoordinates { | 777 - (int)titlebarHeightInScreenCoordinates { |
778 NSView* titlebar = [self titlebarView]; | 778 NSView* titlebar = [self titlebarView]; |
779 return NSHeight([titlebar convertRect:[titlebar bounds] toView:nil]); | 779 return NSHeight([titlebar convertRect:[titlebar bounds] toView:nil]); |
780 } | 780 } |
781 | 781 |
782 - (void)ensureFullyVisible { | |
783 // Shows the window without making it key, on top of its layer, even if | |
784 // Chromium is not an active app. | |
785 [[self window] orderFrontRegardless]; | |
786 } | |
787 | |
788 // TODO(dcheng): These two selectors are almost copy-and-paste from | 782 // TODO(dcheng): These two selectors are almost copy-and-paste from |
789 // BrowserWindowController. Figure out the appropriate way of code sharing, | 783 // BrowserWindowController. Figure out the appropriate way of code sharing, |
790 // whether it's refactoring more things into BrowserWindowUtils or making a | 784 // whether it's refactoring more things into BrowserWindowUtils or making a |
791 // common base controller for browser windows. | 785 // common base controller for browser windows. |
792 - (void)windowDidBecomeKey:(NSNotification*)notification { | 786 - (void)windowDidBecomeKey:(NSNotification*)notification { |
793 // We need to activate the controls (in the "WebView"). To do this, get the | 787 // We need to activate the controls (in the "WebView"). To do this, get the |
794 // selected WebContents's RenderWidgetHostView and tell it to activate. | 788 // selected WebContents's RenderWidgetHostView and tell it to activate. |
795 if (WebContents* contents = [contentsController_ webContents]) { | 789 if (WebContents* contents = [contentsController_ webContents]) { |
796 if (content::RenderWidgetHostView* rwhv = | 790 if (content::RenderWidgetHostView* rwhv = |
797 contents->GetRenderWidgetHostView()) | 791 contents->GetRenderWidgetHostView()) |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 925 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
932 NSRect contentRect = [[[self window] contentView] convertRect:frameRect | 926 NSRect contentRect = [[[self window] contentView] convertRect:frameRect |
933 fromView:nil]; | 927 fromView:nil]; |
934 contentRect.size.height -= panel::kTitlebarHeight; | 928 contentRect.size.height -= panel::kTitlebarHeight; |
935 if (contentRect.size.height < 0) | 929 if (contentRect.size.height < 0) |
936 contentRect.size.height = 0; | 930 contentRect.size.height = 0; |
937 return contentRect; | 931 return contentRect; |
938 } | 932 } |
939 | 933 |
940 @end | 934 @end |
OLD | NEW |