| 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 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 [devToolsController_ updateDevToolsForWebContents:contents | 1544 [devToolsController_ updateDevToolsForWebContents:contents |
| 1545 withProfile:browser_->profile()]; | 1545 withProfile:browser_->profile()]; |
| 1546 | 1546 |
| 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 [infoBarContainerController_ changeWebContents:contents]; |
| 1555 // Without the .get(), xcode fails. | |
| 1556 [infoBarContainerController_.get() changeTabContents:tabContents]; | |
| 1557 | 1555 |
| 1558 [previewableContentsController_ onActivateTabWithContents:contents]; | 1556 [previewableContentsController_ onActivateTabWithContents:contents]; |
| 1559 } | 1557 } |
| 1560 | 1558 |
| 1561 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change | 1559 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change |
| 1562 withContents:(WebContents*)contents { | 1560 withContents:(WebContents*)contents { |
| 1563 // Update titles if this is the currently selected tab and if it isn't just | 1561 // Update titles if this is the currently selected tab and if it isn't just |
| 1564 // the loading state which changed. | 1562 // the loading state which changed. |
| 1565 if (change != TabStripModelObserver::LOADING_ONLY) | 1563 if (change != TabStripModelObserver::LOADING_ONLY) |
| 1566 windowShim_->UpdateTitleBar(); | 1564 windowShim_->UpdateTitleBar(); |
| 1567 | 1565 |
| 1568 // Update the bookmark bar if this is the currently selected tab and if it | 1566 // Update the bookmark bar if this is the currently selected tab and if it |
| 1569 // isn't just the title which changed. This for transitions between the NTP | 1567 // isn't just the title which changed. This for transitions between the NTP |
| 1570 // (showing its floating bookmark bar) and normal web pages (showing no | 1568 // (showing its floating bookmark bar) and normal web pages (showing no |
| 1571 // bookmark bar). | 1569 // bookmark bar). |
| 1572 // TODO(viettrungluu): perhaps update to not terminate running animations? | 1570 // TODO(viettrungluu): perhaps update to not terminate running animations? |
| 1573 if (change != TabStripModelObserver::TITLE_NOT_LOADING) | 1571 if (change != TabStripModelObserver::TITLE_NOT_LOADING) |
| 1574 [self updateBookmarkBarVisibilityWithAnimation:NO]; | 1572 [self updateBookmarkBarVisibilityWithAnimation:NO]; |
| 1575 } | 1573 } |
| 1576 | 1574 |
| 1577 - (void)onTabDetachedWithContents:(WebContents*)contents { | 1575 - (void)onTabDetachedWithContents:(WebContents*)contents { |
| 1578 TabContents* tabContents = TabContents::FromWebContents(contents); | 1576 [infoBarContainerController_ tabDetachedWithContents:contents]; |
| 1579 [infoBarContainerController_ tabDetachedWithContents:tabContents]; | |
| 1580 } | 1577 } |
| 1581 | 1578 |
| 1582 - (void)userChangedTheme { | 1579 - (void)userChangedTheme { |
| 1583 // TODO(dmaclach): Instead of redrawing the whole window, views that care | 1580 // TODO(dmaclach): Instead of redrawing the whole window, views that care |
| 1584 // about the active window state should be registering for notifications. | 1581 // about the active window state should be registering for notifications. |
| 1585 [[self window] setViewsNeedDisplay:YES]; | 1582 [[self window] setViewsNeedDisplay:YES]; |
| 1586 } | 1583 } |
| 1587 | 1584 |
| 1588 - (ui::ThemeProvider*)themeProvider { | 1585 - (ui::ThemeProvider*)themeProvider { |
| 1589 return ThemeServiceFactory::GetForProfile(browser_->profile()); | 1586 return ThemeServiceFactory::GetForProfile(browser_->profile()); |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2182 | 2179 |
| 2183 - (BOOL)supportsBookmarkBar { | 2180 - (BOOL)supportsBookmarkBar { |
| 2184 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2181 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2185 } | 2182 } |
| 2186 | 2183 |
| 2187 - (BOOL)isTabbedWindow { | 2184 - (BOOL)isTabbedWindow { |
| 2188 return browser_->is_type_tabbed(); | 2185 return browser_->is_type_tabbed(); |
| 2189 } | 2186 } |
| 2190 | 2187 |
| 2191 @end // @implementation BrowserWindowController(WindowType) | 2188 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |