cd Move prerender specific functionality out of TabContents into a tab content
observer.
Review URL: http://codereview.chromium.org/6648001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77370 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 3def8e4..2c79dc98 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -44,8 +44,6 @@
#include "chrome/browser/pdf_unsupported_feature.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/plugin_observer.h"
-#include "chrome/browser/prerender/prerender_manager.h"
-#include "chrome/browser/prerender/prerender_plt_recorder.h"
#include "chrome/browser/printing/print_preview_message_handler.h"
#include "chrome/browser/printing/print_preview_tab_controller.h"
#include "chrome/browser/printing/print_view_manager.h"
@@ -276,8 +274,7 @@
maximum_zoom_percent_(
static_cast<int>(WebKit::WebView::maxTextSizeMultiplier * 100)),
temporary_zoom_settings_(false),
- content_restrictions_(0),
- was_prerendered_(false) {
+ content_restrictions_(0) {
renderer_preferences_util::UpdateFromSystemSettings(
&renderer_preferences_, profile);
@@ -402,7 +399,6 @@
fav_icon_helper_.reset(new FavIconHelper(this));
autofill_manager_.reset(new AutofillManager(this));
autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this));
- prerender_plt_recorder_.reset(new prerender::PrerenderPLTRecorder(this));
desktop_notification_handler_.reset(
new DesktopNotificationHandlerForTC(this, GetRenderProcessHost()));
plugin_observer_.reset(new PluginObserver(this));
@@ -1375,12 +1371,10 @@
if (!is_error_page)
content_settings_delegate_->ClearCookieSpecificContentSettings();
content_settings_delegate_->ClearGeolocationContentSettings();
- // TODO(cbentzel): Should error pages still show prerendered icon?
- set_was_prerendered(false);
- // Check if the URL we are about to load has been prerendered by any chance,
- // and use it if possible.
- MaybeUsePreloadedPage(url);
+ // Notify observers about the provisional change in the main frame URL.
+ FOR_EACH_OBSERVER(TabContentsObserver, observers_,
+ OnProvisionalChangeToMainFrameUrl(url));
}
}
@@ -1396,9 +1390,9 @@
return;
entry->set_url(target_url);
- // Check if the URL we are about to load has been prerendered by any chance,
- // and use it if possible.
- MaybeUsePreloadedPage(target_url);
+ // Notify observers about the provisional change in the main frame URL.
+ FOR_EACH_OBSERVER(TabContentsObserver, observers_,
+ OnProvisionalChangeToMainFrameUrl(target_url));
}
void TabContents::OnDidFailProvisionalLoadWithError(
@@ -2131,10 +2125,6 @@
int extra_invalidate_flags = 0;
if (PageTransition::IsMainFrame(params.transition)) {
- if (MaybeUsePreloadedPage(params.url)) {
- return;
- }
-
bool was_bookmark_bar_visible = ShouldShowBookmarkBar();
render_manager_.DidNavigateMainFrame(rvh);
@@ -2850,12 +2840,3 @@
render_view_host()->Send(new ViewMsg_NetworkStateChanged(
render_view_host()->routing_id(), online));
}
-
-bool TabContents::MaybeUsePreloadedPage(const GURL& url) {
- prerender::PrerenderManager* pm = profile()->GetPrerenderManager();
- if (pm != NULL) {
- if (pm->MaybeUsePreloadedPage(this, url))
- return true;
- }
- return false;
-}
diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h
index 12bc56a..75448349d 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -52,7 +52,6 @@
namespace prerender {
class PrerenderManager;
-class PrerenderPLTRecorder;
}
namespace printing {
@@ -717,9 +716,6 @@
return safebrowsing_detection_host_.get();
}
- bool was_prerendered() const { return was_prerendered_; }
- void set_was_prerendered(bool prerendered) { was_prerendered_ = prerendered; }
-
protected:
// from RenderViewHostDelegate.
virtual bool OnMessageReceived(const IPC::Message& message);
@@ -1031,11 +1027,6 @@
// NetworkChangeNotifier::OnlineStateObserver:
virtual void OnOnlineStateChanged(bool online);
- // Checks with the PrerenderManager if the specified URL has been preloaded,
- // and if so, swap the RenderViewHost with the preload into this TabContents
- // object.
- bool MaybeUsePreloadedPage(const GURL& url);
-
// Adds the given window to the list of child windows. The window will notify
// via WillClose() when it is being destroyed.
void AddConstrainedDialog(ConstrainedWindow* window);
@@ -1083,9 +1074,6 @@
// Handles plugin messages.
scoped_ptr<PluginObserver> plugin_observer_;
- // Prerender PageLoadTime Recorder.
- scoped_ptr<prerender::PrerenderPLTRecorder> prerender_plt_recorder_;
-
// TabContentsSSLHelper, lazily created.
scoped_ptr<TabContentsSSLHelper> ssl_helper_;
@@ -1265,9 +1253,6 @@
// (full-page plugins for now only) permissions.
int content_restrictions_;
- // Were the contents of this tab previously prerendered?
- bool was_prerendered_;
-
DISALLOW_COPY_AND_ASSIGN(TabContents);
};
diff --git a/content/browser/tab_contents/tab_contents_observer.cc b/content/browser/tab_contents/tab_contents_observer.cc
index c3d9947..691df4e 100644
--- a/content/browser/tab_contents/tab_contents_observer.cc
+++ b/content/browser/tab_contents/tab_contents_observer.cc
@@ -20,6 +20,9 @@
const ViewHostMsg_FrameNavigate_Params& params) {
}
+void TabContentsObserver::OnProvisionalChangeToMainFrameUrl(const GURL& url) {
+}
+
void TabContentsObserver::DidStartLoading() {
}
diff --git a/content/browser/tab_contents/tab_contents_observer.h b/content/browser/tab_contents/tab_contents_observer.h
index 82fc220f..d03bcec 100644
--- a/content/browser/tab_contents/tab_contents_observer.h
+++ b/content/browser/tab_contents/tab_contents_observer.h
@@ -22,6 +22,7 @@
virtual void DidNavigateAnyFramePostCommit(
const NavigationController::LoadCommittedDetails& details,
const ViewHostMsg_FrameNavigate_Params& params);
+ virtual void OnProvisionalChangeToMainFrameUrl(const GURL& url);
virtual void DidStartLoading();
virtual void DidStopLoading();