OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <numeric> | 8 #include <numeric> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 return [bookmarkBarController_ isAnimationRunning]; | 1435 return [bookmarkBarController_ isAnimationRunning]; |
1436 } | 1436 } |
1437 | 1437 |
1438 - (void)updateBookmarkBarVisibilityWithAnimation:(BOOL)animate { | 1438 - (void)updateBookmarkBarVisibilityWithAnimation:(BOOL)animate { |
1439 [bookmarkBarController_ | 1439 [bookmarkBarController_ |
1440 updateAndShowNormalBar:[self shouldShowBookmarkBar] | 1440 updateAndShowNormalBar:[self shouldShowBookmarkBar] |
1441 showDetachedBar:[self shouldShowDetachedBookmarkBar] | 1441 showDetachedBar:[self shouldShowDetachedBookmarkBar] |
1442 withAnimation:animate]; | 1442 withAnimation:animate]; |
1443 } | 1443 } |
1444 | 1444 |
| 1445 - (BookmarkBarController*)bookmarkBarController { |
| 1446 return bookmarkBarController_; |
| 1447 } |
| 1448 |
1445 - (BOOL)isDownloadShelfVisible { | 1449 - (BOOL)isDownloadShelfVisible { |
1446 return downloadShelfController_ != nil && | 1450 return downloadShelfController_ != nil && |
1447 [downloadShelfController_ isVisible]; | 1451 [downloadShelfController_ isVisible]; |
1448 } | 1452 } |
1449 | 1453 |
1450 - (DownloadShelfController*)downloadShelf { | 1454 - (DownloadShelfController*)downloadShelf { |
1451 if (!downloadShelfController_.get()) { | 1455 if (!downloadShelfController_.get()) { |
1452 downloadShelfController_.reset([[DownloadShelfController alloc] | 1456 downloadShelfController_.reset([[DownloadShelfController alloc] |
1453 initWithBrowser:browser_.get() resizeDelegate:self]); | 1457 initWithBrowser:browser_.get() resizeDelegate:self]); |
1454 [[[self window] contentView] addSubview:[downloadShelfController_ view]]; | 1458 [[[self window] contentView] addSubview:[downloadShelfController_ view]]; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 rwhv->WindowFrameChanged(); | 1766 rwhv->WindowFrameChanged(); |
1763 } | 1767 } |
1764 | 1768 |
1765 // The FindBar needs to know its own position to properly detect overlaps | 1769 // The FindBar needs to know its own position to properly detect overlaps |
1766 // with find results. The position changes whenever the window is resized, | 1770 // with find results. The position changes whenever the window is resized, |
1767 // and |layoutSubviews| computes the FindBar's position. | 1771 // and |layoutSubviews| computes the FindBar's position. |
1768 // TODO: calling |layoutSubviews| here is a waste, find a better way to | 1772 // TODO: calling |layoutSubviews| here is a waste, find a better way to |
1769 // do this. | 1773 // do this. |
1770 if ([findBarCocoaController_ isFindBarVisible]) | 1774 if ([findBarCocoaController_ isFindBarVisible]) |
1771 [self layoutSubviews]; | 1775 [self layoutSubviews]; |
| 1776 |
| 1777 if ([self placeBookmarkBarBelowInfoBar] && |
| 1778 [bookmarkBarController_ shouldShowAtBottomWhenDetached]) { |
| 1779 [self layoutBottomBookmarkBarInContentFrame:[[self tabContentArea] frame]]; |
| 1780 } |
1772 } | 1781 } |
1773 | 1782 |
1774 // Handle the openLearnMoreAboutCrashLink: action from SadTabController when | 1783 // Handle the openLearnMoreAboutCrashLink: action from SadTabController when |
1775 // "Learn more" link in "Aw snap" page (i.e. crash page or sad tab) is | 1784 // "Learn more" link in "Aw snap" page (i.e. crash page or sad tab) is |
1776 // clicked. Decoupling the action from its target makes unit testing possible. | 1785 // clicked. Decoupling the action from its target makes unit testing possible. |
1777 - (void)openLearnMoreAboutCrashLink:(id)sender { | 1786 - (void)openLearnMoreAboutCrashLink:(id)sender { |
1778 if ([sender isKindOfClass:[SadTabController class]]) { | 1787 if ([sender isKindOfClass:[SadTabController class]]) { |
1779 SadTabController* sad_tab = static_cast<SadTabController*>(sender); | 1788 SadTabController* sad_tab = static_cast<SadTabController*>(sender); |
1780 WebContents* web_contents = [sad_tab webContents]; | 1789 WebContents* web_contents = [sad_tab webContents]; |
1781 if (web_contents) { | 1790 if (web_contents) { |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2173 | 2182 |
2174 - (BOOL)supportsBookmarkBar { | 2183 - (BOOL)supportsBookmarkBar { |
2175 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2184 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2176 } | 2185 } |
2177 | 2186 |
2178 - (BOOL)isTabbedWindow { | 2187 - (BOOL)isTabbedWindow { |
2179 return browser_->is_type_tabbed(); | 2188 return browser_->is_type_tabbed(); |
2180 } | 2189 } |
2181 | 2190 |
2182 @end // @implementation BrowserWindowController(WindowType) | 2191 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |