OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
8 | 8 |
9 #include "app/mac/scoped_nsdisable_screen_updates.h" | 9 #include "app/mac/scoped_nsdisable_screen_updates.h" |
10 #include "app/mac/nsimage_cache.h" | 10 #include "app/mac/nsimage_cache.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 } | 417 } |
418 | 418 |
419 - (ToolbarController*)toolbarController { | 419 - (ToolbarController*)toolbarController { |
420 return toolbarController_.get(); | 420 return toolbarController_.get(); |
421 } | 421 } |
422 | 422 |
423 - (TabStripController*)tabStripController { | 423 - (TabStripController*)tabStripController { |
424 return tabStripController_.get(); | 424 return tabStripController_.get(); |
425 } | 425 } |
426 | 426 |
| 427 - (InfoBarContainerController*)infoBarContainerController { |
| 428 return infoBarContainerController_.get(); |
| 429 } |
| 430 |
427 - (StatusBubbleMac*)statusBubble { | 431 - (StatusBubbleMac*)statusBubble { |
428 return statusBubble_; | 432 return statusBubble_; |
429 } | 433 } |
430 | 434 |
431 - (LocationBarViewMac*)locationBarBridge { | 435 - (LocationBarViewMac*)locationBarBridge { |
432 return [toolbarController_ locationBarBridge]; | 436 return [toolbarController_ locationBarBridge]; |
433 } | 437 } |
434 | 438 |
435 - (void)destroyBrowser { | 439 - (void)destroyBrowser { |
436 [NSApp removeWindowsItem:[self window]]; | 440 [NSApp removeWindowsItem:[self window]]; |
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 delay:delay]; | 2036 delay:delay]; |
2033 } | 2037 } |
2034 } | 2038 } |
2035 } | 2039 } |
2036 | 2040 |
2037 - (BOOL)floatingBarHasFocus { | 2041 - (BOOL)floatingBarHasFocus { |
2038 NSResponder* focused = [[self window] firstResponder]; | 2042 NSResponder* focused = [[self window] firstResponder]; |
2039 return [focused isKindOfClass:[AutocompleteTextFieldEditor class]]; | 2043 return [focused isKindOfClass:[AutocompleteTextFieldEditor class]]; |
2040 } | 2044 } |
2041 | 2045 |
| 2046 - (void)tabposeWillClose:(NSNotification*)notif { |
| 2047 // Re-show the container after Tabpose closes. |
| 2048 [[infoBarContainerController_ view] setHidden:NO]; |
| 2049 } |
| 2050 |
2042 - (void)openTabpose { | 2051 - (void)openTabpose { |
2043 NSUInteger modifierFlags = [[NSApp currentEvent] modifierFlags]; | 2052 NSUInteger modifierFlags = [[NSApp currentEvent] modifierFlags]; |
2044 BOOL slomo = (modifierFlags & NSShiftKeyMask) != 0; | 2053 BOOL slomo = (modifierFlags & NSShiftKeyMask) != 0; |
2045 | 2054 |
2046 // Cover info bars, inspector window, and detached bookmark bar on NTP. | 2055 // Cover info bars, inspector window, and detached bookmark bar on NTP. |
2047 // Do not cover download shelf. | 2056 // Do not cover download shelf. |
2048 NSRect activeArea = [[self tabContentArea] frame]; | 2057 NSRect activeArea = [[self tabContentArea] frame]; |
| 2058 // Take out the anti-spoof height so that Tabpose doesn't draw on top of the |
| 2059 // browser chrome. |
2049 activeArea.size.height += | 2060 activeArea.size.height += |
2050 NSHeight([[infoBarContainerController_ view] frame]); | 2061 NSHeight([[infoBarContainerController_ view] frame]) - |
| 2062 [infoBarContainerController_ antiSpoofHeight]; |
2051 if ([self isBookmarkBarVisible] && [self placeBookmarkBarBelowInfoBar]) { | 2063 if ([self isBookmarkBarVisible] && [self placeBookmarkBarBelowInfoBar]) { |
2052 NSView* bookmarkBarView = [bookmarkBarController_ view]; | 2064 NSView* bookmarkBarView = [bookmarkBarController_ view]; |
2053 activeArea.size.height += NSHeight([bookmarkBarView frame]); | 2065 activeArea.size.height += NSHeight([bookmarkBarView frame]); |
2054 } | 2066 } |
2055 | 2067 |
2056 [TabposeWindow openTabposeFor:[self window] | 2068 // Hide the infobar container so that the anti-spoof bulge doesn't show when |
2057 rect:activeArea | 2069 // Tabpose is open. |
2058 slomo:slomo | 2070 [[infoBarContainerController_ view] setHidden:YES]; |
2059 tabStripModel:browser_->tabstrip_model()]; | 2071 |
| 2072 TabposeWindow* window = |
| 2073 [TabposeWindow openTabposeFor:[self window] |
| 2074 rect:activeArea |
| 2075 slomo:slomo |
| 2076 tabStripModel:browser_->tabstrip_model()]; |
| 2077 |
| 2078 // When the Tabpose window closes, the infobar container needs to be made |
| 2079 // visible again. |
| 2080 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 2081 [center addObserver:self |
| 2082 selector:@selector(tabposeWillClose:) |
| 2083 name:NSWindowWillCloseNotification |
| 2084 object:window]; |
2060 } | 2085 } |
2061 | 2086 |
2062 @end // @implementation BrowserWindowController(Fullscreen) | 2087 @end // @implementation BrowserWindowController(Fullscreen) |
2063 | 2088 |
2064 | 2089 |
2065 @implementation BrowserWindowController(WindowType) | 2090 @implementation BrowserWindowController(WindowType) |
2066 | 2091 |
2067 - (BOOL)supportsWindowFeature:(int)feature { | 2092 - (BOOL)supportsWindowFeature:(int)feature { |
2068 return browser_->SupportsWindowFeature( | 2093 return browser_->SupportsWindowFeature( |
2069 static_cast<Browser::WindowFeature>(feature)); | 2094 static_cast<Browser::WindowFeature>(feature)); |
(...skipping 13 matching lines...) Expand all Loading... |
2083 | 2108 |
2084 - (BOOL)supportsBookmarkBar { | 2109 - (BOOL)supportsBookmarkBar { |
2085 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2110 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2086 } | 2111 } |
2087 | 2112 |
2088 - (BOOL)isNormalWindow { | 2113 - (BOOL)isNormalWindow { |
2089 return browser_->type() == Browser::TYPE_NORMAL; | 2114 return browser_->type() == Browser::TYPE_NORMAL; |
2090 } | 2115 } |
2091 | 2116 |
2092 @end // @implementation BrowserWindowController(WindowType) | 2117 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |