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

Unified Diff: chrome/browser/instant/instant_loader.cc

Issue 10905301: Switch CoreTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/instant/instant_loader.cc
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index b954746701cdaf852703817f32c0c4e51a446b63..5e364be71ccd5e94e3f9feb6d8b639d06693c29f 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -42,8 +42,8 @@ class InstantLoader::WebContentsDelegateImpl
virtual bool ShouldFocusConstrainedWindow() OVERRIDE;
// CoreTabHelperDelegate:
- virtual void SwapTabContents(TabContents* old_tc,
- TabContents* new_tc) OVERRIDE;
+ virtual void SwapTabContents(content::WebContents* old_contents,
+ content::WebContents* new_contents) OVERRIDE;
// content::WebContentsDelegate:
virtual bool ShouldSuppressDialogs() OVERRIDE;
@@ -105,11 +105,11 @@ bool InstantLoader::WebContentsDelegateImpl::ShouldFocusConstrainedWindow() {
}
void InstantLoader::WebContentsDelegateImpl::SwapTabContents(
- TabContents* old_tc,
- TabContents* new_tc) {
+ content::WebContents* old_contents,
+ content::WebContents* new_contents) {
// If this is being called, something is swapping in to our
// |preview_contents_| before we've added it to the tab strip.
- loader_->ReplacePreviewContents(old_tc, new_tc);
+ loader_->ReplacePreviewContents(old_contents, new_contents);
}
bool InstantLoader::WebContentsDelegateImpl::ShouldSuppressDialogs() {
@@ -348,10 +348,10 @@ void InstantLoader::SetupPreviewContents() {
// Disable popups and such (mainly to avoid losing focus and reverting the
// preview prematurely).
preview_contents_->blocked_content_tab_helper()->SetAllContentsBlocked(true);
- preview_contents_->constrained_window_tab_helper()->set_delegate(
- new_delegate);
+ preview_contents_->constrained_window_tab_helper()->
+ set_delegate(new_delegate);
preview_contents_->content_settings()->SetPopupsBlocked(true);
- preview_contents_->core_tab_helper()->set_delegate(new_delegate);
+ CoreTabHelper::FromWebContents(new_contents)->set_delegate(new_delegate);
if (ThumbnailGenerator* tg = preview_contents_->thumbnail_generator())
tg->set_enabled(false);
@@ -376,7 +376,7 @@ void InstantLoader::CleanupPreviewContents() {
preview_contents_->blocked_content_tab_helper()->SetAllContentsBlocked(false);
preview_contents_->constrained_window_tab_helper()->set_delegate(NULL);
preview_contents_->content_settings()->SetPopupsBlocked(false);
- preview_contents_->core_tab_helper()->set_delegate(NULL);
+ CoreTabHelper::FromWebContents(old_contents)->set_delegate(NULL);
if (ThumbnailGenerator* tg = preview_contents_->thumbnail_generator())
tg->set_enabled(true);
@@ -390,14 +390,14 @@ void InstantLoader::CleanupPreviewContents() {
#endif
}
-void InstantLoader::ReplacePreviewContents(TabContents* old_tc,
- TabContents* new_tc) {
- DCHECK(old_tc == preview_contents_);
+void InstantLoader::ReplacePreviewContents(content::WebContents* old_contents,
+ content::WebContents* new_contents) {
+ DCHECK(old_contents == preview_contents_->web_contents());
CleanupPreviewContents();
// We release here without deleting so that the caller still has the
// responsibility for deleting the TabContents.
ignore_result(preview_contents_.release());
- preview_contents_.reset(new_tc);
+ preview_contents_.reset(TabContents::FromWebContents(new_contents));
SetupPreviewContents();
loader_delegate_->SwappedTabContents(this);
}

Powered by Google App Engine
This is Rietveld 408576698