}
namespace content {
-struct FaviconURL;
class RenderViewHost;
class SessionStorageNamespace;
class WebContents;
// Signals that the prerender has had its load event.
virtual void OnPrerenderStopLoading(PrerenderContents* contents);
- // Signals that the prerender has stopped running.
+ // Signals that the prerender has had its 'DOMContentLoaded' event.
+ virtual void OnPrerenderDomContentLoaded(PrerenderContents* contents);
+
+ // Signals that the prerender has stopped running. A PrerenderContents with
+ // an unset final status will always call OnPrerenderStop before being
+ // destroyed.
virtual void OnPrerenderStop(PrerenderContents* contents) = 0;
// Signals that this prerender has just become a MatchComplete replacement.
virtual ~Observer() = 0;
};
- // A container for extra data on pending prerenders.
- struct PendingPrerenderInfo {
- public:
- PendingPrerenderInfo(
- base::WeakPtr<PrerenderHandle> weak_prerender_handle,
- Origin origin,
- const GURL& url,
- const content::Referrer& referrer,
- const gfx::Size& size);
-
- ~PendingPrerenderInfo();
-
- base::WeakPtr<PrerenderHandle> weak_prerender_handle;
- Origin origin;
- GURL url;
- content::Referrer referrer;
- gfx::Size size;
- };
-
// Indicates how this PrerenderContents relates to MatchComplete. This is to
// figure out which histograms to use to record the FinalStatus, Match (record
// all prerenders and control group prerenders) or MatchComplete (record
base::string16 title() const { return title_; }
int32 page_id() const { return page_id_; }
- GURL icon_url() const { return icon_url_; }
const GURL& prerender_url() const { return prerender_url_; }
const content::Referrer& referrer() const { return referrer_; }
bool has_stopped_loading() const { return has_stopped_loading_; }
// and returns a boolean indicating the validity of that id.
virtual bool GetRouteId(int* route_id) const;
- // Set the final status for how the PrerenderContents was used. This
- // should only be called once, and should be called before the prerender
- // contents are destroyed.
- void SetFinalStatus(FinalStatus final_status);
FinalStatus final_status() const { return final_status_; }
Origin origin() const { return origin_; }
content::RenderFrameHost* render_frame_host) OVERRIDE;
virtual void DidStopLoading(
content::RenderViewHost* render_view_host) OVERRIDE;
+ virtual void DocumentLoadedInFrame(
+ int64 frame_id, content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DidStartProvisionalLoadForFrame(
int64 frame_id,
int64 parent_frame_id,
bool is_error_page,
bool is_iframe_srcdoc,
content::RenderViewHost* render_view_host) OVERRIDE;
+ virtual void DidCommitProvisionalLoadForFrame(
+ int64 frame_id,
+ const base::string16& frame_unique_name,
+ bool is_main_frame,
+ const GURL& url,
+ content::PageTransition transition_type,
+ content::RenderViewHost* render_view_host) OVERRIDE;
virtual void DidFinishLoad(
int64 frame_id,
const GURL& validated_url,
virtual void DidGetRedirectForResourceRequest(
content::RenderViewHost* render_view_host,
const content::ResourceRedirectDetails& details) OVERRIDE;
- virtual void DidUpdateFaviconURL(int32 page_id,
- const std::vector<content::FaviconURL>& urls) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE;
// MouseEvent being dispatched by a link to a website installed as an app.
bool IsCrossSiteNavigationPending() const;
- // Adds a pending prerender to the list. If |weak_prerender_handle| still
- // exists when this page is made visible, it will be launched.
- virtual void AddPendingPrerender(
- scoped_ptr<PendingPrerenderInfo> pending_prerender_info);
-
- // Reissues any pending prerender requests from the prerendered page. Also
- // clears the list of pending requests. Sends notifications.
+ // Marks prerender as used and releases any throttled resource requests.
void PrepareForUse();
content::SessionStorageNamespace* GetSessionStorageNamespace() const;
void AddResourceThrottle(
const base::WeakPtr<PrerenderResourceThrottle>& throttle);
+ // Increments the number of bytes fetched over the network for this prerender.
+ void AddNetworkBytes(int64 bytes);
+
protected:
PrerenderContents(PrerenderManager* prerender_manager,
Profile* profile,
Origin origin,
uint8 experiment_id);
+ // Set the final status for how the PrerenderContents was used. This
+ // should only be called once, and should be called before the prerender
+ // contents are destroyed.
+ void SetFinalStatus(FinalStatus final_status);
+
// These call out to methods on our Observers, using our observer_list_. Note
// that NotifyPrerenderStop() also clears the observer list.
void NotifyPrerenderStart();
void NotifyPrerenderStopLoading();
+ void NotifyPrerenderDomContentLoaded();
void NotifyPrerenderStop();
void NotifyPrerenderCreatedMatchCompleteReplacement(
PrerenderContents* replacement);
return notification_registrar_;
}
- size_t pending_prerender_count() const;
-
bool prerendering_has_been_cancelled() const {
return prerendering_has_been_cancelled_;
}
base::string16 title_;
int32 page_id_;
GURL url_;
- GURL icon_url_;
content::NotificationRegistrar notification_registrar_;
// A vector of URLs that this prerendered page matches against.
// Experiment during which this prerender is performed.
uint8 experiment_id_;
- // Prerenders that the prerendered page has tried to prerender. They remain
- // pending until this page is displayed.
- ScopedVector<PendingPrerenderInfo> pending_prerenders_;
-
// The process that created the child id.
int creator_child_id_;
+ // Main frame ID of last committed page.
+ int64 main_frame_id_;
+
// The size of the WebView from the launching page.
gfx::Size size_;
// throttle on the IO thread.
std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_;
+ // A running tally of the number of bytes this prerender has caused to be
+ // transferred over the network for resources. Updated with AddNetworkBytes.
+ int64 network_bytes_;
+
DISALLOW_COPY_AND_ASSIGN(PrerenderContents);
};