| 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.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/l10n_util_mac.h" | 10 #include "app/l10n_util_mac.h" |
| (...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 // Must do it after sidebar and devtools update, otherwise bookmark bar might | 1365 // Must do it after sidebar and devtools update, otherwise bookmark bar might |
| 1366 // call resizeView -> layoutSubviews and cause unnecessary relayout. | 1366 // call resizeView -> layoutSubviews and cause unnecessary relayout. |
| 1367 // TODO(viettrungluu): perhaps update to not terminate running animations (if | 1367 // TODO(viettrungluu): perhaps update to not terminate running animations (if |
| 1368 // applicable)? | 1368 // applicable)? |
| 1369 [self updateBookmarkBarVisibilityWithAnimation:NO]; | 1369 [self updateBookmarkBarVisibilityWithAnimation:NO]; |
| 1370 | 1370 |
| 1371 [infoBarContainerController_ changeTabContents:contents]; | 1371 [infoBarContainerController_ changeTabContents:contents]; |
| 1372 } | 1372 } |
| 1373 | 1373 |
| 1374 - (void)onReplaceTabWithContents:(TabContents*)contents { | 1374 - (void)onReplaceTabWithContents:(TabContents*)contents { |
| 1375 // This is only called when instant results are committed. Simply remove the |
| 1376 // preview view; the tab strip controller will reinstall the view as the |
| 1377 // active view. |
| 1378 [previewableContentsController_ hidePreview]; |
| 1379 [self updateBookmarkBarVisibilityWithAnimation:NO]; |
| 1375 } | 1380 } |
| 1376 | 1381 |
| 1377 - (void)onSelectedTabChange:(TabStripModelObserver::TabChangeType)change { | 1382 - (void)onSelectedTabChange:(TabStripModelObserver::TabChangeType)change { |
| 1378 // Update titles if this is the currently selected tab and if it isn't just | 1383 // Update titles if this is the currently selected tab and if it isn't just |
| 1379 // the loading state which changed. | 1384 // the loading state which changed. |
| 1380 if (change != TabStripModelObserver::LOADING_ONLY) | 1385 if (change != TabStripModelObserver::LOADING_ONLY) |
| 1381 windowShim_->UpdateTitleBar(); | 1386 windowShim_->UpdateTitleBar(); |
| 1382 | 1387 |
| 1383 // Update the bookmark bar if this is the currently selected tab and if it | 1388 // Update the bookmark bar if this is the currently selected tab and if it |
| 1384 // isn't just the title which changed. This for transitions between the NTP | 1389 // isn't just the title which changed. This for transitions between the NTP |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 // tab strip mode. | 1716 // tab strip mode. |
| 1712 - (void)toggleTabStripDisplayMode { | 1717 - (void)toggleTabStripDisplayMode { |
| 1713 [super toggleTabStripDisplayMode]; | 1718 [super toggleTabStripDisplayMode]; |
| 1714 [self createTabStripController]; | 1719 [self createTabStripController]; |
| 1715 } | 1720 } |
| 1716 | 1721 |
| 1717 - (BOOL)useVerticalTabs { | 1722 - (BOOL)useVerticalTabs { |
| 1718 return browser_->tabstrip_model()->delegate()->UseVerticalTabs(); | 1723 return browser_->tabstrip_model()->delegate()->UseVerticalTabs(); |
| 1719 } | 1724 } |
| 1720 | 1725 |
| 1726 - (void)showInstant:(TabContents*)previewContents { |
| 1727 [previewableContentsController_ showPreview:previewContents]; |
| 1728 [self updateBookmarkBarVisibilityWithAnimation:NO]; |
| 1729 } |
| 1730 |
| 1731 - (void)hideInstant { |
| 1732 // TODO(rohitrao): Revisit whether or not this method should be called when |
| 1733 // instant isn't showing. |
| 1734 if (![previewableContentsController_ isShowingPreview]) |
| 1735 return; |
| 1736 |
| 1737 [previewableContentsController_ hidePreview]; |
| 1738 [self updateBookmarkBarVisibilityWithAnimation:NO]; |
| 1739 } |
| 1740 |
| 1721 - (void)sheetDidEnd:(NSWindow*)sheet | 1741 - (void)sheetDidEnd:(NSWindow*)sheet |
| 1722 returnCode:(NSInteger)code | 1742 returnCode:(NSInteger)code |
| 1723 context:(void*)context { | 1743 context:(void*)context { |
| 1724 [sheet orderOut:self]; | 1744 [sheet orderOut:self]; |
| 1725 } | 1745 } |
| 1726 | 1746 |
| 1727 @end // @implementation BrowserWindowController | 1747 @end // @implementation BrowserWindowController |
| 1728 | 1748 |
| 1729 | 1749 |
| 1730 @implementation BrowserWindowController(Fullscreen) | 1750 @implementation BrowserWindowController(Fullscreen) |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 | 1995 |
| 1976 - (BOOL)supportsBookmarkBar { | 1996 - (BOOL)supportsBookmarkBar { |
| 1977 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 1997 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 1978 } | 1998 } |
| 1979 | 1999 |
| 1980 - (BOOL)isNormalWindow { | 2000 - (BOOL)isNormalWindow { |
| 1981 return browser_->type() == Browser::TYPE_NORMAL; | 2001 return browser_->type() == Browser::TYPE_NORMAL; |
| 1982 } | 2002 } |
| 1983 | 2003 |
| 1984 @end // @implementation BrowserWindowController(WindowType) | 2004 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |