Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 11305008: Remove TabContents from TabStripModelObserverBridge. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no crashes Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 1556
1559 - (void)onReplaceTabWithContents:(WebContents*)contents { 1557 - (void)onReplaceTabWithContents:(WebContents*)contents {
1560 // Simply remove the preview view if it exists; the tab strip 1558 // Simply remove the preview view if it exists; the tab strip
1561 // controller will reinstall the view as the active view. 1559 // controller will reinstall the view as the active view.
1562 [previewableContentsController_ hidePreview]; 1560 [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 [infoBarContainerController_ tabDetachedWithContents:contents];
1584 [infoBarContainerController_ tabDetachedWithContents:tabContents];
1585 } 1582 }
1586 1583
1587 - (void)onInsertTabWithContents:(WebContents*)contents { 1584 - (void)onInsertTabWithContents:(WebContents*)contents {
1588 [previewableContentsController_ onInsertTabWithContents:contents]; 1585 [previewableContentsController_ onInsertTabWithContents:contents];
1589 } 1586 }
1590 1587
1591 - (void)userChangedTheme { 1588 - (void)userChangedTheme {
1592 // TODO(dmaclach): Instead of redrawing the whole window, views that care 1589 // TODO(dmaclach): Instead of redrawing the whole window, views that care
1593 // about the active window state should be registering for notifications. 1590 // about the active window state should be registering for notifications.
1594 [[self window] setViewsNeedDisplay:YES]; 1591 [[self window] setViewsNeedDisplay:YES];
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 2188
2192 - (BOOL)supportsBookmarkBar { 2189 - (BOOL)supportsBookmarkBar {
2193 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2190 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2194 } 2191 }
2195 2192
2196 - (BOOL)isTabbedWindow { 2193 - (BOOL)isTabbedWindow {
2197 return browser_->is_type_tabbed(); 2194 return browser_->is_type_tabbed();
2198 } 2195 }
2199 2196
2200 @end // @implementation BrowserWindowController(WindowType) 2197 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698