| 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 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 // Update the bookmark bar. | 1547 // Update the bookmark bar. |
| 1548 // Must do it after devtools updates, otherwise bookmark bar might | 1548 // Must do it after devtools updates, otherwise bookmark bar might |
| 1549 // call resizeView -> layoutSubviews and cause unnecessary relayout. | 1549 // call resizeView -> layoutSubviews and cause unnecessary relayout. |
| 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 } | |
| 1558 | 1557 |
| 1559 - (void)onReplaceTabWithContents:(WebContents*)contents { | 1558 [previewableContentsController_ onActivateTabWithContents:contents]; |
| 1560 // Simply remove the preview view if it exists; the tab strip | |
| 1561 // controller will reinstall the view as the active view. | |
| 1562 [previewableContentsController_ hidePreview]; | |
| 1563 [self updateBookmarkBarVisibilityWithAnimation:NO]; | |
| 1564 } | 1559 } |
| 1565 | 1560 |
| 1566 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change | 1561 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change |
| 1567 withContents:(WebContents*)contents { | 1562 withContents:(WebContents*)contents { |
| 1568 // Update titles if this is the currently selected tab and if it isn't just | 1563 // Update titles if this is the currently selected tab and if it isn't just |
| 1569 // the loading state which changed. | 1564 // the loading state which changed. |
| 1570 if (change != TabStripModelObserver::LOADING_ONLY) | 1565 if (change != TabStripModelObserver::LOADING_ONLY) |
| 1571 windowShim_->UpdateTitleBar(); | 1566 windowShim_->UpdateTitleBar(); |
| 1572 | 1567 |
| 1573 // Update the bookmark bar if this is the currently selected tab and if it | 1568 // 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 | 1569 // 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 | 1570 // (showing its floating bookmark bar) and normal web pages (showing no |
| 1576 // bookmark bar). | 1571 // bookmark bar). |
| 1577 // TODO(viettrungluu): perhaps update to not terminate running animations? | 1572 // TODO(viettrungluu): perhaps update to not terminate running animations? |
| 1578 if (change != TabStripModelObserver::TITLE_NOT_LOADING) | 1573 if (change != TabStripModelObserver::TITLE_NOT_LOADING) |
| 1579 [self updateBookmarkBarVisibilityWithAnimation:NO]; | 1574 [self updateBookmarkBarVisibilityWithAnimation:NO]; |
| 1580 } | 1575 } |
| 1581 | 1576 |
| 1582 - (void)onTabDetachedWithContents:(WebContents*)contents { | 1577 - (void)onTabDetachedWithContents:(WebContents*)contents { |
| 1583 TabContents* tabContents = TabContents::FromWebContents(contents); | 1578 TabContents* tabContents = TabContents::FromWebContents(contents); |
| 1584 [infoBarContainerController_ tabDetachedWithContents:tabContents]; | 1579 [infoBarContainerController_ tabDetachedWithContents:tabContents]; |
| 1585 } | 1580 } |
| 1586 | 1581 |
| 1587 - (void)onInsertTabWithContents:(WebContents*)contents { | |
| 1588 [previewableContentsController_ onInsertTabWithContents:contents]; | |
| 1589 } | |
| 1590 | |
| 1591 - (void)userChangedTheme { | 1582 - (void)userChangedTheme { |
| 1592 // TODO(dmaclach): Instead of redrawing the whole window, views that care | 1583 // TODO(dmaclach): Instead of redrawing the whole window, views that care |
| 1593 // about the active window state should be registering for notifications. | 1584 // about the active window state should be registering for notifications. |
| 1594 [[self window] setViewsNeedDisplay:YES]; | 1585 [[self window] setViewsNeedDisplay:YES]; |
| 1595 } | 1586 } |
| 1596 | 1587 |
| 1597 - (ui::ThemeProvider*)themeProvider { | 1588 - (ui::ThemeProvider*)themeProvider { |
| 1598 return ThemeServiceFactory::GetForProfile(browser_->profile()); | 1589 return ThemeServiceFactory::GetForProfile(browser_->profile()); |
| 1599 } | 1590 } |
| 1600 | 1591 |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 | 2182 |
| 2192 - (BOOL)supportsBookmarkBar { | 2183 - (BOOL)supportsBookmarkBar { |
| 2193 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2184 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2194 } | 2185 } |
| 2195 | 2186 |
| 2196 - (BOOL)isTabbedWindow { | 2187 - (BOOL)isTabbedWindow { |
| 2197 return browser_->is_type_tabbed(); | 2188 return browser_->is_type_tabbed(); |
| 2198 } | 2189 } |
| 2199 | 2190 |
| 2200 @end // @implementation BrowserWindowController(WindowType) | 2191 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |