diff options
| author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-18 16:17:49 +0000 |
|---|---|---|
| committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-18 16:17:49 +0000 |
| commit | 3c9e187bd8ec34ebf2a91a37c868584c465647e8 (patch) | |
| tree | 84c9540d220fa155cf2af8c944638c0719dee670 /chrome/browser/ui/browser_navigator.cc | |
| parent | 3e35b224fd0c36f17f432f23e2eb3729667210b1 (diff) | |
| download | chromium_src-3c9e187bd8ec34ebf2a91a37c868584c465647e8.zip chromium_src-3c9e187bd8ec34ebf2a91a37c868584c465647e8.tar.gz chromium_src-3c9e187bd8ec34ebf2a91a37c868584c465647e8.tar.bz2 | |
Make pink's TabContentsWrapper change compile on Windows.
Code by pinkerton@, with modifications by evanm and myself to get it to build on windows/linux/chromeos.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/4694008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66626 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_navigator.cc')
| -rw-r--r-- | chrome/browser/ui/browser_navigator.cc | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index 7143bdf..cde98d9 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -14,6 +14,7 @@ #include "chrome/browser/status_bubble.h" #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/browser/tab_contents_wrapper.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" @@ -82,16 +83,18 @@ int GetIndexOfSingletonTab(browser::NavigateParams* params) { &reverse_on_redirect); for (int i = 0; i < params->browser->tab_count(); ++i) { - TabContents* tab = params->browser->GetTabContentsAt(i); + TabContentsWrapper* tab = + params->browser->GetTabContentsWrapperAt(i); url_canon::Replacements<char> replacements; replacements.ClearRef(); if (params->ignore_path) replacements.ClearPath(); - if (CompareURLsWithReplacements(tab->GetURL(), params->url, replacements) || - CompareURLsWithReplacements(tab->GetURL(), rewritten_url, - replacements)) { + if (CompareURLsWithReplacements(tab->tab_contents()->GetURL(), + params->url, replacements) || + CompareURLsWithReplacements(tab->tab_contents()->GetURL(), + rewritten_url, replacements)) { params->target_contents = tab; return i; } @@ -130,7 +133,8 @@ Browser* GetBrowserForDisposition(browser::NavigateParams* params) { // target browser. This must happen first, before GetBrowserForDisposition() // has a chance to replace |params->browser| with another one. if (!params->source_contents && params->browser) - params->source_contents = params->browser->GetSelectedTabContents(); + params->source_contents = + params->browser->GetSelectedTabContentsWrapper(); Profile* profile = params->browser ? params->browser->profile() : params->profile; @@ -158,7 +162,8 @@ Browser* GetBrowserForDisposition(browser::NavigateParams* params) { // |source| represents an app. Browser::Type type = Browser::TYPE_POPUP; if ((params->browser && params->browser->type() == Browser::TYPE_APP) || - (params->source_contents && params->source_contents->is_app())) { + (params->source_contents && + params->source_contents->is_app())) { type = Browser::TYPE_APP_POPUP; } if (profile) { @@ -272,13 +277,13 @@ class ScopedTargetContentsOwner { } // Relinquishes ownership of |params_|' target_contents. - TabContents* ReleaseOwnership() { + TabContentsWrapper* ReleaseOwnership() { return target_contents_owner_.release(); } private: browser::NavigateParams* params_; - scoped_ptr<TabContents> target_contents_owner_; + scoped_ptr<TabContentsWrapper> target_contents_owner_; DISALLOW_COPY_AND_ASSIGN(ScopedTargetContentsOwner); }; @@ -303,7 +308,7 @@ NavigateParams::NavigateParams( } NavigateParams::NavigateParams(Browser* a_browser, - TabContents* a_target_contents) + TabContentsWrapper* a_target_contents) : target_contents(a_target_contents), source_contents(NULL), disposition(CURRENT_TAB), @@ -354,12 +359,15 @@ void Navigate(NavigateParams* params) { // supposed to target a new tab. if (!params->target_contents) { if (params->disposition != CURRENT_TAB) { + TabContents* source_contents = params->source_contents ? + params->source_contents->tab_contents() : NULL; params->target_contents = - new TabContents(params->browser->profile(), - GetSiteInstance(params->source_contents, params->url), - MSG_ROUTING_NONE, - params->source_contents, - NULL); + Browser::TabContentsFactory( + params->browser->profile(), + GetSiteInstance(source_contents, params->url), + MSG_ROUTING_NONE, + source_contents, + NULL); // This function takes ownership of |params->target_contents| until it // is added to a TabStripModel. target_contents_owner.TakeOwnership(); @@ -370,7 +378,7 @@ void Navigate(NavigateParams* params) { // in the background, tell it that it's hidden. if ((params->tabstrip_add_types & TabStripModel::ADD_SELECTED) == 0) { // TabStripModel::AddTabContents invokes HideContents if not foreground. - params->target_contents->WasHidden(); + params->target_contents->tab_contents()->WasHidden(); } } else { // ... otherwise if we're loading in the current tab, the target is the @@ -381,7 +389,7 @@ void Navigate(NavigateParams* params) { if (user_initiated) { RenderViewHostDelegate::BrowserIntegration* integration = - params->target_contents; + params->target_contents->tab_contents(); integration->OnUserGesture(); } @@ -397,10 +405,11 @@ void Navigate(NavigateParams* params) { } if (params->source_contents == params->target_contents) { - // The navigation occurred in the source tab, so update the UI. - params->browser->UpdateUIForNavigationInTab(params->target_contents, - params->transition, - user_initiated); + // The navigation occurred in the source tab. + params->browser->UpdateUIForNavigationInTab( + params->target_contents, + params->transition, + user_initiated); } else { // The navigation occurred in some other tab. int singleton_index = GetIndexOfSingletonTab(params); |
