| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/browser_window_controller.h" | 5 #import "chrome/browser/cocoa/browser_window_controller.h" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
| 8 | 8 |
| 9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
| 10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
| (...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 return downloadShelfController_; | 1244 return downloadShelfController_; |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { | 1247 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { |
| 1248 // Shouldn't call addFindBar twice. | 1248 // Shouldn't call addFindBar twice. |
| 1249 DCHECK(!findBarCocoaController_.get()); | 1249 DCHECK(!findBarCocoaController_.get()); |
| 1250 | 1250 |
| 1251 // Create a controller for the findbar. | 1251 // Create a controller for the findbar. |
| 1252 findBarCocoaController_.reset([findBarCocoaController retain]); | 1252 findBarCocoaController_.reset([findBarCocoaController retain]); |
| 1253 NSView *contentView = [[self window] contentView]; | 1253 NSView *contentView = [[self window] contentView]; |
| 1254 [contentView addSubview:[findBarCocoaController_ view] | 1254 // [contentView addSubview:[findBarCocoaController_ view] |
| 1255 positioned:NSWindowAbove | 1255 // positioned:NSWindowAbove |
| 1256 relativeTo:[toolbarController_ view]]; | 1256 // relativeTo:[toolbarController_ view]]; |
| 1257 // Trigger a nib load. |
| 1258 //[findBarCocoaController_ view]; |
| 1259 [[self window] addChildWindow:[findBarCocoaController_ window] |
| 1260 ordered:NSWindowAbove]; |
| 1261 LOG(ERROR) << "Adding child window"; |
| 1257 | 1262 |
| 1258 // Place the find bar immediately below the toolbar/attached bookmark bar. In | 1263 // Place the find bar immediately below the toolbar/attached bookmark bar. In |
| 1259 // fullscreen mode, it hangs off the top of the screen when the bar is hidden. | 1264 // fullscreen mode, it hangs off the top of the screen when the bar is hidden. |
| 1260 CGFloat maxY = [self placeBookmarkBarBelowInfoBar] ? | 1265 CGFloat maxY = [self placeBookmarkBarBelowInfoBar] ? |
| 1261 NSMinY([[toolbarController_ view] frame]) : | 1266 NSMinY([[toolbarController_ view] frame]) : |
| 1262 NSMinY([[bookmarkBarController_ view] frame]); | 1267 NSMinY([[bookmarkBarController_ view] frame]); |
| 1263 CGFloat maxWidth = NSWidth([contentView frame]); | 1268 CGFloat maxWidth = NSWidth([contentView frame]); |
| 1264 [findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:maxWidth]; | 1269 [findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:maxWidth]; |
| 1265 } | 1270 } |
| 1266 | 1271 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 } | 1529 } |
| 1525 | 1530 |
| 1526 // Delegate method called when window is resized. | 1531 // Delegate method called when window is resized. |
| 1527 - (void)windowDidResize:(NSNotification*)notification { | 1532 - (void)windowDidResize:(NSNotification*)notification { |
| 1528 // Resize (and possibly move) the status bubble. Note that we may get called | 1533 // Resize (and possibly move) the status bubble. Note that we may get called |
| 1529 // when the status bubble does not exist. | 1534 // when the status bubble does not exist. |
| 1530 if (statusBubble_) { | 1535 if (statusBubble_) { |
| 1531 statusBubble_->UpdateSizeAndPosition(); | 1536 statusBubble_->UpdateSizeAndPosition(); |
| 1532 } | 1537 } |
| 1533 | 1538 |
| 1539 CGFloat maxY = [self placeBookmarkBarBelowInfoBar] ? |
| 1540 NSMinY([[toolbarController_ view] frame]) : |
| 1541 NSMinY([[bookmarkBarController_ view] frame]); |
| 1542 CGFloat maxWidth = NSWidth([[[self window] contentView] frame]); |
| 1543 [findBarCocoaController_ positionFindBarViewAtMaxY:maxY maxWidth:maxWidth]; |
| 1544 |
| 1545 |
| 1534 // Let the selected RenderWidgetHostView know, so that it can tell plugins. | 1546 // Let the selected RenderWidgetHostView know, so that it can tell plugins. |
| 1535 if (TabContents* contents = browser_->GetSelectedTabContents()) { | 1547 if (TabContents* contents = browser_->GetSelectedTabContents()) { |
| 1536 if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) | 1548 if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) |
| 1537 rwhv->WindowFrameChanged(); | 1549 rwhv->WindowFrameChanged(); |
| 1538 } | 1550 } |
| 1539 } | 1551 } |
| 1540 | 1552 |
| 1541 // Handle the openLearnMoreAboutCrashLink: action from SadTabController when | 1553 // Handle the openLearnMoreAboutCrashLink: action from SadTabController when |
| 1542 // "Learn more" link in "Aw snap" page (i.e. crash page or sad tab) is | 1554 // "Learn more" link in "Aw snap" page (i.e. crash page or sad tab) is |
| 1543 // clicked. Decoupling the action from its target makes unitestting possible. | 1555 // clicked. Decoupling the action from its target makes unitestting possible. |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1872 | 1884 |
| 1873 - (BOOL)supportsBookmarkBar { | 1885 - (BOOL)supportsBookmarkBar { |
| 1874 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 1886 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 1875 } | 1887 } |
| 1876 | 1888 |
| 1877 - (BOOL)isNormalWindow { | 1889 - (BOOL)isNormalWindow { |
| 1878 return browser_->type() == Browser::TYPE_NORMAL; | 1890 return browser_->type() == Browser::TYPE_NORMAL; |
| 1879 } | 1891 } |
| 1880 | 1892 |
| 1881 @end // @implementation BrowserWindowController(WindowType) | 1893 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |