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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 - (BOOL)canAttachConstrainedWindow { | 477 - (BOOL)canAttachConstrainedWindow { |
478 return ![previewableContentsController_ isShowingPreview]; | 478 return ![previewableContentsController_ isShowingPreview]; |
479 } | 479 } |
480 | 480 |
481 - (void)updateDevToolsForContents:(TabContents*)contents { | 481 - (void)updateDevToolsForContents:(TabContents*)contents { |
482 [devToolsController_ updateDevToolsForTabContents:contents | 482 [devToolsController_ updateDevToolsForTabContents:contents |
483 withProfile:browser_->profile()]; | 483 withProfile:browser_->profile()]; |
484 [devToolsController_ ensureContentsVisible]; | 484 [devToolsController_ ensureContentsVisible]; |
485 } | 485 } |
486 | 486 |
487 - (void)updateSidebarForContents:(TabContents*)contents { | 487 - (void)updateSidebarForTab:(TabContentsWrapper*)tab { |
488 [sidebarController_ updateSidebarForTabContents:contents]; | 488 [sidebarController_ updateSidebarForTab:tab]; |
489 [sidebarController_ ensureContentsVisible]; | 489 [sidebarController_ ensureContentsVisible]; |
490 } | 490 } |
491 | 491 |
492 // Called when the user wants to close a window or from the shutdown process. | 492 // Called when the user wants to close a window or from the shutdown process. |
493 // The Browser object is in control of whether or not we're allowed to close. It | 493 // The Browser object is in control of whether or not we're allowed to close. It |
494 // may defer closing due to several states, such as onUnload handlers needing to | 494 // may defer closing due to several states, such as onUnload handlers needing to |
495 // be fired. If closing is deferred, the Browser will handle the processing | 495 // be fired. If closing is deferred, the Browser will handle the processing |
496 // required to get us to the closing state and (by watching for all the tabs | 496 // required to get us to the closing state and (by watching for all the tabs |
497 // going away) will again call to close the window when it's finally ready. | 497 // going away) will again call to close the window when it's finally ready. |
498 - (BOOL)windowShouldClose:(id)sender { | 498 - (BOOL)windowShouldClose:(id)sender { |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 gfx::Rect(growBoxRect.origin.x, growBoxRect.origin.y, | 1414 gfx::Rect(growBoxRect.origin.x, growBoxRect.origin.y, |
1415 growBoxRect.size.width, growBoxRect.size.height); | 1415 growBoxRect.size.width, growBoxRect.size.height); |
1416 } | 1416 } |
1417 } | 1417 } |
1418 } | 1418 } |
1419 | 1419 |
1420 render_widget_host_view->set_reserved_contents_rect(reserved_rect); | 1420 render_widget_host_view->set_reserved_contents_rect(reserved_rect); |
1421 } | 1421 } |
1422 | 1422 |
1423 // TabStripControllerDelegate protocol. | 1423 // TabStripControllerDelegate protocol. |
1424 - (void)onSelectTabWithContents:(TabContents*)contents { | 1424 - (void)onSelectTab:(TabContentsWrapper*)tab { |
1425 // Update various elements that are interested in knowing the current | 1425 // Update various elements that are interested in knowing the current |
1426 // TabContents. | 1426 // TabContents. |
1427 | 1427 |
| 1428 TabContents* contents = tab ? tab->tab_contents() : NULL; |
| 1429 |
1428 // Update all the UI bits. | 1430 // Update all the UI bits. |
1429 windowShim_->UpdateTitleBar(); | 1431 windowShim_->UpdateTitleBar(); |
1430 | 1432 |
1431 [sidebarController_ updateSidebarForTabContents:contents]; | 1433 [sidebarController_ updateSidebarForTab:tab]; |
1432 [devToolsController_ updateDevToolsForTabContents:contents | 1434 [devToolsController_ updateDevToolsForTabContents:contents |
1433 withProfile:browser_->profile()]; | 1435 withProfile:browser_->profile()]; |
1434 | 1436 |
1435 // Update the bookmark bar. | 1437 // Update the bookmark bar. |
1436 // Must do it after sidebar and devtools update, otherwise bookmark bar might | 1438 // Must do it after sidebar and devtools update, otherwise bookmark bar might |
1437 // call resizeView -> layoutSubviews and cause unnecessary relayout. | 1439 // call resizeView -> layoutSubviews and cause unnecessary relayout. |
1438 // TODO(viettrungluu): perhaps update to not terminate running animations (if | 1440 // TODO(viettrungluu): perhaps update to not terminate running animations (if |
1439 // applicable)? | 1441 // applicable)? |
1440 [self updateBookmarkBarVisibilityWithAnimation:NO]; | 1442 [self updateBookmarkBarVisibilityWithAnimation:NO]; |
1441 | 1443 |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2083 | 2085 |
2084 - (BOOL)supportsBookmarkBar { | 2086 - (BOOL)supportsBookmarkBar { |
2085 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2087 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2086 } | 2088 } |
2087 | 2089 |
2088 - (BOOL)isNormalWindow { | 2090 - (BOOL)isNormalWindow { |
2089 return browser_->type() == Browser::TYPE_NORMAL; | 2091 return browser_->type() == Browser::TYPE_NORMAL; |
2090 } | 2092 } |
2091 | 2093 |
2092 @end // @implementation BrowserWindowController(WindowType) | 2094 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |