| Index: chrome/browser/ui/browser_navigator.cc
|
| ===================================================================
|
| --- chrome/browser/ui/browser_navigator.cc (revision 66453)
|
| +++ chrome/browser/ui/browser_navigator.cc (working copy)
|
| @@ -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"
|
| @@ -85,9 +86,9 @@
|
| &reverse_on_redirect);
|
|
|
| for (int i = 0; i < params->browser->tab_count(); ++i) {
|
| - TabContents* tab = params->browser->GetTabContentsAt(i);
|
| - if (CompareURLsIgnoreRef(tab->GetURL(), params->url) ||
|
| - CompareURLsIgnoreRef(tab->GetURL(), rewritten_url)) {
|
| + TabContentsWrapper* tab = params->browser->GetTabContentsWrapperAt(i);
|
| + if (CompareURLsIgnoreRef(tab->tab_contents()->GetURL(), params->url) ||
|
| + CompareURLsIgnoreRef(tab->tab_contents()->GetURL(), rewritten_url)) {
|
| params->target_contents = tab;
|
| return i;
|
| }
|
| @@ -125,7 +126,8 @@
|
| // 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;
|
| @@ -153,7 +155,8 @@
|
| // |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) {
|
| @@ -257,13 +260,13 @@
|
| }
|
|
|
| // 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);
|
| };
|
|
|
| @@ -288,7 +291,7 @@
|
| }
|
|
|
| NavigateParams::NavigateParams(Browser* a_browser,
|
| - TabContents* a_target_contents)
|
| + TabContentsWrapper* a_target_contents)
|
| : target_contents(a_target_contents),
|
| source_contents(NULL),
|
| disposition(CURRENT_TAB),
|
| @@ -332,12 +335,15 @@
|
| // 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();
|
| @@ -348,7 +354,7 @@
|
| // 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
|
| @@ -359,7 +365,7 @@
|
|
|
| if (user_initiated) {
|
| RenderViewHostDelegate::BrowserIntegration* integration =
|
| - params->target_contents;
|
| + params->target_contents->tab_contents();
|
| integration->OnUserGesture();
|
| }
|
|
|
| @@ -375,10 +381,11 @@
|
| }
|
|
|
| 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);
|
|
|