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 <cmath> | 9 #include <cmath> |
10 #include <numeric> | 10 #include <numeric> |
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 } | 1429 } |
1430 return downloadShelfController_; | 1430 return downloadShelfController_; |
1431 } | 1431 } |
1432 | 1432 |
1433 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { | 1433 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { |
1434 // Shouldn't call addFindBar twice. | 1434 // Shouldn't call addFindBar twice. |
1435 DCHECK(!findBarCocoaController_.get()); | 1435 DCHECK(!findBarCocoaController_.get()); |
1436 | 1436 |
1437 // Create a controller for the findbar. | 1437 // Create a controller for the findbar. |
1438 findBarCocoaController_.reset([findBarCocoaController retain]); | 1438 findBarCocoaController_.reset([findBarCocoaController retain]); |
1439 NSView *contentView = [[self window] contentView]; | 1439 NSView* contentView = [[self window] contentView]; |
| 1440 NSView* relativeView = |
| 1441 [self inPresentationMode] ? [toolbarController_ view] : |
| 1442 [infoBarContainerController_ view]; |
1440 [contentView addSubview:[findBarCocoaController_ view] | 1443 [contentView addSubview:[findBarCocoaController_ view] |
1441 positioned:NSWindowAbove | 1444 positioned:NSWindowAbove |
1442 relativeTo:[infoBarContainerController_ view]]; | 1445 relativeTo:relativeView]; |
1443 | 1446 |
1444 // Place the find bar immediately below the toolbar/attached bookmark bar. In | 1447 // Place the find bar immediately below the toolbar/attached bookmark bar. In |
1445 // presentation mode, it hangs off the top of the screen when the bar is | 1448 // presentation mode, it hangs off the top of the screen when the bar is |
1446 // hidden. | 1449 // hidden. |
1447 CGFloat maxY = [self placeBookmarkBarBelowInfoBar] ? | 1450 CGFloat maxY = [self placeBookmarkBarBelowInfoBar] ? |
1448 NSMinY([[toolbarController_ view] frame]) : | 1451 NSMinY([[toolbarController_ view] frame]) : |
1449 NSMinY([[bookmarkBarController_ view] frame]); | 1452 NSMinY([[bookmarkBarController_ view] frame]); |
1450 CGFloat maxWidth = NSWidth([contentView frame]); | 1453 CGFloat maxWidth = NSWidth([contentView frame]); |
1451 [findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:maxWidth]; | 1454 [findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:maxWidth]; |
1452 | 1455 |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2286 | 2289 |
2287 - (BOOL)supportsBookmarkBar { | 2290 - (BOOL)supportsBookmarkBar { |
2288 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2291 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2289 } | 2292 } |
2290 | 2293 |
2291 - (BOOL)isTabbedWindow { | 2294 - (BOOL)isTabbedWindow { |
2292 return browser_->is_type_tabbed(); | 2295 return browser_->is_type_tabbed(); |
2293 } | 2296 } |
2294 | 2297 |
2295 @end // @implementation BrowserWindowController(WindowType) | 2298 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |