diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-11 16:47:32 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-11 16:47:32 +0000 |
commit | 55eed87f269c81fa2f34586d7bf76f2666801862 (patch) | |
tree | 96c3a0246f123bbdc13c9a511324e455cb455bcb | |
parent | 9b76dad05919e47b56b54f40b9a1e46cafd2ebd3 (diff) | |
download | chromium_src-55eed87f269c81fa2f34586d7bf76f2666801862.zip chromium_src-55eed87f269c81fa2f34586d7bf76f2666801862.tar.gz chromium_src-55eed87f269c81fa2f34586d7bf76f2666801862.tar.bz2 |
TabContentsWrapper -> TabContents, part 37.
browser/ui/cocoa
BUG=131026
TEST=no change
Review URL: https://chromiumcodereview.appspot.com/10534093
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141421 0039d316-1c4b-4281-b951-d872f2087c98
53 files changed, 268 insertions, 280 deletions
diff --git a/chrome/browser/ui/cocoa/applescript/tab_applescript.h b/chrome/browser/ui/cocoa/applescript/tab_applescript.h index dd31941..41a3fd5c 100644 --- a/chrome/browser/ui/cocoa/applescript/tab_applescript.h +++ b/chrome/browser/ui/cocoa/applescript/tab_applescript.h @@ -10,12 +10,11 @@ #import "chrome/browser/ui/cocoa/applescript/element_applescript.h" class TabContents; -typedef TabContents TabContentsWrapper; // Represents a tab scriptable item in applescript. @interface TabAppleScript : ElementAppleScript { @private - TabContentsWrapper* tabContents_; // weak. + TabContents* tabContents_; // weak. // Contains the temporary URL when a user creates a new folder/item with // url specified like // |make new tab with properties {url:"http://google.com"}|. @@ -28,10 +27,10 @@ typedef TabContents TabContentsWrapper; - (id)init; // Does not create a new tab but uses an existing one. -- (id)initWithTabContent:(TabContentsWrapper*)aTabContent; +- (id)initWithTabContent:(TabContents*)aTabContent; // Assigns a tab, sets its unique ID and also copies temporary values. -- (void)setTabContent:(TabContentsWrapper*)aTabContent; +- (void)setTabContent:(TabContents*)aTabContent; // Return the URL currently visible to the user in the location bar. - (NSString*)URL; diff --git a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm index 7da5e66..5d7e98c 100644 --- a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm @@ -16,7 +16,7 @@ #include "chrome/browser/sessions/restore_tab_helper.h" #include "chrome/browser/sessions/session_id.h" #include "chrome/browser/ui/cocoa/applescript/error_applescript.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/url_constants.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" @@ -154,7 +154,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { [super dealloc]; } -- (id)initWithTabContent:(TabContentsWrapper*)aTabContent { +- (id)initWithTabContent:(TabContents*)aTabContent { if (!aTabContent) { [self release]; return nil; @@ -173,7 +173,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { return self; } -- (void)setTabContent:(TabContentsWrapper*)aTabContent { +- (void)setTabContent:(TabContents*)aTabContent { DCHECK(aTabContent); // It is safe to be weak, if a tab goes away (eg user closing a tab) // the applescript runtime calls tabs in AppleScriptWindow and this diff --git a/chrome/browser/ui/cocoa/applescript/window_applescript.mm b/chrome/browser/ui/cocoa/applescript/window_applescript.mm index 9270cae..e94e795 100644 --- a/chrome/browser/ui/cocoa/applescript/window_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/window_applescript.mm @@ -18,7 +18,7 @@ #include "chrome/browser/ui/cocoa/applescript/constants_applescript.h" #include "chrome/browser/ui/cocoa/applescript/error_applescript.h" #import "chrome/browser/ui/cocoa/applescript/tab_applescript.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/url_constants.h" #include "content/public/browser/web_contents.h" @@ -138,7 +138,7 @@ - (TabAppleScript*)activeTab { TabAppleScript* currentTab = [[[TabAppleScript alloc] - initWithTabContent:browser_->GetSelectedTabContentsWrapper()] + initWithTabContent:browser_->GetActiveTabContents()] autorelease]; [currentTab setContainer:self property:AppleScript::kTabsProperty]; @@ -151,7 +151,7 @@ for (int i = 0; i < browser_->tab_count(); ++i) { // Check to see if tab is closing. - TabContentsWrapper* tab_contents = browser_->GetTabContentsWrapperAt(i); + TabContents* tab_contents = browser_->GetTabContentsAt(i); if (tab_contents->in_destructor()) { continue; } @@ -173,7 +173,7 @@ // Set how long it takes a tab to be created. base::TimeTicks newTabStartTime = base::TimeTicks::Now(); - TabContentsWrapper* contents = + TabContents* contents = browser_->AddSelectedTabWithURL(GURL(chrome::kChromeUINewTabURL), content::PAGE_TRANSITION_TYPED); contents->web_contents()->SetNewTabStartTime(newTabStartTime); diff --git a/chrome/browser/ui/cocoa/base_bubble_controller.mm b/chrome/browser/ui/cocoa/base_bubble_controller.mm index 9ac3749..fc6738a 100644 --- a/chrome/browser/ui/cocoa/base_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/base_bubble_controller.mm @@ -18,8 +18,8 @@ @interface BaseBubbleController (Private) - (void)updateOriginFromAnchor; -- (void)activateTabWithContents:(TabContentsWrapper*)newContents - previousContents:(TabContentsWrapper*)oldContents +- (void)activateTabWithContents:(TabContents*)newContents + previousContents:(TabContents*)oldContents atIndex:(NSInteger)index userGesture:(bool)wasUserGesture; @end @@ -291,8 +291,8 @@ typedef unsigned long long NSEventMask; [window setFrameOrigin:origin]; } -- (void)activateTabWithContents:(TabContentsWrapper*)newContents - previousContents:(TabContentsWrapper*)oldContents +- (void)activateTabWithContents:(TabContents*)newContents + previousContents:(TabContents*)oldContents atIndex:(NSInteger)index userGesture:(bool)wasUserGesture { // The user switched tabs; close. diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm index 86b62f8..92888ae 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm @@ -9,7 +9,7 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm index a328e3d..10be7e1 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm @@ -2288,7 +2288,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { #pragma mark BookmarkBarToolbarViewController Protocol - (int)currentTabContentsHeight { - WebContents* wc = browser_->GetSelectedWebContents(); + WebContents* wc = browser_->GetActiveWebContents(); return wc ? wc->GetView()->GetContainerSize().height() : 0; } diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h index 3b5945b..e9b5fd6 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.h +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h @@ -78,7 +78,7 @@ class BrowserWindowCocoa : public BrowserWindow, virtual LocationBar* GetLocationBar() const OVERRIDE; virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; virtual void UpdateReloadStopState(bool is_loading, bool force) OVERRIDE; - virtual void UpdateToolbar(TabContentsWrapper* contents, + virtual void UpdateToolbar(TabContents* contents, bool should_restore_state) OVERRIDE; virtual void FocusToolbar() OVERRIDE; virtual void FocusAppMenu() OVERRIDE; @@ -115,7 +115,7 @@ class BrowserWindowCocoa : public BrowserWindow, const content::SSLStatus& ssl, bool show_history) OVERRIDE; virtual void ShowWebsiteSettings(Profile* profile, - TabContentsWrapper* tab_contents_wrapper, + TabContents* tab_contents, const GURL& url, const content::SSLStatus& ssl, bool show_history) OVERRIDE; @@ -126,7 +126,7 @@ class BrowserWindowCocoa : public BrowserWindow, virtual void HandleKeyboardEvent( const content::NativeWebKeyboardEvent& event) OVERRIDE; virtual void ShowCreateWebAppShortcutsDialog( - TabContentsWrapper* tab_contents) OVERRIDE; + TabContents* tab_contents) OVERRIDE; virtual void ShowCreateChromeAppShortcutsDialog( Profile* profile, const extensions::Extension* app) OVERRIDE; @@ -139,7 +139,7 @@ class BrowserWindowCocoa : public BrowserWindow, FullscreenExitBubbleType bubble_type) OVERRIDE; virtual void ExitPresentationMode() OVERRIDE; virtual bool InPresentationMode() OVERRIDE; - virtual void ShowInstant(TabContentsWrapper* preview) OVERRIDE; + virtual void ShowInstant(TabContents* preview) OVERRIDE; virtual void HideInstant() OVERRIDE; virtual gfx::Rect GetInstantBounds() OVERRIDE; virtual WindowOpenDisposition GetDispositionForPopupBounds( diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm index c9dfa6a..69c7f13 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm @@ -34,7 +34,7 @@ #include "chrome/browser/ui/cocoa/task_manager_mac.h" #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" #include "chrome/browser/ui/page_info_bubble.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/public/browser/notification_source.h" @@ -237,7 +237,7 @@ void BrowserWindowCocoa::BookmarkBarStateChanged( void BrowserWindowCocoa::UpdateDevTools() { [controller_ updateDevToolsForContents: - browser_->GetSelectedWebContents()]; + browser_->GetActiveWebContents()]; } void BrowserWindowCocoa::SetDevToolsDockSide(DevToolsDockSide side) { @@ -353,7 +353,7 @@ void BrowserWindowCocoa::UpdateReloadStopState(bool is_loading, bool force) { [controller_ setIsLoading:is_loading force:force]; } -void BrowserWindowCocoa::UpdateToolbar(TabContentsWrapper* contents, +void BrowserWindowCocoa::UpdateToolbar(TabContents* contents, bool should_restore_state) { [controller_ updateToolbarWithContents:contents->web_contents() shouldRestoreState:should_restore_state ? YES : NO]; @@ -497,7 +497,7 @@ void BrowserWindowCocoa::ShowPageInfo(Profile* profile, void BrowserWindowCocoa::ShowWebsiteSettings( Profile* profile, - TabContentsWrapper* tab_contents_wrapper, + TabContents* tab_contents, const GURL& url, const content::SSLStatus& ssl, bool show_history) { @@ -533,7 +533,7 @@ void BrowserWindowCocoa::HandleKeyboardEvent( } void BrowserWindowCocoa::ShowCreateWebAppShortcutsDialog( - TabContentsWrapper* tab_contents) { + TabContents* tab_contents) { NOTIMPLEMENTED(); } @@ -573,7 +573,7 @@ bool BrowserWindowCocoa::InPresentationMode() { return [controller_ inPresentationMode]; } -void BrowserWindowCocoa::ShowInstant(TabContentsWrapper* preview) { +void BrowserWindowCocoa::ShowInstant(TabContents* preview) { [controller_ showInstant:preview->web_contents()]; } diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index 972892e..4ed02fd 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -57,7 +57,7 @@ #import "chrome/browser/ui/cocoa/tabs/tab_view.h" #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" #include "chrome/browser/ui/omnibox/location_bar.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tabs/dock_info.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" @@ -593,7 +593,7 @@ enum { - (void)windowDidBecomeKey:(NSNotification*)notification { // We need to activate the controls (in the "WebView"). To do this, get the // selected WebContents's RenderWidgetHostView and tell it to activate. - if (WebContents* contents = browser_->GetSelectedWebContents()) { + if (WebContents* contents = browser_->GetActiveWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetActive(true); } @@ -610,7 +610,7 @@ enum { // We need to deactivate the controls (in the "WebView"). To do this, get the // selected WebContents's RenderWidgetHostView and tell it to deactivate. - if (WebContents* contents = browser_->GetSelectedWebContents()) { + if (WebContents* contents = browser_->GetActiveWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetActive(false); } @@ -621,7 +621,7 @@ enum { [self saveWindowPositionIfNeeded]; // Let the selected RenderWidgetHostView know, so that it can tell plugins. - if (WebContents* contents = browser_->GetSelectedWebContents()) { + if (WebContents* contents = browser_->GetActiveWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetWindowVisibility(false); } @@ -630,7 +630,7 @@ enum { // Called when we have been unminimized. - (void)windowDidDeminiaturize:(NSNotification *)notification { // Let the selected RenderWidgetHostView know, so that it can tell plugins. - if (WebContents* contents = browser_->GetSelectedWebContents()) { + if (WebContents* contents = browser_->GetActiveWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetWindowVisibility(true); } @@ -641,7 +641,7 @@ enum { // Let the selected RenderWidgetHostView know, so that it can tell plugins // (unless we are minimized, in which case nothing has really changed). if (![[self window] isMiniaturized]) { - if (WebContents* contents = browser_->GetSelectedWebContents()) { + if (WebContents* contents = browser_->GetActiveWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetWindowVisibility(false); } @@ -653,7 +653,7 @@ enum { // Let the selected RenderWidgetHostView know, so that it can tell plugins // (unless we are minimized, in which case nothing has really changed). if (![[self window] isMiniaturized]) { - if (WebContents* contents = browser_->GetSelectedWebContents()) { + if (WebContents* contents = browser_->GetActiveWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetWindowVisibility(true); } @@ -698,7 +698,7 @@ enum { std::max(kProportion * NSWidth(frame), std::min(kProportion * NSHeight(frame), NSWidth(frame))); - WebContents* contents = browser_->GetSelectedWebContents(); + WebContents* contents = browser_->GetActiveWebContents(); if (contents) { // If the intrinsic width is bigger, then make it the zoomed width. const int kScrollbarWidth = 16; // TODO(viettrungluu): ugh. @@ -935,7 +935,7 @@ enum { if (resizeRectDirty) { // Send new resize rect to foreground tab. - if (content::WebContents* contents = browser_->GetSelectedWebContents()) { + if (content::WebContents* contents = browser_->GetActiveWebContents()) { if (content::RenderViewHost* rvh = contents->GetRenderViewHost()) { rvh->ResizeRectChanged(windowShim_->GetRootWindowResizerRect()); } @@ -975,7 +975,7 @@ enum { DCHECK(browser_.get()); Profile* profile = browser_->profile(); DCHECK(profile); - WebContents* current_tab = browser_->GetSelectedWebContents(); + WebContents* current_tab = browser_->GetActiveWebContents(); if (!current_tab) { return; } @@ -1228,8 +1228,7 @@ enum { if (!isBrowser) return; BrowserWindowController* dragBWC = (BrowserWindowController*)dragController; int index = [dragBWC->tabStripController_ modelIndexForTabView:view]; - TabContentsWrapper* contents = - dragBWC->browser_->GetTabContentsWrapperAt(index); + TabContents* contents = dragBWC->browser_->GetTabContentsAt(index); // The tab contents may have gone away if given a window.close() while it // is being dragged. If so, bail, we've got nothing to drop. if (!contents) @@ -1307,7 +1306,7 @@ enum { // Fetch the tab contents for the tab being dragged. int index = [tabStripController_ modelIndexForTabView:tabView]; - TabContentsWrapper* contents = browser_->GetTabContentsWrapperAt(index); + TabContents* contents = browser_->GetTabContentsAt(index); // Set the window size. Need to do this before we detach the tab so it's // still in the window. We have to flip the coordinates as that's what @@ -1490,7 +1489,7 @@ enum { } - (NSString*)activeTabTitle { - WebContents* contents = browser_->GetSelectedWebContents(); + WebContents* contents = browser_->GetActiveWebContents(); return base::SysUTF16ToNSString(contents->GetTitle()); } @@ -1522,10 +1521,9 @@ enum { // applicable)? [self updateBookmarkBarVisibilityWithAnimation:NO]; - TabContentsWrapper* wrapper = - TabContentsWrapper::GetCurrentWrapperForContents(contents); + TabContents* tabContents = TabContents::FromWebContents(contents); // Without the .get(), xcode fails. - [infoBarContainerController_.get() changeTabContents:wrapper]; + [infoBarContainerController_.get() changeTabContents:tabContents]; } - (void)onReplaceTabWithContents:(WebContents*)contents { @@ -1552,9 +1550,8 @@ enum { } - (void)onTabDetachedWithContents:(WebContents*)contents { - TabContentsWrapper* wrapper = - TabContentsWrapper::GetCurrentWrapperForContents(contents); - [infoBarContainerController_ tabDetachedWithContents:wrapper]; + TabContents* tabContents = TabContents::FromWebContents(contents); + [infoBarContainerController_ tabDetachedWithContents:tabContents]; } - (void)userChangedTheme { @@ -1760,7 +1757,7 @@ enum { } // Let the selected RenderWidgetHostView know, so that it can tell plugins. - if (WebContents* contents = browser_->GetSelectedWebContents()) { + if (WebContents* contents = browser_->GetActiveWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->WindowFrameChanged(); } @@ -1814,7 +1811,7 @@ enum { [self resetWindowGrowthState]; // Let the selected RenderWidgetHostView know, so that it can tell plugins. - if (WebContents* contents = browser_->GetSelectedWebContents()) { + if (WebContents* contents = browser_->GetActiveWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->WindowFrameChanged(); } diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm index 07d14be..f517536 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm @@ -28,7 +28,7 @@ #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/pref_names.h" #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/web_contents.h" @@ -524,7 +524,7 @@ willPositionSheet:(NSWindow*)sheet // If the relayout shifts the content area up or down, let the renderer know. if (contentShifted) { - if (WebContents* contents = browser_->GetSelectedWebContents()) { + if (WebContents* contents = browser_->GetActiveWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->WindowFrameChanged(); } @@ -539,7 +539,7 @@ willPositionSheet:(NSWindow*)sheet - (BOOL)shouldShowDetachedBookmarkBar { DCHECK(browser_.get()); - TabContentsWrapper* tab = browser_->GetSelectedTabContentsWrapper(); + TabContents* tab = browser_->GetActiveTabContents(); return (tab && tab->bookmark_tab_helper()->ShouldShowBookmarkBar() && ![previewableContentsController_ isShowingPreview]); } diff --git a/chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm b/chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm index c50db2f..77a42a0 100644 --- a/chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm +++ b/chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm @@ -8,7 +8,7 @@ #include "base/memory/scoped_nsobject.h" #include "chrome/browser/ui/cocoa/constrained_window_mac.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" #include "content/public/browser/web_contents.h" #include "ui/gfx/size.h" @@ -51,7 +51,7 @@ class ConstrainedWebDialogDelegateMac : virtual ConstrainedWindow* window() OVERRIDE { return impl_->window(); } - virtual TabContentsWrapper* tab() OVERRIDE { + virtual TabContents* tab() OVERRIDE { return impl_->tab(); } @@ -120,14 +120,14 @@ ConstrainedWebDialogDelegate* ui::CreateConstrainedWebDialog( Profile* profile, WebDialogDelegate* delegate, WebDialogWebContentsDelegate* tab_delegate, - TabContentsWrapper* wrapper) { + TabContents* tab_contents) { // Deleted when ConstrainedWebDialogDelegateMac::DeleteDelegate() runs. ConstrainedWebDialogDelegateMac* constrained_delegate = new ConstrainedWebDialogDelegateMac(profile, delegate, tab_delegate); // Deleted when ConstrainedWebDialogDelegateMac::OnDialogCloseFromWebUI() // runs. ConstrainedWindow* constrained_window = - new ConstrainedWindowMac(wrapper, constrained_delegate); + new ConstrainedWindowMac(tab_contents, constrained_delegate); constrained_delegate->set_window(constrained_window); return constrained_delegate; } diff --git a/chrome/browser/ui/cocoa/constrained_window_mac.h b/chrome/browser/ui/cocoa/constrained_window_mac.h index 93b0b5d..64428aa 100644 --- a/chrome/browser/ui/cocoa/constrained_window_mac.h +++ b/chrome/browser/ui/cocoa/constrained_window_mac.h @@ -18,7 +18,6 @@ @class NSView; @class NSWindow; class TabContents; -typedef TabContents TabContentsWrapper; // Base class for constrained dialog delegates. Never inherit from this // directly. @@ -111,7 +110,7 @@ class ConstrainedWindowMacDelegateCustomSheet // deleted. class ConstrainedWindowMac : public ConstrainedWindow { public: - ConstrainedWindowMac(TabContentsWrapper* wrapper, + ConstrainedWindowMac(TabContents* tab_contents, ConstrainedWindowMacDelegate* delegate); virtual ~ConstrainedWindowMac(); @@ -119,8 +118,8 @@ class ConstrainedWindowMac : public ConstrainedWindow { virtual void ShowConstrainedWindow() OVERRIDE; virtual void CloseConstrainedWindow() OVERRIDE; - // Returns the TabContentsWrapper that constrains this Constrained Window. - TabContentsWrapper* owner() const { return wrapper_; } + // Returns the TabContents that constrains this Constrained Window. + TabContents* owner() const { return tab_contents_; } // Returns the window's delegate. ConstrainedWindowMacDelegate* delegate() { return delegate_; } @@ -131,8 +130,8 @@ class ConstrainedWindowMac : public ConstrainedWindow { private: friend class ConstrainedWindow; - // The TabContentsWrapper that owns and constrains this ConstrainedWindow. - TabContentsWrapper* wrapper_; + // The TabContents that owns and constrains this ConstrainedWindow. + TabContents* tab_contents_; // Delegate that provides the contents of this constrained window. ConstrainedWindowMacDelegate* delegate_; diff --git a/chrome/browser/ui/cocoa/constrained_window_mac.mm b/chrome/browser/ui/cocoa/constrained_window_mac.mm index 5df9b85..1d018f1 100644 --- a/chrome/browser/ui/cocoa/constrained_window_mac.mm +++ b/chrome/browser/ui/cocoa/constrained_window_mac.mm @@ -6,7 +6,7 @@ #import "chrome/browser/ui/cocoa/browser_window_controller.h" #include "chrome/browser/ui/constrained_window_tab_helper.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" #import "third_party/GTM/AppKit/GTMWindowSheetController.h" @@ -86,16 +86,16 @@ void ConstrainedWindowMacDelegateCustomSheet::RunSheet( } ConstrainedWindowMac::ConstrainedWindowMac( - TabContentsWrapper* wrapper, ConstrainedWindowMacDelegate* delegate) - : wrapper_(wrapper), + TabContents* tab_contents, ConstrainedWindowMacDelegate* delegate) + : tab_contents_(tab_contents), delegate_(delegate), controller_(nil), should_be_visible_(false), closing_(false) { - DCHECK(wrapper); + DCHECK(tab_contents); DCHECK(delegate); - wrapper->constrained_window_tab_helper()->AddConstrainedDialog(this); + tab_contents->constrained_window_tab_helper()->AddConstrainedDialog(this); } ConstrainedWindowMac::~ConstrainedWindowMac() {} @@ -106,7 +106,7 @@ void ConstrainedWindowMac::ShowConstrainedWindow() { // this case, open the sheet now. Else, Realize() will be called later, when // our tab becomes visible. NSWindow* browserWindow = - wrapper_->web_contents()->GetView()->GetTopLevelNativeWindow(); + tab_contents_->web_contents()->GetView()->GetTopLevelNativeWindow(); BrowserWindowController* browser_controller = [BrowserWindowController browserWindowControllerForWindow:browserWindow]; if ([browser_controller canAttachConstrainedWindow]) @@ -126,7 +126,7 @@ void ConstrainedWindowMac::CloseConstrainedWindow() { // ok. [controller_ removeConstrainedWindow:this]; delegate_->DeleteDelegate(); - wrapper_->constrained_window_tab_helper()->WillClose(this); + tab_contents_->constrained_window_tab_helper()->WillClose(this); delete this; } diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h index de78a12..51e95ac 100644 --- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h +++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h @@ -17,14 +17,13 @@ @class CookieDetailsViewController; @class VerticalGradientView; class TabContents; -typedef TabContents TabContentsWrapper; // The constrained window delegate reponsible for managing the collected // cookies dialog. class CollectedCookiesMac : public ConstrainedWindowMacDelegateCustomSheet, public content::NotificationObserver { public: - CollectedCookiesMac(NSWindow* parent, TabContentsWrapper* wrapper); + CollectedCookiesMac(NSWindow* parent, TabContents* tab_contents); void OnSheetDidEnd(NSWindow* sheet); @@ -88,7 +87,7 @@ class CollectedCookiesMac : public ConstrainedWindowMacDelegateCustomSheet, scoped_nsobject<CookieDetailsViewController> detailsViewController_; - TabContentsWrapper* wrapper_; // weak + TabContents* tab_contents_; // weak BOOL infoBarVisible_; @@ -100,8 +99,8 @@ class CollectedCookiesMac : public ConstrainedWindowMacDelegateCustomSheet, @property(assign, nonatomic) BOOL allowedCookiesButtonsEnabled; @property(assign, nonatomic) BOOL blockedCookiesButtonsEnabled; -// Designated initializer. TabContentsWrapper cannot be NULL. -- (id)initWithTabContentsWrapper:(TabContentsWrapper*)wrapper; +// Designated initializer. TabContents cannot be NULL. +- (id)initWithTabContents:(TabContents*)tab_contents; // Closes the sheet and ends the modal loop. This will also cleanup the memory. - (IBAction)closeSheet:(id)sender; @@ -120,5 +119,5 @@ class CollectedCookiesMac : public ConstrainedWindowMacDelegateCustomSheet, - (CookiesTreeModel*)allowedTreeModel; - (CookiesTreeModel*)blockedTreeModel; -- (void)loadTreeModelFromTabContentsWrapper; +- (void)loadTreeModelFromTabContents; @end diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm index 879d901..22f5b0c 100644 --- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm +++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm @@ -27,7 +27,7 @@ #import "chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller.h" #import "chrome/browser/ui/cocoa/vertical_gradient_view.h" #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/public/browser/notification_details.h" @@ -63,9 +63,9 @@ namespace browser { // Declared in browser_dialogs.h so others don't have to depend on our header. void ShowCollectedCookiesDialog(gfx::NativeWindow parent_window, - TabContentsWrapper* wrapper) { + TabContents* tab_contents) { // Deletes itself on close. - new CollectedCookiesMac(parent_window, wrapper); + new CollectedCookiesMac(parent_window, tab_contents); } } // namespace browser @@ -101,21 +101,22 @@ void ShowCollectedCookiesDialog(gfx::NativeWindow parent_window, #pragma mark Constrained window delegate CollectedCookiesMac::CollectedCookiesMac(NSWindow* parent, - TabContentsWrapper* wrapper) + TabContents* tab_contents) : ConstrainedWindowMacDelegateCustomSheet( [[[CollectedCookiesSheetBridge alloc] initWithCollectedCookiesMac:this] autorelease], @selector(sheetDidEnd:returnCode:contextInfo:)) { - TabSpecificContentSettings* content_settings = wrapper->content_settings(); + TabSpecificContentSettings* content_settings = + tab_contents->content_settings(); registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, content::Source<TabSpecificContentSettings>(content_settings)); sheet_controller_ = [[CollectedCookiesWindowController alloc] - initWithTabContentsWrapper:wrapper]; + initWithTabContents:tab_contents]; set_sheet([sheet_controller_ window]); - window_ = new ConstrainedWindowMac(wrapper, this); + window_ = new ConstrainedWindowMac(tab_contents, this); } CollectedCookiesMac::~CollectedCookiesMac() { @@ -162,15 +163,15 @@ void CollectedCookiesMac::OnSheetDidEnd(NSWindow* sheet) { @synthesize allowedTreeController = allowedTreeController_; @synthesize blockedTreeController = blockedTreeController_; -- (id)initWithTabContentsWrapper:(TabContentsWrapper*)wrapper { - DCHECK(wrapper); +- (id)initWithTabContents:(TabContents*)tab_contents { + DCHECK(tab_contents); NSString* nibpath = [base::mac::FrameworkBundle() pathForResource:@"CollectedCookies" ofType:@"nib"]; if ((self = [super initWithWindowNibPath:nibpath owner:self])) { - wrapper_ = wrapper; - [self loadTreeModelFromTabContentsWrapper]; + tab_contents_ = tab_contents; + [self loadTreeModelFromTabContents]; animation_.reset([[NSViewAnimation alloc] init]); [animation_ setAnimationBlockingMode:NSAnimationNonblocking]; @@ -206,7 +207,7 @@ void CollectedCookiesMac::OnSheetDidEnd(NSWindow* sheet) { [infoBar_ setStrokeColor:bannerStrokeColor]; // Change the label of the blocked cookies part if necessary. - Profile* profile = wrapper_->profile(); + Profile* profile = tab_contents_->profile(); if (profile->GetPrefs()->GetBoolean(prefs::kBlockThirdPartyCookies)) { [blockedCookiesText_ setStringValue:l10n_util::GetNSString( IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED)]; @@ -238,7 +239,7 @@ void CollectedCookiesMac::OnSheetDidEnd(NSWindow* sheet) { - (void)windowWillClose:(NSNotification*)notif { if (contentSettingsChanged_) { - InfoBarTabHelper* infobar_helper = wrapper_->infobar_tab_helper(); + InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper(); infobar_helper->AddInfoBar( new CollectedCookiesInfoBarDelegate(infobar_helper)); } @@ -264,7 +265,7 @@ void CollectedCookiesMac::OnSheetDidEnd(NSWindow* sheet) { CookieTreeNode::DetailedInfo::TYPE_ORIGIN) { continue; } - Profile* profile = wrapper_->profile(); + Profile* profile = tab_contents_->profile(); CookieTreeOriginNode* origin_node = static_cast<CookieTreeOriginNode*>(cookie); origin_node->CreateContentException( @@ -377,8 +378,9 @@ void CollectedCookiesMac::OnSheetDidEnd(NSWindow* sheet) { // Initializes the |allowedTreeModel_| and |blockedTreeModel_|, and builds // the |cocoaAllowedTreeModel_| and |cocoaBlockedTreeModel_|. -- (void)loadTreeModelFromTabContentsWrapper { - TabSpecificContentSettings* content_settings = wrapper_->content_settings(); +- (void)loadTreeModelFromTabContents { + TabSpecificContentSettings* content_settings = + tab_contents_->content_settings(); const LocalSharedObjectsContainer& allowed_lsos = content_settings->allowed_local_shared_objects(); diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_unittest.mm b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_unittest.mm index 98154db..87146578 100644 --- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_unittest.mm +++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_unittest.mm @@ -29,7 +29,7 @@ class CollectedCookiesWindowControllerTest TEST_F(CollectedCookiesWindowControllerTest, Construction) { CollectedCookiesWindowController* controller = [[CollectedCookiesWindowController alloc] - initWithTabContentsWrapper:tab_contents()]; + initWithTabContents:tab_contents()]; [controller release]; } diff --git a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm index 0cd17a6..09bbc597 100644 --- a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm +++ b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm @@ -23,7 +23,7 @@ namespace { class DummyContentSettingBubbleModel : public ContentSettingBubbleModel { public: - DummyContentSettingBubbleModel(TabContentsWrapper* tab_contents, + DummyContentSettingBubbleModel(TabContents* tab_contents, Profile* profile, ContentSettingsType content_type) : ContentSettingBubbleModel(tab_contents, profile, content_type) { diff --git a/chrome/browser/ui/cocoa/dev_tools_controller.mm b/chrome/browser/ui/cocoa/dev_tools_controller.mm index 349a6ca..103df1f 100644 --- a/chrome/browser/ui/cocoa/dev_tools_controller.mm +++ b/chrome/browser/ui/cocoa/dev_tools_controller.mm @@ -12,7 +12,7 @@ #include "chrome/browser/debugger/devtools_window.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #import "chrome/browser/ui/cocoa/view_id_util.h" #include "chrome/common/pref_names.h" #include "content/public/browser/web_contents.h" @@ -82,7 +82,7 @@ const int kMinContentsSize = 50; - (void)updateDevToolsForWebContents:(WebContents*)contents withProfile:(Profile*)profile { // Get current devtools content. - TabContentsWrapper* devToolsTab = contents ? + TabContents* devToolsTab = contents ? DevToolsWindow::GetDevToolsContents(contents) : NULL; WebContents* devToolsContents = devToolsTab ? devToolsTab->web_contents() : NULL; diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm index ccc35dd..6bccdbe 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm @@ -21,7 +21,7 @@ #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" #import "chrome/browser/ui/cocoa/image_button_cell.h" #import "chrome/browser/ui/cocoa/menu_button.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/pref_names.h" @@ -841,7 +841,7 @@ class ExtensionServiceObserverBridge : public content::NotificationObserver, } - (int)currentTabId { - TabContentsWrapper* selected_tab = browser_->GetSelectedTabContentsWrapper(); + TabContents* selected_tab = browser_->GetActiveTabContents(); if (!selected_tab) return -1; diff --git a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm index 1a86b62..7ce025d 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm @@ -97,7 +97,7 @@ int CurrentTabId() { Browser* browser = browser::GetLastActiveBrowser(); if(!browser) return -1; - WebContents* contents = browser->GetSelectedWebContents(); + WebContents* contents = browser->GetActiveWebContents(); if (!contents) return -1; return ExtensionTabUtil::GetTabId(contents); diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm index a19bee4..2f21dfa 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm @@ -15,7 +15,7 @@ #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_window.h" #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_action.h" #include "grit/chromium_strings.h" @@ -35,8 +35,8 @@ static void ShowGenericExtensionInstalledInfoBar( if (!browser) return; - TabContentsWrapper* wrapper = browser->GetSelectedTabContentsWrapper(); - if (!wrapper) + TabContents* tab_contents = browser->GetActiveTabContents(); + if (!tab_contents) return; string16 extension_name = UTF8ToUTF16(new_extension->name()); @@ -46,7 +46,7 @@ static void ShowGenericExtensionInstalledInfoBar( + UTF8ToUTF16(" ") + l10n_util::GetStringUTF16( IDS_EXTENSION_INSTALLED_MANAGE_INFO_MAC); - InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); + InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); InfoBarDelegate* delegate = new SimpleAlertInfoBarDelegate( infobar_helper, new gfx::Image(icon), msg, true); infobar_helper->AddInfoBar(delegate); diff --git a/chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.mm b/chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.mm index 768545c..e34a359 100644 --- a/chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.mm +++ b/chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.mm @@ -16,7 +16,7 @@ #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" #include "chrome/browser/ui/find_bar/find_bar_controller.h" #include "chrome/browser/ui/find_bar/find_tab_helper.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" @@ -74,7 +74,7 @@ const float kRightEdgeOffset = 25; } - (void)dealloc { - // All animations should be explicitly stopped by the TabContentsWrapper + // All animations should be explicitly stopped by the TabContents // before a tab is closed. DCHECK(!showHideAnimation_.get()); DCHECK(!moveAnimation_.get()); @@ -168,7 +168,7 @@ const float kRightEdgeOffset = 25; if (!findBarBridge_) return; - TabContentsWrapper* tab_contents = + TabContents* tab_contents = findBarBridge_->GetFindBarController()->tab_contents(); if (!tab_contents) return; @@ -222,7 +222,7 @@ const float kRightEdgeOffset = 25; command == @selector(scrollToEndOfDocument:) || command == @selector(moveUp:) || command == @selector(moveDown:)) { - TabContentsWrapper* contents = + TabContents* contents = findBarBridge_->GetFindBarController()->tab_contents(); if (!contents) return NO; @@ -466,7 +466,7 @@ const float kRightEdgeOffset = 25; if (!findBarBridge_ || !findBarBridge_->GetFindBarController()) return frame.origin.x; - TabContentsWrapper* contents = + TabContents* contents = findBarBridge_->GetFindBarController()->tab_contents(); if (!contents) return frame.origin.x; @@ -528,7 +528,7 @@ const float kRightEdgeOffset = 25; // End the find session, hide the "x of y" text and disable the // buttons, but do not close the find bar or raise the window here. if (stopSearch && findBarBridge_) { - TabContentsWrapper* contents = + TabContents* contents = findBarBridge_->GetFindBarController()->tab_contents(); if (contents) { FindTabHelper* find_tab_helper = contents->find_tab_helper(); diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm index 5683b1b..c5908f8 100644 --- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm @@ -19,7 +19,7 @@ #import "chrome/browser/ui/cocoa/info_bubble_window.h" #include "chrome/browser/ui/fullscreen_exit_bubble_type.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "grit/generated_resources.h" #include "grit/ui_strings.h" #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm index 30197e8..2bace10 100644 --- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm @@ -65,7 +65,7 @@ class FullscreenExitBubbleControllerTest : public CocoaProfileTest { } void AppendTabToStrip() { - TabContentsWrapper* tab_contents = Browser::TabContentsFactory( + TabContents* tab_contents = Browser::TabContentsFactory( profile(), site_instance_, MSG_ROUTING_NONE, NULL, NULL); browser()->tab_strip_model()->AppendTabContents( @@ -85,7 +85,7 @@ TEST_F(FullscreenExitBubbleControllerTest, DenyExitsFullscreen) { [bwc showWindow:nil]; AppendTabToStrip(); - WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); + WebContents* fullscreen_tab = browser()->GetActiveWebContents(); { base::mac::ScopedNSAutoreleasePool pool; ui_test_utils::WindowedNotificationObserver fullscreen_observer( diff --git a/chrome/browser/ui/cocoa/hung_renderer_controller.mm b/chrome/browser/ui/cocoa/hung_renderer_controller.mm index 40346bc..b5c112d 100644 --- a/chrome/browser/ui/cocoa/hung_renderer_controller.mm +++ b/chrome/browser/ui/cocoa/hung_renderer_controller.mm @@ -16,7 +16,7 @@ #import "chrome/browser/ui/cocoa/tab_contents/favicon_util.h" #include "chrome/browser/ui/tab_contents/core_tab_helper.h" #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/logging_chrome.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" diff --git a/chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm b/chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm index b0dc08f..1566ff8 100644 --- a/chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm +++ b/chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm @@ -14,7 +14,7 @@ #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" #include "chrome/browser/ui/cocoa/infobars/infobar.h" #import "chrome/browser/ui/cocoa/menu_button.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/extension_resource.h" diff --git a/chrome/browser/ui/cocoa/infobars/infobar_container_controller.h b/chrome/browser/ui/cocoa/infobars/infobar_container_controller.h index c881dab..d6e4d0a 100644 --- a/chrome/browser/ui/cocoa/infobars/infobar_container_controller.h +++ b/chrome/browser/ui/cocoa/infobars/infobar_container_controller.h @@ -19,7 +19,6 @@ class InfoBar; class InfoBarDelegate; class InfoBarNotificationObserver; class TabContents; -typedef TabContents TabContentsWrapper; class TabStripModel; // Protocol for basic container methods, as needed by an InfoBarController. @@ -53,8 +52,8 @@ const CGFloat kTipHeight = 12.0; // Needed to send resize messages when infobars are added or removed. id<ViewResizer> resizeDelegate_; // weak - // The TabContentsWrapper we are currently showing infobars for. - TabContentsWrapper* currentTabContents_; // weak + // The TabContents we are currently showing infobars for. + TabContents* currentTabContents_; // weak // Holds the InfoBarControllers currently owned by this container. scoped_nsobject<NSMutableArray> infobarControllers_; @@ -87,12 +86,12 @@ const CGFloat kTipHeight = 12.0; // infobars, removes them first and deregisters for any // notifications. |contents| can be NULL, in which case no infobars // are shown and no notifications are registered for. -- (void)changeTabContents:(TabContentsWrapper*)contents; +- (void)changeTabContents:(TabContents*)contents; // Stripped down version of TabStripModelObserverBridge:tabDetachedWithContents. // Forwarded by BWC. Removes all infobars and deregisters for any notifications // if |contents| is the current tab contents. -- (void)tabDetachedWithContents:(TabContentsWrapper*)contents; +- (void)tabDetachedWithContents:(TabContents*)contents; // Returns the number of active infobars. This is // |infobarControllers_ - closingInfoBars_|. diff --git a/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm b/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm index 7288784..3770270 100644 --- a/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm +++ b/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm @@ -13,7 +13,7 @@ #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" #import "chrome/browser/ui/cocoa/view_id_util.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_notification_types.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" @@ -136,7 +136,7 @@ class InfoBarNotificationObserver : public content::NotificationObserver { return controller; } -- (void)changeTabContents:(TabContentsWrapper*)contents { +- (void)changeTabContents:(TabContents*)contents { registrar_.RemoveAll(); [self removeAllInfoBars]; @@ -162,7 +162,7 @@ class InfoBarNotificationObserver : public content::NotificationObserver { [self positionInfoBarsAndRedraw]; } -- (void)tabDetachedWithContents:(TabContentsWrapper*)contents { +- (void)tabDetachedWithContents:(TabContents*)contents { if (currentTabContents_ == contents) [self changeTabContents:NULL]; } diff --git a/chrome/browser/ui/cocoa/infobars/infobar_controller.mm b/chrome/browser/ui/cocoa/infobars/infobar_controller.mm index d77c11e..a002414 100644 --- a/chrome/browser/ui/cocoa/infobars/infobar_controller.mm +++ b/chrome/browser/ui/cocoa/infobars/infobar_controller.mm @@ -20,7 +20,7 @@ #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" #import "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h" #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" #include "ui/gfx/image/image.h" #include "webkit/glue/window_open_disposition.h" diff --git a/chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm b/chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm index 6b66e00..32a4602 100644 --- a/chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm @@ -15,7 +15,7 @@ #include "chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.h" #include "chrome/browser/ui/cocoa/infobars/mock_link_infobar_delegate.h" #include "chrome/browser/ui/cocoa/run_loop_testing.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #import "content/public/browser/web_contents.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -99,7 +99,7 @@ class LinkInfoBarControllerTest : public CocoaProfileTest, public: virtual void SetUp() { CocoaProfileTest::SetUp(); - tab_contents_.reset(new TabContentsWrapper(WebContents::Create( + tab_contents_.reset(new TabContents(WebContents::Create( profile(), NULL, MSG_ROUTING_NONE, NULL, NULL))); tab_contents_->infobar_tab_helper()->set_infobars_enabled(false); @@ -135,7 +135,7 @@ class LinkInfoBarControllerTest : public CocoaProfileTest, delegate_ = NULL; } - scoped_ptr<TabContentsWrapper> tab_contents_; + scoped_ptr<TabContents> tab_contents_; }; class ConfirmInfoBarControllerTest : public CocoaProfileTest, @@ -143,7 +143,7 @@ class ConfirmInfoBarControllerTest : public CocoaProfileTest, public: virtual void SetUp() { CocoaProfileTest::SetUp(); - tab_contents_.reset(new TabContentsWrapper(WebContents::Create( + tab_contents_.reset(new TabContents(WebContents::Create( profile(), NULL, MSG_ROUTING_NONE, NULL, NULL))); tab_contents_->infobar_tab_helper()->set_infobars_enabled(false); @@ -185,7 +185,7 @@ class ConfirmInfoBarControllerTest : public CocoaProfileTest, delegate_ = NULL; } - scoped_ptr<TabContentsWrapper> tab_contents_; + scoped_ptr<TabContents> tab_contents_; }; diff --git a/chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm b/chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm index 348bd21..e27e3df 100644 --- a/chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm +++ b/chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm @@ -13,7 +13,7 @@ #import "chrome/browser/ui/cocoa/infobars/before_translate_infobar_controller.h" #import "chrome/browser/ui/cocoa/infobars/infobar.h" #import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #import "content/public/browser/web_contents.h" #import "testing/gmock/include/gmock/gmock.h" #import "testing/gtest/include/gtest/gtest.h" @@ -74,7 +74,7 @@ class TranslationInfoBarTest : public CocoaProfileTest { // the test. virtual void SetUp() { CocoaProfileTest::SetUp(); - tab_contents_.reset(new TabContentsWrapper(WebContents::Create( + tab_contents_.reset(new TabContents(WebContents::Create( profile(), NULL, MSG_ROUTING_NONE, NULL, NULL))); CreateInfoBar(); } @@ -106,7 +106,7 @@ class TranslationInfoBarTest : public CocoaProfileTest { [[test_window() contentView] addSubview:[infobar_controller_ view]]; } - scoped_ptr<TabContentsWrapper> tab_contents_; + scoped_ptr<TabContents> tab_contents_; scoped_ptr<MockTranslateInfoBarDelegate> infobar_delegate_; scoped_nsobject<TranslateInfoBarControllerBase> infobar_controller_; }; diff --git a/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm b/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm index c08c60b7..0aa2c6e 100644 --- a/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm +++ b/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm @@ -20,7 +20,7 @@ #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/public/browser/navigation_details.h" @@ -191,17 +191,17 @@ bool KeystonePromotionInfoBarDelegate::Cancel() { [[KeystoneGlue defaultKeystoneGlue] needsPromotion]) { Browser* browser = browser::GetLastActiveBrowser(); if (browser) { - TabContentsWrapper* wrapper = browser->GetSelectedTabContentsWrapper(); + TabContents* tabContents = browser->GetActiveTabContents(); // Only show if no other info bars are showing, because that's how the // default browser info bar works. - if (wrapper) { - InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); + if (tabContents) { + InfoBarTabHelper* infobar_helper = tabContents->infobar_tab_helper(); if (infobar_helper->infobar_count() == 0) { infobar_helper->AddInfoBar( new KeystonePromotionInfoBarDelegate( infobar_helper, - wrapper->profile()->GetPrefs())); + tabContents->profile()->GetPrefs())); } } } diff --git a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm index a5906ad..688b2a3 100644 --- a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm @@ -18,7 +18,7 @@ #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" #include "chrome/browser/ui/content_settings/content_setting_image_model.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/pref_names.h" #include "content/public/browser/web_contents.h" #include "net/base/net_util.h" @@ -197,8 +197,7 @@ bool ContentSettingDecoration::UpdateFromWebContents( // Check if the animation has already run. TabSpecificContentSettings* content_settings = - TabContentsWrapper::GetCurrentWrapperForContents(web_contents)-> - content_settings(); + TabContents::FromWebContents(web_contents)->content_settings(); ContentSettingsType content_type = content_setting_image_model_->get_content_settings_type(); bool ran_animation = content_settings->IsBlockageIndicated(content_type); @@ -263,7 +262,7 @@ bool ContentSettingDecoration::AcceptsMousePress() { bool ContentSettingDecoration::OnMousePressed(NSRect frame) { // Get host. This should be shared on linux/win/osx medium-term. Browser* browser = browser::GetLastActiveBrowser(); - TabContentsWrapper* tabContents = browser->GetSelectedTabContentsWrapper(); + TabContents* tabContents = browser->GetActiveTabContents(); if (!tabContents) return true; diff --git a/chrome/browser/ui/cocoa/login_prompt_cocoa.mm b/chrome/browser/ui/cocoa/login_prompt_cocoa.mm index ebdd1b31..7841ab9 100644 --- a/chrome/browser/ui/cocoa/login_prompt_cocoa.mm +++ b/chrome/browser/ui/cocoa/login_prompt_cocoa.mm @@ -15,7 +15,7 @@ #include "chrome/browser/ui/cocoa/constrained_window_mac.h" #include "chrome/browser/ui/login/login_model.h" #include "chrome/browser/ui/login/login_prompt.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" @@ -74,9 +74,9 @@ class LoginHandlerMac : public LoginHandler, WebContents* requesting_contents = GetWebContentsForLogin(); DCHECK(requesting_contents); - TabContentsWrapper* wrapper = - TabContentsWrapper::GetCurrentWrapperForContents(requesting_contents); - SetDialog(new ConstrainedWindowMac(wrapper, this)); + TabContents* tab_contents = + TabContents::FromWebContents(requesting_contents); + SetDialog(new ConstrainedWindowMac(tab_contents, this)); NotifyAuthNeeded(); } diff --git a/chrome/browser/ui/cocoa/ssl_client_certificate_selector.mm b/chrome/browser/ui/cocoa/ssl_client_certificate_selector.mm index fe359ba..bc9d014 100644 --- a/chrome/browser/ui/cocoa/ssl_client_certificate_selector.mm +++ b/chrome/browser/ui/cocoa/ssl_client_certificate_selector.mm @@ -16,7 +16,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/ssl/ssl_client_auth_observer.h" #import "chrome/browser/ui/cocoa/constrained_window_mac.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" #include "grit/generated_resources.h" #include "net/base/ssl_cert_request_info.h" @@ -28,7 +28,7 @@ using content::BrowserThread; @interface SFChooseIdentityPanel (SystemPrivate) // A system-private interface that dismisses a panel whose sheet was started by -// beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:identities:message: +// -beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:identities:message: // as though the user clicked the button identified by returnCode. Verified // present in 10.5, 10.6, and 10.7. - (void)_dismissWithCode:(NSInteger)code; @@ -54,7 +54,7 @@ class NotificationProxy; certRequestInfo:(net::SSLCertRequestInfo*)certRequestInfo callback:(const base::Callback<void(net::X509Certificate*)>&)callback; - (void)onNotification; -- (void)displayDialog:(TabContentsWrapper*)wrapper; +- (void)displayDialog:(TabContents*)tabContents; @end namespace { @@ -134,7 +134,7 @@ class NotificationProxy : public SSLClientAuthObserver { namespace browser { void ShowSSLClientCertificateSelector( - TabContentsWrapper* wrapper, + TabContents* tabContents, const net::HttpNetworkSession* network_session, net::SSLCertRequestInfo* cert_request_info, const base::Callback<void(net::X509Certificate*)>& callback) { @@ -144,7 +144,7 @@ void ShowSSLClientCertificateSelector( initWithObserver:network_session certRequestInfo:cert_request_info callback:callback] autorelease]; - [selector displayDialog:wrapper]; + [selector displayDialog:tabContents]; } } // namespace browser @@ -191,7 +191,7 @@ void ShowSSLClientCertificateSelector( window_->CloseConstrainedWindow(); } -- (void)displayDialog:(TabContentsWrapper*)wrapper { +- (void)displayDialog:(TabContents*)tabContents { DCHECK(!window_); // Create an array of CFIdentityRefs for the certificates: size_t numCerts = observer_->cert_request_info()->client_certs.size(); @@ -225,7 +225,7 @@ void ShowSSLClientCertificateSelector( } window_ = new ConstrainedWindowMac( - wrapper, + tabContents, new ConstrainedSFChooseIdentityPanel( panel, self, @selector(sheetDidEnd:returnCode:context:), diff --git a/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h b/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h index 3f35544..5050a07 100644 --- a/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h +++ b/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h @@ -12,7 +12,6 @@ #include "chrome/browser/ui/cocoa/constrained_window_mac.h" class TabContents; -typedef TabContents TabContentsWrapper; class TabModalConfirmDialogDelegate; // Displays a tab-modal dialog, i.e. a dialog that will block the current page @@ -24,7 +23,7 @@ class TabModalConfirmDialogMac : public ConstrainedWindowMacDelegateSystemSheet { public: TabModalConfirmDialogMac(TabModalConfirmDialogDelegate* delegate, - TabContentsWrapper* wrapper); + TabContents* tab_contents); // ConstrainedWindowDelegateMacSystemSheet methods: virtual void DeleteDelegate() OVERRIDE; diff --git a/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm b/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm index 9083449..891fc18 100644 --- a/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm +++ b/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm @@ -7,7 +7,7 @@ #include "base/memory/scoped_nsobject.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/gfx/image/image.h" @@ -45,16 +45,16 @@ namespace browser { // Declared in browser_dialogs.h so others don't have to depend on our header. void ShowTabModalConfirmDialog(TabModalConfirmDialogDelegate* delegate, - TabContentsWrapper* wrapper) { + TabContents* tab_contents) { // Deletes itself when closed. - new TabModalConfirmDialogMac(delegate, wrapper); + new TabModalConfirmDialogMac(delegate, tab_contents); } } TabModalConfirmDialogMac::TabModalConfirmDialogMac( TabModalConfirmDialogDelegate* delegate, - TabContentsWrapper* wrapper) + TabContents* tab_contents) : ConstrainedWindowMacDelegateSystemSheet( [[[TabModalConfirmDialogMacBridge alloc] initWithDelegate:delegate] autorelease], @@ -75,7 +75,7 @@ TabModalConfirmDialogMac::TabModalConfirmDialogMac( set_sheet(alert); - delegate->set_window(new ConstrainedWindowMac(wrapper, this)); + delegate->set_window(new ConstrainedWindowMac(tab_contents, this)); } TabModalConfirmDialogMac::~TabModalConfirmDialogMac() { diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm index 16d8ed2..67f4069 100644 --- a/chrome/browser/ui/cocoa/tabpose_window.mm +++ b/chrome/browser/ui/cocoa/tabpose_window.mm @@ -27,7 +27,7 @@ #import "chrome/browser/ui/cocoa/tab_contents/favicon_util.h" #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/pref_names.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host_view.h" @@ -104,12 +104,12 @@ namespace tabpose { class ThumbnailLoader; } -// A CALayer that draws a thumbnail for a TabContentsWrapper object. The layer +// A CALayer that draws a thumbnail for a TabContents object. The layer // tries to draw the WebContents's backing store directly if possible, and // requests a thumbnail bitmap from the WebContents's renderer process if not. @interface ThumbnailLayer : CALayer { - // The TabContentsWrapper the thumbnail is for. - TabContentsWrapper* contents_; // weak + // The TabContents the thumbnail is for. + TabContents* contents_; // weak // The size the thumbnail is drawn at when zoomed in. NSSize fullSize_; @@ -124,7 +124,7 @@ class ThumbnailLoader; // True if the layer already sent a thumbnail request to a renderer. BOOL didSendLoad_; } -- (id)initWithTabContents:(TabContentsWrapper*)contents +- (id)initWithTabContents:(TabContents*)contents fullSize:(NSSize)fullSize; - (void)drawInContext:(CGContextRef)context; - (void)setThumbnail:(const SkBitmap&)bitmap; @@ -196,7 +196,7 @@ void ThumbnailLoader::LoadThumbnail() { @implementation ThumbnailLayer -- (id)initWithTabContents:(TabContentsWrapper*)contents +- (id)initWithTabContents:(TabContents*)contents fullSize:(NSSize)fullSize { CHECK(contents); if ((self = [super init])) { @@ -206,7 +206,7 @@ void ThumbnailLoader::LoadThumbnail() { return self; } -- (void)setTabContents:(TabContentsWrapper*)contents { +- (void)setTabContents:(TabContents*)contents { contents_ = contents; } @@ -250,7 +250,7 @@ void ThumbnailLoader::LoadThumbnail() { - (int)bottomOffset { int bottomOffset = 0; - TabContentsWrapper* devToolsContents = + TabContents* devToolsContents = DevToolsWindow::GetDevToolsContents(contents_->web_contents()); if (devToolsContents && devToolsContents->web_contents() && devToolsContents->web_contents()->GetRenderViewHost() && @@ -416,8 +416,8 @@ class Tile { return contents_->web_contents()->GetTitle(); } - TabContentsWrapper* tab_contents() const { return contents_; } - void set_tab_contents(TabContentsWrapper* new_contents) { + TabContents* tab_contents() const { return contents_; } + void set_tab_contents(TabContents* new_contents) { contents_ = new_contents; } @@ -434,7 +434,7 @@ class Tile { CGFloat title_font_size_; NSRect title_rect_; - TabContentsWrapper* contents_; // weak + TabContents* contents_; // weak DISALLOW_COPY_AND_ASSIGN(Tile); }; @@ -527,7 +527,7 @@ class TileSet { // Inserts a new Tile object containing |contents| at |index|. Does no // relayout. - void InsertTileAt(int index, TabContentsWrapper* contents); + void InsertTileAt(int index, TabContents* contents); // Removes the Tile object at |index|. Does no relayout. void RemoveTileAt(int index); @@ -793,7 +793,7 @@ int TileSet::previous_index() const { return new_index; } -void TileSet::InsertTileAt(int index, TabContentsWrapper* contents) { +void TileSet::InsertTileAt(int index, TabContents* contents) { tiles_.insert(tiles_.begin() + index, new Tile); tiles_[index]->contents_ = contents; } @@ -1522,7 +1522,7 @@ void AnimateCALayerOpacityFromTo( nil); } -- (void)insertTabWithContents:(TabContentsWrapper*)contents +- (void)insertTabWithContents:(TabContents*)contents atIndex:(NSInteger)index inForeground:(bool)inForeground { // This happens if you cmd-click a link and then immediately open tabpose @@ -1559,13 +1559,13 @@ void AnimateCALayerOpacityFromTo( } } -- (void)tabClosingWithContents:(TabContentsWrapper*)contents +- (void)tabClosingWithContents:(TabContents*)contents atIndex:(NSInteger)index { // We will also get a -tabDetachedWithContents:atIndex: notification for // closing tabs, so do nothing here. } -- (void)tabDetachedWithContents:(TabContentsWrapper*)contents +- (void)tabDetachedWithContents:(TabContents*)contents atIndex:(NSInteger)index { ScopedCAActionSetDuration durationSetter(kObserverChangeAnimationDuration); @@ -1606,7 +1606,7 @@ void AnimateCALayerOpacityFromTo( [self refreshLayerFramesAtIndex:i]; } -- (void)tabMovedWithContents:(TabContentsWrapper*)contents +- (void)tabMovedWithContents:(TabContents*)contents fromIndex:(NSInteger)from toIndex:(NSInteger)to { ScopedCAActionSetDuration durationSetter(kObserverChangeAnimationDuration); @@ -1643,7 +1643,7 @@ void AnimateCALayerOpacityFromTo( [self refreshLayerFramesAtIndex:i]; } -- (void)tabChangedWithContents:(TabContentsWrapper*)contents +- (void)tabChangedWithContents:(TabContents*)contents atIndex:(NSInteger)index changeType:(TabStripModelObserver::TabChangeType)change { // Tell the window to update text, title, and thumb layers at |index| to get diff --git a/chrome/browser/ui/cocoa/tabpose_window_unittest.mm b/chrome/browser/ui/cocoa/tabpose_window_unittest.mm index 3aff093..ce611d0 100644 --- a/chrome/browser/ui/cocoa/tabpose_window_unittest.mm +++ b/chrome/browser/ui/cocoa/tabpose_window_unittest.mm @@ -6,7 +6,7 @@ #import "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "content/public/browser/site_instance.h" #include "testing/gtest/include/gtest/gtest.h" @@ -23,7 +23,7 @@ class TabposeWindowTest : public CocoaProfileTest { } void AppendTabToStrip() { - TabContentsWrapper* tab_contents = Browser::TabContentsFactory( + TabContents* tab_contents = Browser::TabContentsFactory( profile(), site_instance_, MSG_ROUTING_NONE, NULL, NULL); browser()->tab_strip_model()->AppendTabContents( diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.h b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.h index bf6a7eb..31da711 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.h +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.h @@ -25,7 +25,6 @@ class Browser; class ConstrainedWindowMac; class TabContents; -typedef TabContents TabContentsWrapper; class TabStripModelObserverBridge; class TabStripModel; @@ -176,7 +175,7 @@ class TabStripModel; // current placeholder. - (void)moveTabFromIndex:(NSInteger)from; -// Drop a given TabContentsWrapper at the location of the current placeholder. +// Drop a given TabContents at the location of the current placeholder. // If there is no placeholder, it will go at the end. Used when dragging from // another window when we don't have access to the WebContents as part of our // strip. |frame| is in the coordinate system of the tab strip view and @@ -185,7 +184,7 @@ class TabStripModel; // its previous window, setting |pinned| to YES will propagate that state to the // new window. Mini-tabs are either app or pinned tabs; the app state is stored // by the |contents|, but the |pinned| state is the caller's responsibility. -- (void)dropTabContents:(TabContentsWrapper*)contents +- (void)dropTabContents:(TabContents*)contents withFrame:(NSRect)frame asPinnedTab:(BOOL)pinned; diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index 2080719..050cd21 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm @@ -45,7 +45,7 @@ #include "chrome/browser/ui/find_bar/find_bar.h" #include "chrome/browser/ui/find_bar/find_bar_controller.h" #include "chrome/browser/ui/find_bar/find_tab_helper.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tabs/tab_menu_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_selection_model.h" @@ -144,7 +144,7 @@ private: - (void)addSubviewToPermanentList:(NSView*)aView; - (void)regenerateSubviewList; - (NSInteger)indexForContentsView:(NSView*)view; -- (void)updateFaviconForContents:(TabContentsWrapper*)contents +- (void)updateFaviconForContents:(TabContents*)contents atIndex:(NSInteger)modelIndex; - (void)layoutTabsWithAnimation:(BOOL)animate regenerateSubviews:(BOOL)doUpdate; @@ -302,7 +302,7 @@ private: #pragma mark - // In general, there is a one-to-one correspondence between TabControllers, -// TabViews, TabContentsControllers, and the TabContentsWrapper in the +// TabViews, TabContentsControllers, and the TabContents in the // TabStripModel. In the steady-state, the indices line up so an index coming // from the model is directly mapped to the same index in the parallel arrays // holding our views and controllers. This is also true when new tabs are @@ -453,10 +453,9 @@ private: // means the tab model is already fully formed with tabs. Need to walk the // list and create the UI for each. const int existingTabCount = tabStripModel_->count(); - const TabContentsWrapper* selection = - tabStripModel_->GetActiveTabContents(); + const TabContents* selection = tabStripModel_->GetActiveTabContents(); for (int i = 0; i < existingTabCount; ++i) { - TabContentsWrapper* currentContents = tabStripModel_->GetTabContentsAt(i); + TabContents* currentContents = tabStripModel_->GetTabContentsAt(i); [self insertTabWithContents:currentContents atIndex:i inForeground:NO]; @@ -556,7 +555,7 @@ private: // Make sure the new tabs's sheets are visible (necessary when a background // tab opened a sheet while it was in the background and now becomes active). - TabContentsWrapper* newTab = tabStripModel_->GetTabContentsAt(modelIndex); + TabContents* newTab = tabStripModel_->GetTabContentsAt(modelIndex); DCHECK(newTab); if (newTab) { ConstrainedWindowTabHelper::ConstrainedWindowList::iterator it, end; @@ -1144,7 +1143,7 @@ private: // Called when a notification is received from the model to insert a new tab // at |modelIndex|. -- (void)insertTabWithContents:(TabContentsWrapper*)contents +- (void)insertTabWithContents:(TabContents*)contents atIndex:(NSInteger)modelIndex inForeground:(bool)inForeground { DCHECK(contents); @@ -1202,8 +1201,8 @@ private: // Called when a notification is received from the model to select a particular // tab. Swaps in the toolbar and content area associated with |newContents|. -- (void)activateTabWithContents:(TabContentsWrapper*)newContents - previousContents:(TabContentsWrapper*)oldContents +- (void)activateTabWithContents:(TabContents*)newContents + previousContents:(TabContents*)oldContents atIndex:(NSInteger)modelIndex userGesture:(bool)wasUserGesture { // Take closing tabs into account. @@ -1261,8 +1260,8 @@ private: } } -- (void)tabReplacedWithContents:(TabContentsWrapper*)newContents - previousContents:(TabContentsWrapper*)oldContents +- (void)tabReplacedWithContents:(TabContents*)newContents + previousContents:(TabContents*)oldContents atIndex:(NSInteger)modelIndex { NSInteger index = [self indexFromModelIndex:modelIndex]; TabContentsController* oldController = @@ -1376,7 +1375,7 @@ private: // Called when a notification is received from the model that the given tab // has gone away. Start an animation then force a layout to put everything // in motion. -- (void)tabDetachedWithContents:(TabContentsWrapper*)contents +- (void)tabDetachedWithContents:(TabContents*)contents atIndex:(NSInteger)modelIndex { // Take closing tabs into account. NSInteger index = [self indexFromModelIndex:modelIndex]; @@ -1397,7 +1396,7 @@ private: // A helper routine for creating an NSImageView to hold the favicon or app icon // for |contents|. -- (NSImageView*)iconImageViewForContents:(TabContentsWrapper*)contents { +- (NSImageView*)iconImageViewForContents:(TabContents*)contents { BOOL isApp = contents->extension_tab_helper()->is_app(); NSImage* image = nil; // Favicons come from the renderer, and the renderer draws everything in the @@ -1423,7 +1422,7 @@ private: // Updates the current loading state, replacing the icon view with a favicon, // a throbber, the default icon, or nothing at all. -- (void)updateFaviconForContents:(TabContentsWrapper*)contents +- (void)updateFaviconForContents:(TabContents*)contents atIndex:(NSInteger)modelIndex { if (!contents) return; @@ -1495,7 +1494,7 @@ private: // Called when a notification is received from the model that the given tab // has been updated. |loading| will be YES when we only want to update the // throbber state, not anything else about the (partially) loading tab. -- (void)tabChangedWithContents:(TabContentsWrapper*)contents +- (void)tabChangedWithContents:(TabContents*)contents atIndex:(NSInteger)modelIndex changeType:(TabStripModelObserver::TabChangeType)change { // Take closing tabs into account. @@ -1525,7 +1524,7 @@ private: // Called when a tab is moved (usually by drag&drop). Keep our parallel arrays // in sync with the tab strip model. It can also be pinned/unpinned // simultaneously, so we need to take care of that. -- (void)tabMovedWithContents:(TabContentsWrapper*)contents +- (void)tabMovedWithContents:(TabContents*)contents fromIndex:(NSInteger)modelFrom toIndex:(NSInteger)modelTo { // Take closing tabs into account. @@ -1554,7 +1553,7 @@ private: } // Called when a tab is pinned or unpinned without moving. -- (void)tabMiniStateChangedWithContents:(TabContentsWrapper*)contents +- (void)tabMiniStateChangedWithContents:(TabContents*)contents atIndex:(NSInteger)modelIndex { // Take closing tabs into account. NSInteger index = [self indexFromModelIndex:modelIndex]; @@ -1641,7 +1640,7 @@ private: tabStripModel_->MoveTabContentsAt(from, toIndex, true); } -// Drop a given TabContentsWrapper at the location of the current placeholder. +// Drop a given TabContents at the location of the current placeholder. // If there is no placeholder, it will go at the end. Used when dragging from // another window when we don't have access to the WebContents as part of our // strip. |frame| is in the coordinate system of the tab strip view and @@ -1650,7 +1649,7 @@ private: // its previous window, setting |pinned| to YES will propagate that state to the // new window. Mini-tabs are either app or pinned tabs; the app state is stored // by the |contents|, but the |pinned| state is the caller's responsibility. -- (void)dropTabContents:(TabContentsWrapper*)contents +- (void)dropTabContents:(TabContents*)contents withFrame:(NSRect)frame asPinnedTab:(BOOL)pinned { int modelIndex = [self indexOfPlaceholder]; diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm index 207476b..5fdd399 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm @@ -13,7 +13,7 @@ #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" #import "chrome/browser/ui/cocoa/tabs/tab_view.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tabs/test_tab_strip_model_delegate.h" #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" @@ -117,7 +117,7 @@ class TabStripControllerTest : public CocoaProfileTest { TEST_F(TabStripControllerTest, AddRemoveTabs) { EXPECT_TRUE(model_->empty()); SiteInstance* instance = SiteInstance::Create(profile()); - TabContentsWrapper* tab_contents = + TabContents* tab_contents = Browser::TabContentsFactory(profile(), instance, MSG_ROUTING_NONE, NULL, NULL); model_->AppendTabContents(tab_contents, true); @@ -135,16 +135,16 @@ TEST_F(TabStripControllerTest, RearrangeTabs) { TEST_F(TabStripControllerTest, CorrectToolTipText) { // Create tab 1. SiteInstance* instance = SiteInstance::Create(profile()); - TabContentsWrapper* tab_contents = - Browser::TabContentsFactory(profile(), instance, - MSG_ROUTING_NONE, NULL, NULL); + TabContents* tab_contents = + Browser::TabContentsFactory(profile(), instance, + MSG_ROUTING_NONE, NULL, NULL); model_->AppendTabContents(tab_contents, true); // Create tab 2. SiteInstance* instance2 = SiteInstance::Create(profile()); - TabContentsWrapper* tab_contents2 = - Browser::TabContentsFactory(profile(), instance2, - MSG_ROUTING_NONE, NULL, NULL); + TabContents* tab_contents2 = + Browser::TabContentsFactory(profile(), instance2, + MSG_ROUTING_NONE, NULL, NULL); model_->AppendTabContents(tab_contents2, true); // Set tab 1 tooltip. diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h b/chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h index e840021..b4406c0 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h @@ -12,7 +12,6 @@ #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" class TabContents; -typedef TabContents TabContentsWrapper; class TabStripModel; // A C++ bridge class to handle receiving notifications from the C++ tab strip @@ -26,27 +25,27 @@ class TabStripModelObserverBridge : public TabStripModelObserver { virtual ~TabStripModelObserverBridge(); // Overridden from TabStripModelObserver - virtual void TabInsertedAt(TabContentsWrapper* contents, + virtual void TabInsertedAt(TabContents* contents, int index, bool foreground) OVERRIDE; virtual void TabClosingAt(TabStripModel* tab_strip_model, - TabContentsWrapper* contents, + TabContents* contents, int index) OVERRIDE; - virtual void TabDetachedAt(TabContentsWrapper* contents, int index) OVERRIDE; - virtual void ActiveTabChanged(TabContentsWrapper* old_contents, - TabContentsWrapper* new_contents, + virtual void TabDetachedAt(TabContents* contents, int index) OVERRIDE; + virtual void ActiveTabChanged(TabContents* old_contents, + TabContents* new_contents, int index, bool user_gesture) OVERRIDE; - virtual void TabMoved(TabContentsWrapper* contents, + virtual void TabMoved(TabContents* contents, int from_index, int to_index) OVERRIDE; - virtual void TabChangedAt(TabContentsWrapper* contents, int index, + virtual void TabChangedAt(TabContents* contents, int index, TabChangeType change_type) OVERRIDE; virtual void TabReplacedAt(TabStripModel* tab_strip_model, - TabContentsWrapper* old_contents, - TabContentsWrapper* new_contents, + TabContents* old_contents, + TabContents* new_contents, int index) OVERRIDE; - virtual void TabMiniStateChanged(TabContentsWrapper* contents, + virtual void TabMiniStateChanged(TabContents* contents, int index) OVERRIDE; virtual void TabStripEmpty() OVERRIDE; virtual void TabStripModelDeleted() OVERRIDE; @@ -60,27 +59,27 @@ class TabStripModelObserverBridge : public TabStripModelObserver { // Cocoa object to receive updates about changes to a tab strip model. It is // ok to not implement them, the calling code checks before calling. @interface NSObject(TabStripModelBridge) -- (void)insertTabWithContents:(TabContentsWrapper*)contents +- (void)insertTabWithContents:(TabContents*)contents atIndex:(NSInteger)index inForeground:(bool)inForeground; -- (void)tabClosingWithContents:(TabContentsWrapper*)contents +- (void)tabClosingWithContents:(TabContents*)contents atIndex:(NSInteger)index; -- (void)tabDetachedWithContents:(TabContentsWrapper*)contents +- (void)tabDetachedWithContents:(TabContents*)contents atIndex:(NSInteger)index; -- (void)activateTabWithContents:(TabContentsWrapper*)newContents - previousContents:(TabContentsWrapper*)oldContents +- (void)activateTabWithContents:(TabContents*)newContents + previousContents:(TabContents*)oldContents atIndex:(NSInteger)index userGesture:(bool)wasUserGesture; -- (void)tabMovedWithContents:(TabContentsWrapper*)contents +- (void)tabMovedWithContents:(TabContents*)contents fromIndex:(NSInteger)from toIndex:(NSInteger)to; -- (void)tabChangedWithContents:(TabContentsWrapper*)contents +- (void)tabChangedWithContents:(TabContents*)contents atIndex:(NSInteger)index changeType:(TabStripModelObserver::TabChangeType)change; -- (void)tabReplacedWithContents:(TabContentsWrapper*)newContents - previousContents:(TabContentsWrapper*)oldContents +- (void)tabReplacedWithContents:(TabContents*)newContents + previousContents:(TabContents*)oldContents atIndex:(NSInteger)index; -- (void)tabMiniStateChangedWithContents:(TabContentsWrapper*)contents +- (void)tabMiniStateChangedWithContents:(TabContents*)contents atIndex:(NSInteger)index; - (void)tabStripEmpty; - (void)tabStripModelDeleted; diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.mm index 1b5e5c1..8d898b0 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.mm @@ -20,7 +20,7 @@ TabStripModelObserverBridge::~TabStripModelObserverBridge() { model_->RemoveObserver(this); } -void TabStripModelObserverBridge::TabInsertedAt(TabContentsWrapper* contents, +void TabStripModelObserverBridge::TabInsertedAt(TabContents* contents, int index, bool foreground) { if ([controller_ respondsToSelector: @@ -32,7 +32,7 @@ void TabStripModelObserverBridge::TabInsertedAt(TabContentsWrapper* contents, } void TabStripModelObserverBridge::TabClosingAt(TabStripModel* tab_strip_model, - TabContentsWrapper* contents, + TabContents* contents, int index) { if ([controller_ respondsToSelector: @selector(tabClosingWithContents:atIndex:)]) { @@ -40,7 +40,7 @@ void TabStripModelObserverBridge::TabClosingAt(TabStripModel* tab_strip_model, } } -void TabStripModelObserverBridge::TabDetachedAt(TabContentsWrapper* contents, +void TabStripModelObserverBridge::TabDetachedAt(TabContents* contents, int index) { if ([controller_ respondsToSelector: @selector(tabDetachedWithContents:atIndex:)]) { @@ -49,8 +49,8 @@ void TabStripModelObserverBridge::TabDetachedAt(TabContentsWrapper* contents, } void TabStripModelObserverBridge::ActiveTabChanged( - TabContentsWrapper* old_contents, - TabContentsWrapper* new_contents, + TabContents* old_contents, + TabContents* new_contents, int index, bool user_gesture) { if ([controller_ respondsToSelector: @@ -63,7 +63,7 @@ void TabStripModelObserverBridge::ActiveTabChanged( } } -void TabStripModelObserverBridge::TabMoved(TabContentsWrapper* contents, +void TabStripModelObserverBridge::TabMoved(TabContents* contents, int from_index, int to_index) { if ([controller_ respondsToSelector: @@ -74,7 +74,7 @@ void TabStripModelObserverBridge::TabMoved(TabContentsWrapper* contents, } } -void TabStripModelObserverBridge::TabChangedAt(TabContentsWrapper* contents, +void TabStripModelObserverBridge::TabChangedAt(TabContents* contents, int index, TabChangeType change_type) { if ([controller_ respondsToSelector: @@ -87,8 +87,8 @@ void TabStripModelObserverBridge::TabChangedAt(TabContentsWrapper* contents, void TabStripModelObserverBridge::TabReplacedAt( TabStripModel* tab_strip_model, - TabContentsWrapper* old_contents, - TabContentsWrapper* new_contents, + TabContents* old_contents, + TabContents* new_contents, int index) { if ([controller_ respondsToSelector: @selector(tabReplacedWithContents:previousContents:atIndex:)]) { @@ -101,7 +101,7 @@ void TabStripModelObserverBridge::TabReplacedAt( } void TabStripModelObserverBridge::TabMiniStateChanged( - TabContentsWrapper* contents, int index) { + TabContents* contents, int index) { if ([controller_ respondsToSelector: @selector(tabMiniStateChangedWithContents:atIndex:)]) { [controller_ tabMiniStateChangedWithContents:contents atIndex:index]; diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm index 27da6f8..0265fbd 100644 --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm @@ -766,7 +766,7 @@ class NotificationBridge : public content::NotificationObserver { } OpenURLParams params( url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); - browser_->GetSelectedWebContents()->OpenURL(params); + browser_->GetActiveWebContents()->OpenURL(params); } // (URLDropTargetController protocol) @@ -783,7 +783,7 @@ class NotificationBridge : public content::NotificationObserver { OpenURLParams params( url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); - browser_->GetSelectedWebContents()->OpenURL(params); + browser_->GetActiveWebContents()->OpenURL(params); } // (URLDropTargetController protocol) diff --git a/chrome/browser/ui/cocoa/view_id_util_browsertest.mm b/chrome/browser/ui/cocoa/view_id_util_browsertest.mm index a50e741..9143bb8 100644 --- a/chrome/browser/ui/cocoa/view_id_util_browsertest.mm +++ b/chrome/browser/ui/cocoa/view_id_util_browsertest.mm @@ -13,7 +13,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/cocoa/view_id_util.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" diff --git a/chrome/browser/ui/cocoa/web_dialog_window_controller.h b/chrome/browser/ui/cocoa/web_dialog_window_controller.h index 9b7c8ca..288ad75 100644 --- a/chrome/browser/ui/cocoa/web_dialog_window_controller.h +++ b/chrome/browser/ui/cocoa/web_dialog_window_controller.h @@ -17,16 +17,15 @@ class Browser; class WebDialogWindowDelegateBridge; class Profile; class TabContents; -typedef TabContents TabContentsWrapper; // This controller manages a dialog box with properties and HTML content taken // from a WebDialogDelegate object. @interface WebDialogWindowController : NSWindowController<NSWindowDelegate> { @private - // Order here is important, as tab_contents_ may send messages to + // Order here is important, as tabContents_ may send messages to // delegate_ when it gets destroyed. scoped_ptr<WebDialogWindowDelegateBridge> delegate_; - scoped_ptr<TabContentsWrapper> contentsWrapper_; + scoped_ptr<TabContents> tabContents_; } // Creates and shows an WebDialogWindowController with the given diff --git a/chrome/browser/ui/cocoa/web_dialog_window_controller.mm b/chrome/browser/ui/cocoa/web_dialog_window_controller.mm index 44d7f91..7b2fcf7 100644 --- a/chrome/browser/ui/cocoa/web_dialog_window_controller.mm +++ b/chrome/browser/ui/cocoa/web_dialog_window_controller.mm @@ -13,7 +13,7 @@ #import "chrome/browser/ui/browser_dialogs.h" #import "chrome/browser/ui/cocoa/browser_command_executor.h" #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/webui/web_dialog_controller.h" #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" #include "content/public/browser/native_web_keyboard_event.h" @@ -351,18 +351,18 @@ void WebDialogWindowDelegateBridge::HandleKeyboardEvent( } - (void)loadDialogContents { - contentsWrapper_.reset(new TabContentsWrapper(WebContents::Create( + tabContents_.reset(new TabContents(WebContents::Create( delegate_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL))); [[self window] - setContentView:contentsWrapper_->web_contents()->GetNativeView()]; - contentsWrapper_->web_contents()->SetDelegate(delegate_.get()); + setContentView:tabContents_->web_contents()->GetNativeView()]; + tabContents_->web_contents()->SetDelegate(delegate_.get()); // This must be done before loading the page; see the comments in // WebDialogUI. WebDialogUI::GetPropertyAccessor().SetProperty( - contentsWrapper_->web_contents()->GetPropertyBag(), delegate_.get()); + tabContents_->web_contents()->GetPropertyBag(), delegate_.get()); - contentsWrapper_->web_contents()->GetController().LoadURL( + tabContents_->web_contents()->GetController().LoadURL( delegate_->GetDialogContentURL(), content::Referrer(), content::PAGE_TRANSITION_START_PAGE, diff --git a/chrome/browser/ui/cocoa/web_intent_picker_cocoa.h b/chrome/browser/ui/cocoa/web_intent_picker_cocoa.h index 1242a18..89b34ea 100644 --- a/chrome/browser/ui/cocoa/web_intent_picker_cocoa.h +++ b/chrome/browser/ui/cocoa/web_intent_picker_cocoa.h @@ -17,7 +17,6 @@ class ConstrainedWindow; class TabContents; -typedef TabContents TabContentsWrapper; @class WebIntentPickerSheetController; class WebIntentInlineDispositionDelegate; @@ -25,9 +24,9 @@ class WebIntentInlineDispositionDelegate; class WebIntentPickerCocoa : public WebIntentPicker, public WebIntentPickerModelObserver { public: - // |wrapper|, and |delegate| must not be NULL. + // |tab_contents| and |delegate| must not be NULL. // |browser| should only be NULL for testing purposes. - WebIntentPickerCocoa(TabContentsWrapper* wrapper, + WebIntentPickerCocoa(TabContents* tab_contents, WebIntentPickerDelegate* delegate, WebIntentPickerModel* model); virtual ~WebIntentPickerCocoa(); @@ -68,13 +67,13 @@ class WebIntentPickerCocoa : public WebIntentPicker, // The picker model. Weak reference. WebIntentPickerModel* model_; - // Wrapper around the WebContents we're in. Weak Reference. - TabContentsWrapper* wrapper_; + // TabContents we're in. Weak Reference. + TabContents* tab_contents_; WebIntentPickerSheetController* sheet_controller_; // Weak reference. - // Tab contents wrapper to hold intent page if inline disposition is used. - scoped_ptr<TabContentsWrapper> inline_disposition_tab_contents_; + // TabContents to hold intent page if inline disposition is used. + scoped_ptr<TabContents> inline_disposition_tab_contents_; // Delegate for inline disposition tab contents. scoped_ptr<WebIntentInlineDispositionDelegate> inline_disposition_delegate_; diff --git a/chrome/browser/ui/cocoa/web_intent_picker_cocoa.mm b/chrome/browser/ui/cocoa/web_intent_picker_cocoa.mm index d84dd60..f6141f1 100644 --- a/chrome/browser/ui/cocoa/web_intent_picker_cocoa.mm +++ b/chrome/browser/ui/cocoa/web_intent_picker_cocoa.mm @@ -19,7 +19,7 @@ #include "chrome/browser/ui/intents/web_intent_inline_disposition_delegate.h" #include "chrome/browser/ui/intents/web_intent_picker.h" #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "content/public/browser/web_contents.h" #include "skia/ext/skia_utils_mac.h" #include "ui/gfx/image/image.h" @@ -66,32 +66,32 @@ void ConstrainedPickerSheetDelegate::DeleteDelegate() { } // namespace // static -WebIntentPicker* WebIntentPicker::Create(TabContentsWrapper* wrapper, +WebIntentPicker* WebIntentPicker::Create(TabContents* tab_contents, WebIntentPickerDelegate* delegate, WebIntentPickerModel* model) { - return new WebIntentPickerCocoa(wrapper, delegate, model); + return new WebIntentPickerCocoa(tab_contents, delegate, model); } WebIntentPickerCocoa::WebIntentPickerCocoa() : delegate_(NULL), model_(NULL), - wrapper_(NULL), + tab_contents_(NULL), sheet_controller_(nil), service_invoked(false) { } -WebIntentPickerCocoa::WebIntentPickerCocoa(TabContentsWrapper* wrapper, +WebIntentPickerCocoa::WebIntentPickerCocoa(TabContents* tab_contents, WebIntentPickerDelegate* delegate, WebIntentPickerModel* model) : delegate_(delegate), model_(model), - wrapper_(wrapper), + tab_contents_(tab_contents), sheet_controller_(nil), service_invoked(false) { model_->set_observer(this); DCHECK(delegate); - DCHECK(wrapper); + DCHECK(tab_contents); sheet_controller_ = [ [WebIntentPickerSheetController alloc] initWithPicker:this]; @@ -100,7 +100,7 @@ WebIntentPickerCocoa::WebIntentPickerCocoa(TabContentsWrapper* wrapper, ConstrainedPickerSheetDelegate* constrained_delegate = new ConstrainedPickerSheetDelegate(this, sheet_controller_); - window_ = new ConstrainedWindowMac(wrapper, constrained_delegate); + window_ = new ConstrainedWindowMac(tab_contents, constrained_delegate); } WebIntentPickerCocoa::~WebIntentPickerCocoa() { @@ -157,13 +157,13 @@ void WebIntentPickerCocoa::OnExtensionIconChanged( void WebIntentPickerCocoa::OnInlineDisposition(WebIntentPickerModel* model, const GURL& url) { content::WebContents* web_contents = content::WebContents::Create( - wrapper_->profile(), - tab_util::GetSiteInstanceForNewTab(wrapper_->profile(), url), + tab_contents_->profile(), + tab_util::GetSiteInstanceForNewTab(tab_contents_->profile(), url), MSG_ROUTING_NONE, NULL, NULL); - inline_disposition_tab_contents_.reset(new TabContentsWrapper(web_contents)); + inline_disposition_tab_contents_.reset(new TabContents(web_contents)); inline_disposition_delegate_.reset( new WebIntentInlineDispositionDelegate(this, web_contents, - wrapper_->profile())); + tab_contents_->profile())); // Must call this immediately after WebContents creation to avoid race // with load. diff --git a/chrome/browser/ui/cocoa/web_intent_sheet_controller.h b/chrome/browser/ui/cocoa/web_intent_sheet_controller.h index 823f28b..eafea40 100644 --- a/chrome/browser/ui/cocoa/web_intent_sheet_controller.h +++ b/chrome/browser/ui/cocoa/web_intent_sheet_controller.h @@ -25,7 +25,7 @@ class WebIntentPickerModel; WebIntentPickerCocoa* picker_; // Inline disposition tab contents. Weak reference. - TabContentsWrapper* contents_; + TabContents* contents_; // The intent picker data to be rendered. Weak reference. WebIntentPickerModel* model_; @@ -42,7 +42,7 @@ class WebIntentPickerModel; - (id)initWithPicker:(WebIntentPickerCocoa*)picker; // Set the contents for inline disposition intents. -- (void)setInlineDispositionTabContents:(TabContentsWrapper*)wrapper; +- (void)setInlineDispositionTabContents:(TabContents*)tab_contents; // Set the size of the inline disposition view. - (void)setInlineDispositionFrameSize:(NSSize)size; diff --git a/chrome/browser/ui/cocoa/web_intent_sheet_controller.mm b/chrome/browser/ui/cocoa/web_intent_sheet_controller.mm index d6cdc59..eaa85a6 100644 --- a/chrome/browser/ui/cocoa/web_intent_sheet_controller.mm +++ b/chrome/browser/ui/cocoa/web_intent_sheet_controller.mm @@ -15,7 +15,7 @@ #include "chrome/browser/ui/cocoa/web_intent_picker_cocoa.h" #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" #include "chrome/browser/ui/intents/web_intent_picker_model.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "content/public/browser/web_contents_view.h" #include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" @@ -502,8 +502,8 @@ NSButton* CreateHyperlinkButton(NSString* title, const NSRect& frame) { picker_->OnSheetDidEnd(sheet); } -- (void)setInlineDispositionTabContents:(TabContentsWrapper*)wrapper { - contents_ = wrapper; +- (void)setInlineDispositionTabContents:(TabContents*)tabContents { + contents_ = tabContents; } - (void)setInlineDispositionFrameSize:(NSSize)inlineContentSize { diff --git a/chrome/browser/ui/cocoa/web_intent_sheet_controller_browsertest.mm b/chrome/browser/ui/cocoa/web_intent_sheet_controller_browsertest.mm index 1fe3eed..50a1d58 100644 --- a/chrome/browser/ui/cocoa/web_intent_sheet_controller_browsertest.mm +++ b/chrome/browser/ui/cocoa/web_intent_sheet_controller_browsertest.mm @@ -29,7 +29,7 @@ class MockIntentPickerDelegate : public WebIntentPickerDelegate { class WebIntentSheetControllerBrowserTest : public InProcessBrowserTest { public: - void CreateBubble(TabContentsWrapper* wrapper); + void CreateBubble(TabContents* tab_contents); void CreatePicker(); WebIntentPickerSheetController* controller_; // Weak, owns self. @@ -40,8 +40,8 @@ class WebIntentSheetControllerBrowserTest : public InProcessBrowserTest { }; void WebIntentSheetControllerBrowserTest::CreateBubble( - TabContentsWrapper* wrapper) { - picker_.reset(new WebIntentPickerCocoa(wrapper, &delegate_, &model_)); + TabContents* tab_contents) { + picker_.reset(new WebIntentPickerCocoa(tab_contents, &delegate_, &model_)); controller_ = [[WebIntentPickerSheetController alloc] initWithPicker:picker_.get()]; @@ -58,7 +58,7 @@ void WebIntentSheetControllerBrowserTest::CreatePicker() { } IN_PROC_BROWSER_TEST_F(WebIntentSheetControllerBrowserTest, CloseWillClose) { - CreateBubble(browser()->GetSelectedTabContentsWrapper()); + CreateBubble(browser()->GetActiveTabContents()); EXPECT_CALL(delegate_, OnPickerClosed()).Times(0); EXPECT_CALL(delegate_, OnClosing()); @@ -69,7 +69,7 @@ IN_PROC_BROWSER_TEST_F(WebIntentSheetControllerBrowserTest, CloseWillClose) { IN_PROC_BROWSER_TEST_F(WebIntentSheetControllerBrowserTest, DontCancelAfterServiceInvokation) { - CreateBubble(browser()->GetSelectedTabContentsWrapper()); + CreateBubble(browser()->GetActiveTabContents()); GURL url; model_.AddInstalledService(string16(), url, |