summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-06 12:43:20 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-06 12:43:20 +0000
commite232c994217b5d29a8cbdd98cdf81041a1db7c6f (patch)
tree0c295b7eb99a9964b9203329404ac5559596c51e
parent01a0026b14dc7943c2000bcc5a21225a69ed519f (diff)
downloadchromium_src-e232c994217b5d29a8cbdd98cdf81041a1db7c6f.zip
chromium_src-e232c994217b5d29a8cbdd98cdf81041a1db7c6f.tar.gz
chromium_src-e232c994217b5d29a8cbdd98cdf81041a1db7c6f.tar.bz2
Remove TabContents from chrome::Navigate.
BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11419235 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171472 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/api/identity/web_auth_flow.cc3
-rw-r--r--chrome/browser/extensions/api/tabs/tabs.cc6
-rw-r--r--chrome/browser/extensions/extension_install_ui_default.cc2
-rw-r--r--chrome/browser/extensions/extension_tab_util.cc4
-rw-r--r--chrome/browser/instant/instant_unload_handler.cc4
-rw-r--r--chrome/browser/ssl/ssl_browser_tests.cc24
-rw-r--r--chrome/browser/ui/browser.cc16
-rw-r--r--chrome/browser/ui/browser.h17
-rw-r--r--chrome/browser/ui/browser_navigator.cc101
-rw-r--r--chrome/browser/ui/browser_navigator.h26
-rw-r--r--chrome/browser/ui/browser_navigator_browsertest.cc29
-rw-r--r--chrome/browser/ui/browser_navigator_browsertest.h7
-rw-r--r--chrome/browser/ui/browser_tabstrip.cc17
-rw-r--r--chrome/browser/ui/cocoa/applescript/window_applescript.mm5
-rw-r--r--chrome/browser/ui/extensions/application_launch.cc2
-rw-r--r--chrome/browser/ui/extensions/shell_window.cc7
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc2
-rw-r--r--chrome/browser/ui/intents/web_intent_picker_controller.cc11
-rw-r--r--chrome/browser/ui/panels/panel_host.cc11
-rw-r--r--chrome/browser/ui/singleton_tabs.cc11
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents.h11
-rw-r--r--chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc2
-rw-r--r--chrome/browser/ui/webui/chrome_web_contents_handler.cc11
-rw-r--r--chrome/test/base/browser_with_test_window_test.cc2
24 files changed, 154 insertions, 177 deletions
diff --git a/chrome/browser/extensions/api/identity/web_auth_flow.cc b/chrome/browser/extensions/api/identity/web_auth_flow.cc
index 1d602a1..b714980 100644
--- a/chrome/browser/extensions/api/identity/web_auth_flow.cc
+++ b/chrome/browser/extensions/api/identity/web_auth_flow.cc
@@ -112,8 +112,7 @@ void WebAuthFlow::ShowAuthFlowPopup() {
Browser::CreateParams browser_params(Browser::TYPE_POPUP, profile_);
browser_params.initial_bounds = initial_bounds_;
Browser* browser = new Browser(browser_params);
- chrome::NavigateParams params(
- browser, TabContents::Factory::CreateTabContents(contents_));
+ chrome::NavigateParams params(browser, contents_);
params.disposition = CURRENT_TAB;
params.window_action = chrome::NavigateParams::SHOW_WINDOW;
chrome::Navigate(&params);
diff --git a/chrome/browser/extensions/api/tabs/tabs.cc b/chrome/browser/extensions/api/tabs/tabs.cc
index d24260f..1e2c146 100644
--- a/chrome/browser/extensions/api/tabs/tabs.cc
+++ b/chrome/browser/extensions/api/tabs/tabs.cc
@@ -1099,17 +1099,17 @@ bool CreateTabFunction::RunImpl() {
// The tab may have been created in a different window, so make sure we look
// at the right tab strip.
tab_strip = params.browser->tab_strip_model();
- int new_index = tab_strip->GetIndexOfTabContents(params.target_contents);
+ int new_index = tab_strip->GetIndexOfWebContents(params.target_contents);
if (opener)
tab_strip->SetOpenerOfWebContentsAt(new_index, opener);
if (active)
- params.target_contents->web_contents()->GetView()->SetInitialFocus();
+ params.target_contents->GetView()->SetInitialFocus();
// Return data about the newly created tab.
if (has_callback()) {
SetResult(ExtensionTabUtil::CreateTabValue(
- params.target_contents->web_contents(),
+ params.target_contents,
tab_strip, new_index, GetExtension()));
}
diff --git a/chrome/browser/extensions/extension_install_ui_default.cc b/chrome/browser/extensions/extension_install_ui_default.cc
index a63eff6..64254fb 100644
--- a/chrome/browser/extensions/extension_install_ui_default.cc
+++ b/chrome/browser/extensions/extension_install_ui_default.cc
@@ -257,7 +257,7 @@ void ExtensionInstallUI::OpenAppInstalledUI(Browser* browser,
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_APP_INSTALLED_TO_NTP,
- content::Source<WebContents>(params.target_contents->web_contents()),
+ content::Source<WebContents>(params.target_contents),
content::Details<const std::string>(&app_id));
} else {
#if defined(USE_ASH)
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index 2693447..1e93763 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -237,9 +237,7 @@ void ExtensionTabUtil::CreateTab(WebContents* web_contents,
const bool browser_created = !browser;
if (!browser)
browser = new Browser(Browser::CreateParams(profile));
- TabContents* tab_contents =
- TabContents::Factory::CreateTabContents(web_contents);
- chrome::NavigateParams params(browser, tab_contents);
+ chrome::NavigateParams params(browser, web_contents);
// The extension_app_id parameter ends up as app_name in the Browser
// which causes the Browser to return true for is_app(). This affects
diff --git a/chrome/browser/instant/instant_unload_handler.cc b/chrome/browser/instant/instant_unload_handler.cc
index a93b176..268e2b3 100644
--- a/chrome/browser/instant/instant_unload_handler.cc
+++ b/chrome/browser/instant/instant_unload_handler.cc
@@ -8,7 +8,6 @@
#include "base/message_loop.h"
#include "chrome/browser/ui/browser_navigator.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_delegate.h"
@@ -79,8 +78,7 @@ void InstantUnloadHandler::RunUnloadListenersOrDestroy(
void InstantUnloadHandler::Activate(WebContentsDelegateImpl* delegate,
content::WebContents* contents,
int index) {
- chrome::NavigateParams params(browser_,
- TabContents::FromWebContents(contents));
+ chrome::NavigateParams params(browser_, contents);
params.disposition = NEW_FOREGROUND_TAB;
params.tabstrip_index = index;
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index ae325c6..bffc938 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -908,10 +908,10 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) {
ui_test_utils::NavigateToURL(browser(),
https_server_.GetURL("files/ssl/blank_page.html"));
- TabContents* tab1 = browser()->tab_strip_model()->GetActiveTabContents();
+ WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents();
// This tab should be fine.
- CheckAuthenticatedState(tab1->web_contents(), false);
+ CheckAuthenticatedState(tab1, false);
// Create a new tab.
std::string replacement_path;
@@ -929,14 +929,14 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) {
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::Navigate(&params);
- TabContents* tab2 = params.target_contents;
+ WebContents* tab2 = params.target_contents;
observer.Wait();
// The new tab has insecure content.
- CheckAuthenticatedState(tab2->web_contents(), true);
+ CheckAuthenticatedState(tab2, true);
// The original tab should not be contaminated.
- CheckAuthenticatedState(tab1->web_contents(), false);
+ CheckAuthenticatedState(tab1, false);
}
// Visits two pages from the same origin: one that runs insecure content and one
@@ -949,10 +949,10 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) {
ui_test_utils::NavigateToURL(browser(),
https_server_.GetURL("files/ssl/blank_page.html"));
- TabContents* tab1 = browser()->tab_strip_model()->GetActiveTabContents();
+ WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents();
// This tab should be fine.
- CheckAuthenticatedState(tab1->web_contents(), false);
+ CheckAuthenticatedState(tab1, false);
std::string replacement_path;
ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
@@ -971,19 +971,19 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) {
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::Navigate(&params);
- TabContents* tab2 = params.target_contents;
+ WebContents* tab2 = params.target_contents;
observer.Wait();
// Both tabs should have the same process.
- EXPECT_EQ(tab1->web_contents()->GetRenderProcessHost(),
- tab2->web_contents()->GetRenderProcessHost());
+ EXPECT_EQ(tab1->GetRenderProcessHost(),
+ tab2->GetRenderProcessHost());
// The new tab has insecure content.
- CheckAuthenticationBrokenState(tab2->web_contents(), 0, true, false);
+ CheckAuthenticationBrokenState(tab2, 0, true, false);
// Which means the origin for the first tab has also been contaminated with
// insecure content.
- CheckAuthenticationBrokenState(tab1->web_contents(), 0, true, false);
+ CheckAuthenticationBrokenState(tab1, 0, true, false);
}
// Visits a page with an image over http. Visits another page over https
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index f468ebf..761d17c 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -990,13 +990,13 @@ void Browser::RequestMediaAccessPermissionHelper(
}
}
-void Browser::UpdateUIForNavigationInTab(TabContents* contents,
+void Browser::UpdateUIForNavigationInTab(WebContents* contents,
content::PageTransition transition,
bool user_initiated) {
- tab_strip_model_->TabNavigating(contents->web_contents(), transition);
+ tab_strip_model_->TabNavigating(contents, transition);
bool contents_is_selected =
- contents == tab_strip_model_->GetActiveTabContents();
+ contents == tab_strip_model_->GetActiveWebContents();
if (user_initiated && contents_is_selected && window()->GetLocationBar()) {
// Forcibly reset the location bar if the url is going to change in the
// current tab, since otherwise it won't discard any ongoing user edits,
@@ -1013,10 +1013,10 @@ void Browser::UpdateUIForNavigationInTab(TabContents* contents,
// displaying a favicon, which controls the throbber. If we updated it here,
// the throbber will show the default favicon for a split second when
// navigating away from the new tab page.
- ScheduleUIUpdate(contents->web_contents(), content::INVALIDATE_TYPE_URL);
+ ScheduleUIUpdate(contents, content::INVALIDATE_TYPE_URL);
if (contents_is_selected)
- contents->web_contents()->Focus();
+ contents->Focus();
}
///////////////////////////////////////////////////////////////////////////////
@@ -1323,8 +1323,7 @@ void Browser::MaybeUpdateBookmarkBarStateForInstantPreview(
WebContents* Browser::OpenURLFromTab(WebContents* source,
const OpenURLParams& params) {
chrome::NavigateParams nav_params(this, params.url, params.transition);
- nav_params.source_contents =
- source ? TabContents::FromWebContents(source) : NULL;
+ nav_params.source_contents = source;
nav_params.referrer = params.referrer;
nav_params.extra_headers = params.extra_headers;
nav_params.disposition = params.disposition;
@@ -1338,8 +1337,7 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
nav_params.is_cross_site_redirect = params.is_cross_site_redirect;
chrome::Navigate(&nav_params);
- return nav_params.target_contents ?
- nav_params.target_contents->web_contents() : NULL;
+ return nav_params.target_contents;
}
void Browser::NavigationStateChanged(const WebContents* source,
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 34c480e..ca926ab 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -416,7 +416,7 @@ class Browser : public TabStripModelObserver,
// Called by chrome::Navigate() when a navigation has occurred in a tab in
// this Browser. Updates the UI for the start of this navigation.
- void UpdateUIForNavigationInTab(TabContents* contents,
+ void UpdateUIForNavigationInTab(content::WebContents* contents,
content::PageTransition transition,
bool user_initiated);
@@ -425,7 +425,18 @@ class Browser : public TabStripModelObserver,
class Adoption {
private:
friend class Browser;
+
+ // chrome::Navigate creates WebContents that are destined for the tab strip,
+ // and that might have WebUI that immediately calls back into random tab
+ // helpers. It, alas, needs special permission to create the complete tab
+ // helper environment.
+ friend class BrowserNavigatorWebContentsAdoption;
+
+ // BrowserTabStripModelDelegate receives the notifications from the
+ // TabStripModel that a WebContents is being inserted into the tab strip. It
+ // needs the power to set up any necessary tab helpers.
friend class chrome::BrowserTabStripModelDelegate;
+
// Chrome Frame is a special case. Chrome Frame is defined as a complete
// tab of Chrome inside of an IE window, so it has the unique privilege of
// asking Browser to set up a WebContents to have the full complement of tab
@@ -801,8 +812,8 @@ class Browser : public TabStripModelObserver,
// Adoption functions ////////////////////////////////////////////////////////
- // Sets the specified browser as the delegate of all the parts of the
- // TabContents that are needed.
+ // Sets the specified browser as the delegate of the WebContents and all the
+ // associated tab helpers that are needed.
void SetAsDelegate(content::WebContents* web_contents, Browser* delegate);
// Assorted utility functions ///////////////////////////////////////////////
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index 248b841..68fff80 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -21,12 +21,10 @@
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/browser/ui/status_bubble.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_notification_types.h"
@@ -41,6 +39,13 @@
using content::GlobalRequestID;
using content::WebContents;
+class BrowserNavigatorWebContentsAdoption {
+ public:
+ static void AdoptAsTabContents(content::WebContents* contents) {
+ Browser::Adoption::AdoptAsTabContents(contents);
+ }
+};
+
namespace {
// Returns true if the specified Browser can open tabs. Not all Browsers support
@@ -69,7 +74,7 @@ Browser* GetOrCreateBrowser(Profile* profile,
bool AdjustNavigateParamsForURL(chrome::NavigateParams* params) {
if (params->target_contents != NULL ||
chrome::IsURLAllowedInIncognito(params->url,
- params->initiating_profile) ||
+ params->initiating_profile) ||
Profile::IsGuestSession()) {
return true;
}
@@ -99,13 +104,13 @@ bool AdjustNavigateParamsForURL(chrome::NavigateParams* params) {
// |params|. This might just return the same Browser specified in |params|, or
// some other if that Browser is deemed incompatible.
Browser* GetBrowserForDisposition(chrome::NavigateParams* params) {
- // If no source TabContents was specified, we use the selected one from
+ // If no source WebContents was specified, we use the selected one from
// the 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->tab_strip_model()->GetActiveTabContents();
+ params->browser->tab_strip_model()->GetActiveWebContents();
}
Profile* profile = params->initiating_profile;
@@ -137,9 +142,8 @@ Browser* GetBrowserForDisposition(chrome::NavigateParams* params) {
app_name = params->browser->app_name();
} else if (params->source_contents) {
extensions::TabHelper* extensions_tab_helper =
- extensions::TabHelper::FromWebContents(
- params->source_contents->web_contents());
- if (extensions_tab_helper->is_app()) {
+ extensions::TabHelper::FromWebContents(params->source_contents);
+ if (extensions_tab_helper && extensions_tab_helper->is_app()) {
app_name = web_app::GenerateApplicationNameFromExtensionId(
extensions_tab_helper->extension_app()->id());
}
@@ -216,8 +220,10 @@ void NormalizeDisposition(chrome::NavigateParams* params) {
// Obtain the profile used by the code that originated the Navigate() request.
Profile* GetSourceProfile(chrome::NavigateParams* params) {
- if (params->source_contents)
- return params->source_contents->profile();
+ if (params->source_contents) {
+ return Profile::FromBrowserContext(
+ params->source_contents->GetBrowserContext());
+ }
return params->initiating_profile;
}
@@ -259,12 +265,12 @@ class ScopedBrowserDisplayer {
DISALLOW_COPY_AND_ASSIGN(ScopedBrowserDisplayer);
};
-// This class manages the lifetime of a TabContents created by the
-// Navigate() function. When Navigate() creates a TabContents for a URL,
+// This class manages the lifetime of a WebContents created by the
+// Navigate() function. When Navigate() creates a WebContents for a URL,
// an instance of this class takes ownership of it via TakeOwnership() until the
-// TabContents is added to a tab strip at which time ownership is
+// WebContents is added to a tab strip at which time ownership is
// relinquished via ReleaseOwnership(). If this object goes out of scope without
-// being added to a tab strip, the created TabContents is deleted to
+// being added to a tab strip, the created WebContents is deleted to
// avoid a leak and the params->target_contents field is set to NULL.
class ScopedTargetContentsOwner {
public:
@@ -283,25 +289,24 @@ class ScopedTargetContentsOwner {
}
// Relinquishes ownership of |params_|' target_contents.
- TabContents* ReleaseOwnership() {
+ WebContents* ReleaseOwnership() {
return target_contents_owner_.release();
}
private:
chrome::NavigateParams* params_;
- scoped_ptr<TabContents> target_contents_owner_;
+ scoped_ptr<WebContents> target_contents_owner_;
DISALLOW_COPY_AND_ASSIGN(ScopedTargetContentsOwner);
};
// If a prerendered page exists for |url|, replace the page at |target_contents|
// with it.
-bool SwapInPrerender(TabContents* target_contents, const GURL& url) {
+bool SwapInPrerender(WebContents* target_contents, const GURL& url) {
prerender::PrerenderManager* prerender_manager =
prerender::PrerenderManagerFactory::GetForProfile(
- target_contents->profile());
- WebContents* web_contents = target_contents->web_contents();
+ Profile::FromBrowserContext(target_contents->GetBrowserContext()));
return prerender_manager &&
- prerender_manager->MaybeUsePrerenderedPage(web_contents, url);
+ prerender_manager->MaybeUsePrerenderedPage(target_contents, url);
}
} // namespace
@@ -333,7 +338,7 @@ NavigateParams::NavigateParams(Browser* a_browser,
}
NavigateParams::NavigateParams(Browser* a_browser,
- TabContents* a_target_contents)
+ WebContents* a_target_contents)
: target_contents(a_target_contents),
source_contents(NULL),
disposition(CURRENT_TAB),
@@ -399,7 +404,6 @@ void Navigate(NavigateParams* params) {
}
params->browser = GetBrowserForDisposition(params);
-
if (!params->browser)
return;
@@ -415,7 +419,7 @@ void Navigate(NavigateParams* params) {
// Make sure the Browser is shown if params call for it.
ScopedBrowserDisplayer displayer(params);
- // Makes sure any TabContents created by this function is destroyed if
+ // Makes sure any WebContents created by this function is destroyed if
// not properly added to a tab strip.
ScopedTargetContentsOwner target_contents_owner(params);
@@ -437,7 +441,7 @@ void Navigate(NavigateParams* params) {
}
// Determine if the navigation was user initiated. If it was, we need to
- // inform the target TabContents, and we may need to update the UI.
+ // inform the target WebContents, and we may need to update the UI.
content::PageTransition base_transition =
content::PageTransitionStripQualifier(params->transition);
bool user_initiated =
@@ -452,7 +456,7 @@ void Navigate(NavigateParams* params) {
// Check if this is a singleton tab that already exists
int singleton_index = chrome::GetIndexOfSingletonTab(params);
- // If no target TabContents was specified, we need to construct one if
+ // If no target WebContents was specified, we need to construct one if
// we are supposed to target a new tab; unless it's a singleton that already
// exists.
if (!params->target_contents && singleton_index < 0) {
@@ -466,28 +470,28 @@ void Navigate(NavigateParams* params) {
}
if (params->disposition != CURRENT_TAB) {
- WebContents* source_contents = params->source_contents ?
- params->source_contents->web_contents() : NULL;
- params->target_contents =
- chrome::TabContentsFactory(
- params->browser->profile(),
- tab_util::GetSiteInstanceForNewTab(
- params->browser->profile(), url),
- MSG_ROUTING_NONE,
- source_contents);
+ params->target_contents = WebContents::Create(
+ params->browser->profile(),
+ tab_util::GetSiteInstanceForNewTab(params->browser->profile(), url),
+ MSG_ROUTING_NONE,
+ params->source_contents);
+ // New tabs can have WebUI URLs that will make calls back to arbitrary
+ // tab helpers, so the entire set of tab helpers needs to be set up
+ // immediately.
+ BrowserNavigatorWebContentsAdoption::AdoptAsTabContents(
+ params->target_contents);
// This function takes ownership of |params->target_contents| until it
// is added to a TabStripModel.
target_contents_owner.TakeOwnership();
- extensions::TabHelper::FromWebContents(
- params->target_contents->web_contents())->
- SetExtensionAppById(params->extension_app_id);
- // TODO(sky): figure out why this is needed. Without it we seem to get
+ extensions::TabHelper::FromWebContents(params->target_contents)->
+ SetExtensionAppById(params->extension_app_id);
+ // TODO(sky): Figure out why this is needed. Without it we seem to get
// failures in startup tests.
// By default, content believes it is not hidden. When adding contents
// in the background, tell it that it's hidden.
if ((params->tabstrip_add_types & TabStripModel::ADD_ACTIVE) == 0) {
// TabStripModel::AddWebContents invokes WasHidden if not foreground.
- params->target_contents->web_contents()->WasHidden();
+ params->target_contents->WasHidden();
}
} else {
// ... otherwise if we're loading in the current tab, the target is the
@@ -497,7 +501,7 @@ void Navigate(NavigateParams* params) {
}
if (user_initiated)
- params->target_contents->web_contents()->UserGestureDone();
+ params->target_contents->UserGestureDone();
if (SwapInPrerender(params->target_contents, url))
return;
@@ -508,7 +512,7 @@ void Navigate(NavigateParams* params) {
// Perform the actual navigation, tracking whether it came from the
// renderer.
- LoadURLInContents(params->target_contents->web_contents(), url, params);
+ LoadURLInContents(params->target_contents, url, params);
}
} else {
// |target_contents| was specified non-NULL, and so we assume it has already
@@ -523,14 +527,13 @@ void Navigate(NavigateParams* params) {
(params->disposition == NEW_FOREGROUND_TAB ||
params->disposition == NEW_WINDOW) &&
(params->tabstrip_add_types & TabStripModel::ADD_INHERIT_OPENER))
- params->source_contents->web_contents()->Focus();
+ params->source_contents->Focus();
if (params->source_contents == params->target_contents) {
// The navigation occurred in the source tab.
- params->browser->UpdateUIForNavigationInTab(
- params->target_contents,
- params->transition,
- user_initiated);
+ params->browser->UpdateUIForNavigationInTab(params->target_contents,
+ params->transition,
+ user_initiated);
} else if (singleton_index == -1) {
// If some non-default value is set for the index, we should tell the
// TabStripModel to respect it.
@@ -539,7 +542,7 @@ void Navigate(NavigateParams* params) {
// The navigation should insert a new tab into the target Browser.
params->browser->tab_strip_model()->AddWebContents(
- params->target_contents->web_contents(),
+ params->target_contents,
params->tabstrip_index,
params->transition,
params->tabstrip_add_types);
@@ -550,7 +553,7 @@ void Navigate(NavigateParams* params) {
if (singleton_index >= 0) {
WebContents* target =
- chrome::GetWebContentsAt(params->browser, singleton_index);
+ params->browser->tab_strip_model()->GetWebContentsAt(singleton_index);
if (target->IsCrashed()) {
target->GetController().Reload(true);
@@ -570,7 +573,7 @@ void Navigate(NavigateParams* params) {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_TAB_ADDED,
content::Source<content::WebContentsDelegate>(params->browser),
- content::Details<WebContents>(params->target_contents->web_contents()));
+ content::Details<WebContents>(params->target_contents));
}
}
diff --git a/chrome/browser/ui/browser_navigator.h b/chrome/browser/ui/browser_navigator.h
index 931c87f..2bd2d61 100644
--- a/chrome/browser/ui/browser_navigator.h
+++ b/chrome/browser/ui/browser_navigator.h
@@ -18,7 +18,10 @@
class Browser;
class Profile;
-class TabContents;
+
+namespace content {
+class WebContents;
+}
namespace chrome {
@@ -37,7 +40,7 @@ namespace chrome {
// params.disposition = NEW_BACKGROUND_TAB;
// chrome::Navigate(&params);
//
-// Opens a popup TabContents:
+// Opens a popup WebContents:
// chrome::NavigateParams params(browser, popup_contents);
// params.source_contents = source_contents;
// chrome::Navigate(&params);
@@ -48,7 +51,8 @@ struct NavigateParams {
NavigateParams(Browser* browser,
const GURL& a_url,
content::PageTransition a_transition);
- NavigateParams(Browser* browser, TabContents* a_target_contents);
+ NavigateParams(Browser* browser,
+ content::WebContents* a_target_contents);
NavigateParams(Profile* profile,
const GURL& a_url,
content::PageTransition a_transition);
@@ -63,28 +67,28 @@ struct NavigateParams {
// is terminated by \r\n. May be empty if no extra headers are needed.
std::string extra_headers;
- // [in] A TabContents to be navigated or inserted into the target
+ // [in] A WebContents to be navigated or inserted into the target
// Browser's tabstrip. If NULL, |url| or the homepage will be used
// instead. When non-NULL, Navigate() assumes it has already been
// navigated to its intended destination and will not load any URL in it
// (i.e. |url| is ignored).
// Default is NULL.
- // [out] The TabContents in which the navigation occurred or that was
+ // [out] The WebContents in which the navigation occurred or that was
// inserted. Guaranteed non-NULL except for note below:
// Note: If this field is set to NULL by the caller and Navigate() creates
- // a new TabContents, this field will remain NULL and the
- // TabContents deleted if the TabContents it created is
+ // a new WebContents, this field will remain NULL and the
+ // WebContents deleted if the WebContents it created is
// not added to a TabStripModel before Navigate() returns.
- TabContents* target_contents;
+ content::WebContents* target_contents;
- // [in] The TabContents that initiated the Navigate() request if such
+ // [in] The WebContents that initiated the Navigate() request if such
// context is necessary. Default is NULL, i.e. no context.
- // [out] If NULL, this value will be set to the selected TabContents in
+ // [out] If NULL, this value will be set to the selected WebContents in
// the originating browser prior to the operation performed by
// Navigate(). However, if the originating page is from a different
// profile (e.g. an OFF_THE_RECORD page originating from a non-OTR
// window), then |source_contents| is reset to NULL.
- TabContents* source_contents;
+ content::WebContents* source_contents;
// The disposition requested by the navigation source. Default is
// CURRENT_TAB. What follows is a set of coercions that happen to this value
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc
index 9577116..281d33b 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -91,8 +90,8 @@ Browser* BrowserNavigatorTest::CreateEmptyBrowserForApp(Browser::Type type,
return browser;
}
-TabContents* BrowserNavigatorTest::CreateTabContents() {
- return chrome::TabContentsFactory(
+WebContents* BrowserNavigatorTest::CreateWebContents() {
+ return WebContents::Create(
browser()->profile(),
NULL,
MSG_ROUTING_NONE,
@@ -190,9 +189,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_CurrentTab) {
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) {
GURL singleton_url1("http://maps.google.com/");
- // Register for a notification if an additional tab_contents was instantiated.
+ // Register for a notification if an additional WebContents was instantiated.
// Opening a Singleton tab that is already opened should not be opening a new
- // tab nor be creating a new TabContents object.
+ // tab nor be creating a new WebContents object.
content::NotificationRegistrar registrar;
// As the registrar object goes out of scope, this will get unregistered
@@ -306,7 +305,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) {
p.disposition = NEW_FOREGROUND_TAB;
chrome::Navigate(&p);
EXPECT_NE(old_contents, chrome::GetActiveWebContents(browser()));
- EXPECT_EQ(browser()->tab_strip_model()->GetActiveTabContents(),
+ EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(),
p.target_contents);
EXPECT_EQ(2, browser()->tab_count());
}
@@ -627,17 +626,17 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_IgnoreAction) {
RunSuppressTest(IGNORE_ACTION);
}
-// This tests adding a foreground tab with a predefined TabContents.
+// This tests adding a foreground tab with a predefined WebContents.
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_ForegroundTab) {
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_FOREGROUND_TAB;
- p.target_contents = CreateTabContents();
+ p.target_contents = CreateWebContents();
chrome::Navigate(&p);
// Navigate() should have opened the contents in a new foreground in the
// current Browser.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(browser()->tab_strip_model()->GetActiveTabContents(),
+ EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(),
p.target_contents);
// We should have one window, with two tabs.
@@ -646,11 +645,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_ForegroundTab) {
}
#if defined(OS_WIN)
-// This tests adding a popup with a predefined TabContents.
+// This tests adding a popup with a predefined WebContents.
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_TargetContents_Popup) {
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_POPUP;
- p.target_contents = CreateTabContents();
+ p.target_contents = CreateWebContents();
p.window_bounds = gfx::Rect(10, 10, 500, 500);
chrome::Navigate(&p);
@@ -662,7 +661,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_TargetContents_Popup) {
// The web platform is weird. The window bounds specified in
// |p.window_bounds| are used as follows:
// - the origin is used to position the window
- // - the size is used to size the TabContents of the window.
+ // - the size is used to size the WebContents of the window.
// As such the position of the resulting window will always match
// p.window_bounds.origin(), but its size will not. We need to match
// the size against the selected tab's view's container size.
@@ -674,7 +673,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_TargetContents_Popup) {
// All platforms should respect size however provided width > 400 (Mac has a
// minimum window width of 400).
EXPECT_EQ(p.window_bounds.size(),
- p.target_contents->web_contents()->GetView()->GetContainerSize());
+ p.target_contents->GetView()->GetContainerSize());
// We should have two windows, the new popup and the browser() provided by the
// framework.
@@ -698,8 +697,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Tabstrip_InsertAtIndex) {
// Navigate() should have inserted a new tab at slot 0 in the tabstrip.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(0, browser()->tab_strip_model()->GetIndexOfTabContents(
- static_cast<const TabContents*>(p.target_contents)));
+ EXPECT_EQ(0, browser()->tab_strip_model()->GetIndexOfWebContents(
+ static_cast<const WebContents*>(p.target_contents)));
// We should have one window - the browser() provided by the framework.
EXPECT_EQ(1u, BrowserList::size());
diff --git a/chrome/browser/ui/browser_navigator_browsertest.h b/chrome/browser/ui/browser_navigator_browsertest.h
index 2a10152..4fbf814 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.h
+++ b/chrome/browser/ui/browser_navigator_browsertest.h
@@ -10,12 +10,15 @@
#include "content/public/browser/notification_types.h"
class Profile;
-class TabContents;
namespace chrome {
struct NavigateParams;
}
+namespace content {
+class WebContents;
+}
+
// Browsertest class for testing the browser navigation. It is also a base class
// for the |BrowserGuestModeNavigation| which tests navigation while in guest
// mode.
@@ -28,7 +31,7 @@ class BrowserNavigatorTest : public InProcessBrowserTest,
Browser* CreateEmptyBrowserForType(Browser::Type type, Profile* profile);
Browser* CreateEmptyBrowserForApp(Browser::Type type, Profile* profile);
- TabContents* CreateTabContents();
+ content::WebContents* CreateWebContents();
void RunSuppressTest(WindowOpenDisposition disposition);
void RunUseNonIncognitoWindowTest(const GURL& url);
diff --git a/chrome/browser/ui/browser_tabstrip.cc b/chrome/browser/ui/browser_tabstrip.cc
index 2ca9ac1..8582b93 100644
--- a/chrome/browser/ui/browser_tabstrip.cc
+++ b/chrome/browser/ui/browser_tabstrip.cc
@@ -50,8 +50,7 @@ void AddBlankTabAt(Browser* browser, int index, bool foreground) {
params.disposition = foreground ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB;
params.tabstrip_index = index;
chrome::Navigate(&params);
- params.target_contents->web_contents()->SetNewTabStartTime(
- new_tab_start_time);
+ params.target_contents->SetNewTabStartTime(new_tab_start_time);
}
content::WebContents* AddSelectedTabWithURL(
@@ -61,7 +60,7 @@ content::WebContents* AddSelectedTabWithURL(
NavigateParams params(browser, url, transition);
params.disposition = NEW_FOREGROUND_TAB;
Navigate(&params);
- return params.target_contents ? params.target_contents->web_contents() : NULL;
+ return params.target_contents;
}
void AddWebContents(Browser* browser,
@@ -76,13 +75,6 @@ void AddWebContents(Browser* browser,
// Can't create a new contents for the current tab - invalid case.
DCHECK(disposition != CURRENT_TAB);
- // TODO(avi): Use browser tab contents adoption here.
- TabContents* new_tab_contents = TabContents::FromWebContents(new_contents);
- if (!new_tab_contents) {
- new_tab_contents =
- BrowserTabstripTabContentsCreator::CreateTabContents(new_contents);
- }
-
BlockedContentTabHelper* source_blocked_content = NULL;
if (source_contents) {
source_blocked_content =
@@ -116,9 +108,8 @@ void AddWebContents(Browser* browser,
new_contents->GetRenderViewHost()->DisassociateFromPopupCount();
}
- NavigateParams params(browser, new_tab_contents);
- params.source_contents =
- source_contents ? TabContents::FromWebContents(source_contents) : NULL;
+ NavigateParams params(browser, new_contents);
+ params.source_contents = source_contents;
params.disposition = disposition;
params.window_bounds = initial_pos;
params.window_action = NavigateParams::SHOW_WINDOW;
diff --git a/chrome/browser/ui/cocoa/applescript/window_applescript.mm b/chrome/browser/ui/cocoa/applescript/window_applescript.mm
index 31b9851..af00ae0 100644
--- a/chrome/browser/ui/cocoa/applescript/window_applescript.mm
+++ b/chrome/browser/ui/cocoa/applescript/window_applescript.mm
@@ -196,10 +196,9 @@
params.disposition = NEW_FOREGROUND_TAB;
params.tabstrip_index = index;
chrome::Navigate(&params);
- params.target_contents->web_contents()->SetNewTabStartTime(
- newTabStartTime);
+ params.target_contents->SetNewTabStartTime(newTabStartTime);
- [aTab setWebContents:params.target_contents->web_contents()];
+ [aTab setWebContents:params.target_contents];
}
- (void)removeFromTabsAtIndex:(int)index {
diff --git a/chrome/browser/ui/extensions/application_launch.cc b/chrome/browser/ui/extensions/application_launch.cc
index c9a7c06..8dfe7ec 100644
--- a/chrome/browser/ui/extensions/application_launch.cc
+++ b/chrome/browser/ui/extensions/application_launch.cc
@@ -205,7 +205,7 @@ WebContents* OpenApplicationTab(Profile* profile,
contents = existing_tab;
} else {
chrome::Navigate(&params);
- contents = params.target_contents->web_contents();
+ contents = params.target_contents;
}
#if defined(USE_ASH)
diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc
index f81723a..c26fcaa 100644
--- a/chrome/browser/ui/extensions/shell_window.cc
+++ b/chrome/browser/ui/extensions/shell_window.cc
@@ -24,7 +24,6 @@
#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/browser/ui/intents/web_intent_picker_controller.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/view_type_utils.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/api/app_window.h"
@@ -277,9 +276,7 @@ WebContents* ShellWindow::OpenURLFromTab(WebContents* source,
new_tab_params.initiating_profile = profile_;
chrome::Navigate(&new_tab_params);
- WebContents* new_contents = new_tab_params.target_contents ?
- new_tab_params.target_contents->web_contents() : NULL;
- if (!new_contents) {
+ if (!new_tab_params.target_contents) {
AddMessageToDevToolsConsole(
content::CONSOLE_MESSAGE_LEVEL_ERROR,
base::StringPrintf(
@@ -287,7 +284,7 @@ WebContents* ShellWindow::OpenURLFromTab(WebContents* source,
params.url.spec().c_str()));
}
- return new_contents;
+ return new_tab_params.target_contents;
}
void ShellWindow::AddNewContents(WebContents* source,
diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
index 5cafde2..e9f6558 100644
--- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
@@ -1796,7 +1796,7 @@ bool TabStripGtk::CompleteDrop(const guchar* data, bool is_plain_text) {
params.disposition = NEW_FOREGROUND_TAB;
} else {
params.disposition = CURRENT_TAB;
- params.source_contents = model_->GetTabContentsAt(drop_index);
+ params.source_contents = model_->GetWebContentsAt(drop_index);
}
chrome::Navigate(&params);
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.cc b/chrome/browser/ui/intents/web_intent_picker_controller.cc
index b6abe0ba..a555ff1 100644
--- a/chrome/browser/ui/intents/web_intent_picker_controller.cc
+++ b/chrome/browser/ui/intents/web_intent_picker_controller.cc
@@ -330,21 +330,22 @@ void WebIntentPickerController::OnServiceChosen(
}
case webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW: {
- TabContents* contents = chrome::TabContentsFactory(
+ content::WebContents* contents = content::WebContents::Create(
profile_,
tab_util::GetSiteInstanceForNewTab(profile_, url),
MSG_ROUTING_NONE, NULL);
+ WebIntentPickerController::CreateForWebContents(contents);
- // Let the controller for the target TabContents know that it is hosting a
+ // Let the controller for the target WebContents know that it is hosting a
// web intents service. Suppress if we're not showing the
// use-another-service button.
if (picker_model_->show_use_another_service()) {
- WebIntentPickerController::FromWebContents(contents->web_contents())->
+ WebIntentPickerController::FromWebContents(contents)->
SetWindowDispositionSource(web_contents_, intents_dispatcher_);
}
- intents_dispatcher_->DispatchIntent(contents->web_contents());
- service_tab_ = contents->web_contents();
+ intents_dispatcher_->DispatchIntent(contents);
+ service_tab_ = contents;
// This call performs all the tab strip manipulation, notifications, etc.
// Since we're passing in a target_contents, it assumes that we will
diff --git a/chrome/browser/ui/panels/panel_host.cc b/chrome/browser/ui/panels/panel_host.cc
index 5949b47..429f3fe 100644
--- a/chrome/browser/ui/panels/panel_host.cc
+++ b/chrome/browser/ui/panels/panel_host.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/panels/panel.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/view_type_utils.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension_messages.h"
@@ -109,8 +108,7 @@ content::WebContents* PanelHost::OpenURLFromTab(
navigate_params.disposition = params.disposition == NEW_BACKGROUND_TAB ?
params.disposition : NEW_FOREGROUND_TAB;
chrome::Navigate(&navigate_params);
- return navigate_params.target_contents ?
- navigate_params.target_contents->web_contents() : NULL;
+ return navigate_params.target_contents;
}
void PanelHost::NavigationStateChanged(const content::WebContents* source,
@@ -131,12 +129,7 @@ void PanelHost::AddNewContents(content::WebContents* source,
bool* was_blocked) {
chrome::NavigateParams navigate_params(profile_, new_contents->GetURL(),
content::PAGE_TRANSITION_LINK);
- // Create a TabContents because the NavigateParams takes a TabContents,
- // not a WebContents, for the target_contents.
- TabContents* new_tab_contents = TabContents::FromWebContents(new_contents);
- if (!new_tab_contents)
- new_tab_contents = TabContents::Factory::CreateTabContents(new_contents);
- navigate_params.target_contents = new_tab_contents;
+ navigate_params.target_contents = new_contents;
// Force all links to open in a new tab, even if they were trying to open a
// window.
diff --git a/chrome/browser/ui/singleton_tabs.cc b/chrome/browser/ui/singleton_tabs.cc
index 11cd79d..4059403 100644
--- a/chrome/browser/ui/singleton_tabs.cc
+++ b/chrome/browser/ui/singleton_tabs.cc
@@ -7,8 +7,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_navigator.h"
-#include "chrome/browser/ui/browser_tabstrip.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/browser_url_handler.h"
@@ -46,7 +44,8 @@ void ShowSingletonTabRespectRef(Browser* browser, const GURL& url) {
void ShowSingletonTabOverwritingNTP(Browser* browser,
const NavigateParams& params) {
NavigateParams local_params(params);
- content::WebContents* contents = GetActiveWebContents(browser);
+ content::WebContents* contents =
+ browser->tab_strip_model()->GetActiveWebContents();
if (contents) {
const GURL& contents_url = contents->GetURL();
if ((contents_url == GURL(kChromeUINewTabURL) ||
@@ -89,8 +88,8 @@ int GetIndexOfSingletonTab(NavigateParams* params) {
int tab_count = params->browser->tab_count();
for (int i = 0; i < tab_count; ++i) {
int tab_index = (start_index + i) % tab_count;
- TabContents* tab =
- params->browser->tab_strip_model()->GetTabContentsAt(tab_index);
+ content::WebContents* tab =
+ params->browser->tab_strip_model()->GetWebContentsAt(tab_index);
url_canon::Replacements<char> replacements;
if (params->ref_behavior == NavigateParams::IGNORE_REF)
@@ -101,7 +100,7 @@ int GetIndexOfSingletonTab(NavigateParams* params) {
replacements.ClearQuery();
}
- GURL tab_url = tab->web_contents()->GetURL();
+ GURL tab_url = tab->GetURL();
GURL rewritten_tab_url = tab_url;
content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
&rewritten_tab_url,
diff --git a/chrome/browser/ui/tab_contents/tab_contents.h b/chrome/browser/ui/tab_contents/tab_contents.h
index f8bc705..8c6d4fa 100644
--- a/chrome/browser/ui/tab_contents/tab_contents.h
+++ b/chrome/browser/ui/tab_contents/tab_contents.h
@@ -13,20 +13,13 @@
class Browser;
class BrowserTabstripTabContentsCreator;
-class ChromeWebContentsHandler;
class ConstrainedWebDialogDelegateBase;
-class ExtensionTabUtil;
class InstantLoader;
class OffscreenTabContentsCreator;
-class PanelHost;
class Profile;
class TabStripModel;
class TestTabStripModelDelegate;
-namespace extensions {
-class WebAuthFlow;
-}
-
namespace prerender {
class PrerenderContents;
}
@@ -56,13 +49,9 @@ class TabContents : public content::WebContentsObserver {
friend class Browser;
friend class BrowserTabstripTabContentsCreator;
- friend class ChromeWebContentsHandler;
friend class ConstrainedWebDialogDelegateBase;
- friend class extensions::WebAuthFlow;
- friend class ExtensionTabUtil;
friend class InstantLoader;
friend class OffscreenTabContentsCreator;
- friend class PanelHost;
friend class prerender::PrerenderContents;
// See crbug.com/153587
friend class TabAndroid;
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index f7053db..d2879d0 100644
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -329,7 +329,7 @@ void BrowserTabStripController::PerformDrop(bool drop_before,
} else {
content::RecordAction(UserMetricsAction("Tab_DropURLOnTab"));
params.disposition = CURRENT_TAB;
- params.source_contents = model_->GetTabContentsAt(index);
+ params.source_contents = model_->GetWebContentsAt(index);
}
params.window_action = chrome::NavigateParams::SHOW_WINDOW;
chrome::Navigate(&params);
diff --git a/chrome/browser/ui/webui/chrome_web_contents_handler.cc b/chrome/browser/ui/webui/chrome_web_contents_handler.cc
index 745b908..dd857dd 100644
--- a/chrome/browser/ui/webui/chrome_web_contents_handler.cc
+++ b/chrome/browser/ui/webui/chrome_web_contents_handler.cc
@@ -10,7 +10,6 @@
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/host_desktop.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"
@@ -67,8 +66,7 @@ WebContents* ChromeWebContentsHandler::OpenURLFromTab(
if (browser_created && (browser != nav_params.browser))
browser->window()->Close();
- return nav_params.target_contents ?
- nav_params.target_contents->web_contents() : NULL;
+ return nav_params.target_contents;
}
// Creates a new tab with |new_contents|. |context| is the browser context that
@@ -101,11 +99,8 @@ void ChromeWebContentsHandler::AddNewContents(
if (!browser)
browser = new Browser(
Browser::CreateParams(Browser::TYPE_TABBED, profile, desktop_type));
- TabContents* tab_contents =
- TabContents::Factory::CreateTabContents(new_contents);
- chrome::NavigateParams params(browser, tab_contents);
- // TODO(pinkerton): no way to get a TabContents for this.
- // params.source_contents = source;
+ chrome::NavigateParams params(browser, new_contents);
+ params.source_contents = source;
params.disposition = disposition;
params.window_bounds = initial_pos;
params.window_action = chrome::NavigateParams::SHOW_WINDOW;
diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc
index 3276f6f..2de1b1c 100644
--- a/chrome/test/base/browser_with_test_window_test.cc
+++ b/chrome/test/base/browser_with_test_window_test.cc
@@ -90,7 +90,7 @@ void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) {
params.tabstrip_index = 0;
params.disposition = NEW_FOREGROUND_TAB;
chrome::Navigate(&params);
- CommitPendingLoad(&params.target_contents->web_contents()->GetController());
+ CommitPendingLoad(&params.target_contents->GetController());
}
void BrowserWithTestWindowTest::CommitPendingLoad(