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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 9085006: Replace Browser::GetTabContentsAt with GetWebContentsAt and update all callers. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac yet again Created 8 years, 12 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
===================================================================
--- chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm (revision 116244)
+++ chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm (working copy)
@@ -51,10 +51,10 @@
#include "chrome/browser/ui/tabs/tab_menu_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/user_metrics.h"
+#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "grit/theme_resources_standard.h"
@@ -69,6 +69,7 @@
using content::OpenURLParams;
using content::Referrer;
using content::UserMetricsAction;
+using content::WebContents;
NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged";
@@ -502,7 +503,7 @@
}
// New content is in place, delegate should adjust itself accordingly.
- [delegate_ onActivateTabWithContents:[controller tabContents]];
+ [delegate_ onActivateTabWithContents:[controller webContents]];
// It also restores content autoresizing properties.
[controller ensureContentsVisible];
@@ -1095,7 +1096,7 @@
// Handles setting the title of the tab based on the given |contents|. Uses
// a canned string if |contents| is NULL.
-- (void)setTabTitle:(NSViewController*)tab withContents:(TabContents*)contents {
+- (void)setTabTitle:(NSViewController*)tab withContents:(WebContents*)contents {
NSString* titleString = nil;
if (contents)
titleString = base::SysUTF16ToNSString(contents->GetTitle());
@@ -1123,7 +1124,7 @@
// Make a new tab. Load the contents of this tab from the nib and associate
// the new controller with |contents| so it can be looked up later.
scoped_nsobject<TabContentsController> contentsController(
- [[TabContentsController alloc] initWithContents:contents->tab_contents()
+ [[TabContentsController alloc] initWithContents:contents->web_contents()
delegate:self]);
[tabContentsArray_ insertObject:contentsController atIndex:index];
@@ -1132,7 +1133,7 @@
[newController setMini:tabStripModel_->IsMiniTab(modelIndex)];
[newController setPinned:tabStripModel_->IsTabPinned(modelIndex)];
[newController setApp:tabStripModel_->IsAppTab(modelIndex)];
- [newController setUrl:contents->tab_contents()->GetURL()];
+ [newController setUrl:contents->web_contents()->GetURL()];
[tabArray_ insertObject:newController atIndex:index];
NSView* newView = [newController view];
@@ -1142,7 +1143,7 @@
[newView setFrame:NSOffsetRect([newView frame],
0, -[[self class] defaultTabHeight])];
- [self setTabTitle:newController withContents:contents->tab_contents()];
+ [self setTabTitle:newController withContents:contents->web_contents()];
// If a tab is being inserted, we can again use the entire tab strip width
// for layout.
@@ -1179,14 +1180,14 @@
if (oldContents) {
int oldModelIndex = browser_->GetIndexOfController(
- &(oldContents->tab_contents()->GetController()));
+ &(oldContents->web_contents()->GetController()));
if (oldModelIndex != -1) { // When closing a tab, the old tab may be gone.
NSInteger oldIndex = [self indexFromModelIndex:oldModelIndex];
TabContentsController* oldController =
[tabContentsArray_ objectAtIndex:oldIndex];
[oldController willBecomeUnselectedTab];
- oldContents->tab_contents()->GetView()->StoreFocus();
- oldContents->tab_contents()->WasHidden();
+ oldContents->web_contents()->GetView()->StoreFocus();
+ oldContents->web_contents()->WasHidden();
}
}
@@ -1221,8 +1222,8 @@
[self swapInTabAtIndex:modelIndex];
if (newContents) {
- newContents->tab_contents()->DidBecomeSelected();
- newContents->tab_contents()->GetView()->RestoreFocus();
+ newContents->web_contents()->DidBecomeSelected();
+ newContents->web_contents()->GetView()->RestoreFocus();
if (newContents->find_tab_helper()->find_ui_active())
browser_->GetFindBarController()->find_bar()->SetFocusAndSelection();
@@ -1235,20 +1236,20 @@
NSInteger index = [self indexFromModelIndex:modelIndex];
TabContentsController* oldController =
[tabContentsArray_ objectAtIndex:index];
- DCHECK_EQ(oldContents->tab_contents(), [oldController tabContents]);
+ DCHECK_EQ(oldContents->web_contents(), [oldController webContents]);
// Simply create a new TabContentsController for |newContents| and place it
// into the array, replacing |oldContents|. A ActiveTabChanged notification
// will follow, at which point we will install the new view.
scoped_nsobject<TabContentsController> newController(
[[TabContentsController alloc]
- initWithContents:newContents->tab_contents()
+ initWithContents:newContents->web_contents()
delegate:self]);
// Bye bye, |oldController|.
[tabContentsArray_ replaceObjectAtIndex:index withObject:newController];
- [delegate_ onReplaceTabWithContents:newContents->tab_contents()];
+ [delegate_ onReplaceTabWithContents:newContents->web_contents()];
// Fake a tab changed notification to force tab titles and favicons to update.
[self tabChangedWithContents:newContents
@@ -1366,7 +1367,7 @@
postNotificationName:kTabStripNumberOfTabsChanged
object:self];
- [delegate_ onTabDetachedWithContents:contents->tab_contents()];
+ [delegate_ onTabDetachedWithContents:contents->web_contents()];
}
// A helper routine for creating an NSImageView to hold the favicon or app icon
@@ -1423,13 +1424,13 @@
TabLoadingState oldState = [tabController loadingState];
TabLoadingState newState = kTabDone;
NSImage* throbberImage = nil;
- if (contents->tab_contents()->IsCrashed()) {
+ if (contents->web_contents()->IsCrashed()) {
newState = kTabCrashed;
newHasIcon = true;
- } else if (contents->tab_contents()->IsWaitingForResponse()) {
+ } else if (contents->web_contents()->IsWaitingForResponse()) {
newState = kTabWaiting;
throbberImage = throbberWaitingImage;
- } else if (contents->tab_contents()->IsLoading()) {
+ } else if (contents->web_contents()->IsLoading()) {
newState = kTabLoading;
throbberImage = throbberLoadingImage;
}
@@ -1476,7 +1477,7 @@
NSInteger index = [self indexFromModelIndex:modelIndex];
if (modelIndex == tabStripModel_->active_index())
- [delegate_ onTabChanged:change withContents:contents->tab_contents()];
+ [delegate_ onTabChanged:change withContents:contents->web_contents()];
if (change == TabStripModelObserver::TITLE_NOT_LOADING) {
// TODO(sky): make this work.
@@ -1487,13 +1488,13 @@
TabController* tabController = [tabArray_ objectAtIndex:index];
if (change != TabStripModelObserver::LOADING_ONLY)
- [self setTabTitle:tabController withContents:contents->tab_contents()];
+ [self setTabTitle:tabController withContents:contents->web_contents()];
[self updateFaviconForContents:contents atIndex:modelIndex];
TabContentsController* updatedController =
[tabContentsArray_ objectAtIndex:index];
- [updatedController tabDidChange:contents->tab_contents()];
+ [updatedController tabDidChange:contents->web_contents()];
}
// Called when a tab is moved (usually by drag&drop). Keep our parallel arrays
@@ -1543,7 +1544,7 @@
[tabController setMini:tabStripModel_->IsMiniTab(modelIndex)];
[tabController setPinned:tabStripModel_->IsTabPinned(modelIndex)];
[tabController setApp:tabStripModel_->IsAppTab(modelIndex)];
- [tabController setUrl:contents->tab_contents()->GetURL()];
+ [tabController setUrl:contents->web_contents()->GetURL()];
[self updateFaviconForContents:contents atIndex:modelIndex];
// If the tab is being restored and it's pinned, the mini state is set after
// the tab has already been rendered, so re-layout the tabstrip. In all other
@@ -1886,7 +1887,7 @@
content::RecordAction(UserMetricsAction("Tab_DropURLOnTab"));
OpenURLParams params(
*url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false);
- tabStripModel_->GetTabContentsAt(index)->tab_contents()->OpenURL(params);
+ tabStripModel_->GetTabContentsAt(index)->web_contents()->OpenURL(params);
tabStripModel_->ActivateTabAt(index, true);
break;
default:
@@ -2056,7 +2057,7 @@
// We use the TabContentsController's view in |swapInTabAtIndex|, so we have
// to pass it to the sheet controller here.
NSView* tabContentsView =
- [window->owner()->tab_contents()->GetNativeView() superview];
+ [window->owner()->web_contents()->GetNativeView() superview];
window->delegate()->RunSheet([self sheetController], tabContentsView);
// TODO(avi, thakis): GTMWindowSheetController has no api to move tabsheets
@@ -2075,7 +2076,7 @@
- (void)removeConstrainedWindow:(ConstrainedWindowMac*)window {
NSView* tabContentsView =
- [window->owner()->tab_contents()->GetNativeView() superview];
+ [window->owner()->web_contents()->GetNativeView() superview];
// TODO(avi, thakis): GTMWindowSheetController has no api to move tabsheets
// between windows. Until then, we have to prevent having to move a tabsheet
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.h ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698