OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 // TODO(viettrungluu): perhaps update to not terminate running animations (if | 1550 // TODO(viettrungluu): perhaps update to not terminate running animations (if |
1551 // applicable)? | 1551 // applicable)? |
1552 [self updateBookmarkBarVisibilityWithAnimation:NO]; | 1552 [self updateBookmarkBarVisibilityWithAnimation:NO]; |
1553 | 1553 |
1554 TabContents* tabContents = TabContents::FromWebContents(contents); | 1554 TabContents* tabContents = TabContents::FromWebContents(contents); |
1555 // Without the .get(), xcode fails. | 1555 // Without the .get(), xcode fails. |
1556 [infoBarContainerController_.get() changeTabContents:tabContents]; | 1556 [infoBarContainerController_.get() changeTabContents:tabContents]; |
1557 } | 1557 } |
1558 | 1558 |
1559 - (void)onReplaceTabWithContents:(WebContents*)contents { | 1559 - (void)onReplaceTabWithContents:(WebContents*)contents { |
1560 // Simply remove the preview view if it exists; the tab strip | 1560 [previewableContentsController_ onActivateTabWithContents:contents]; |
1561 // controller will reinstall the view as the active view. | |
1562 [previewableContentsController_ hidePreview]; | |
1563 [self updateBookmarkBarVisibilityWithAnimation:NO]; | 1561 [self updateBookmarkBarVisibilityWithAnimation:NO]; |
1564 } | 1562 } |
1565 | 1563 |
1566 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change | 1564 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change |
1567 withContents:(WebContents*)contents { | 1565 withContents:(WebContents*)contents { |
1568 // Update titles if this is the currently selected tab and if it isn't just | 1566 // Update titles if this is the currently selected tab and if it isn't just |
1569 // the loading state which changed. | 1567 // the loading state which changed. |
1570 if (change != TabStripModelObserver::LOADING_ONLY) | 1568 if (change != TabStripModelObserver::LOADING_ONLY) |
1571 windowShim_->UpdateTitleBar(); | 1569 windowShim_->UpdateTitleBar(); |
1572 | 1570 |
1573 // Update the bookmark bar if this is the currently selected tab and if it | 1571 // Update the bookmark bar if this is the currently selected tab and if it |
1574 // isn't just the title which changed. This for transitions between the NTP | 1572 // isn't just the title which changed. This for transitions between the NTP |
1575 // (showing its floating bookmark bar) and normal web pages (showing no | 1573 // (showing its floating bookmark bar) and normal web pages (showing no |
1576 // bookmark bar). | 1574 // bookmark bar). |
1577 // TODO(viettrungluu): perhaps update to not terminate running animations? | 1575 // TODO(viettrungluu): perhaps update to not terminate running animations? |
1578 if (change != TabStripModelObserver::TITLE_NOT_LOADING) | 1576 if (change != TabStripModelObserver::TITLE_NOT_LOADING) |
1579 [self updateBookmarkBarVisibilityWithAnimation:NO]; | 1577 [self updateBookmarkBarVisibilityWithAnimation:NO]; |
1580 } | 1578 } |
1581 | 1579 |
1582 - (void)onTabDetachedWithContents:(WebContents*)contents { | 1580 - (void)onTabDetachedWithContents:(WebContents*)contents { |
1583 TabContents* tabContents = TabContents::FromWebContents(contents); | 1581 TabContents* tabContents = TabContents::FromWebContents(contents); |
1584 [infoBarContainerController_ tabDetachedWithContents:tabContents]; | 1582 [infoBarContainerController_ tabDetachedWithContents:tabContents]; |
1585 } | 1583 } |
1586 | 1584 |
1587 - (void)onInsertTabWithContents:(WebContents*)contents { | 1585 - (void)onInsertTabWithContents:(WebContents*)contents { |
1588 [previewableContentsController_ onInsertTabWithContents:contents]; | 1586 [previewableContentsController_ onActivateTabWithContents:contents]; |
1589 } | 1587 } |
1590 | 1588 |
1591 - (void)userChangedTheme { | 1589 - (void)userChangedTheme { |
1592 // TODO(dmaclach): Instead of redrawing the whole window, views that care | 1590 // TODO(dmaclach): Instead of redrawing the whole window, views that care |
1593 // about the active window state should be registering for notifications. | 1591 // about the active window state should be registering for notifications. |
1594 [[self window] setViewsNeedDisplay:YES]; | 1592 [[self window] setViewsNeedDisplay:YES]; |
1595 } | 1593 } |
1596 | 1594 |
1597 - (ui::ThemeProvider*)themeProvider { | 1595 - (ui::ThemeProvider*)themeProvider { |
1598 return ThemeServiceFactory::GetForProfile(browser_->profile()); | 1596 return ThemeServiceFactory::GetForProfile(browser_->profile()); |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 | 2189 |
2192 - (BOOL)supportsBookmarkBar { | 2190 - (BOOL)supportsBookmarkBar { |
2193 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2191 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2194 } | 2192 } |
2195 | 2193 |
2196 - (BOOL)isTabbedWindow { | 2194 - (BOOL)isTabbedWindow { |
2197 return browser_->is_type_tabbed(); | 2195 return browser_->is_type_tabbed(); |
2198 } | 2196 } |
2199 | 2197 |
2200 @end // @implementation BrowserWindowController(WindowType) | 2198 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |