| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 class RenderViewHost; | 33 class RenderViewHost; |
| 34 class RenderViewHostDelegate; | 34 class RenderViewHostDelegate; |
| 35 class SessionStorageNamespace; | 35 class SessionStorageNamespace; |
| 36 class WebContents; | 36 class WebContents; |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace prerender { | 39 namespace prerender { |
| 40 | 40 |
| 41 class PrerenderManager; | 41 class PrerenderManager; |
| 42 class PrerenderRenderViewHostObserver; | 42 class PrerenderRenderViewHostObserver; |
| 43 class PrerenderTracker; | 43 class PrerenderRenderViewTracker; |
| 44 | 44 |
| 45 class PrerenderContents : public content::NotificationObserver, | 45 class PrerenderContents : public content::NotificationObserver, |
| 46 public content::WebContentsObserver { | 46 public content::WebContentsObserver { |
| 47 public: | 47 public: |
| 48 // PrerenderContents::Create uses the currently registered Factory to create | 48 // PrerenderContents::Create uses the currently registered Factory to create |
| 49 // the PrerenderContents. Factory is intended for testing. | 49 // the PrerenderContents. Factory is intended for testing. |
| 50 class Factory { | 50 class Factory { |
| 51 public: | 51 public: |
| 52 Factory() {} | 52 Factory() {} |
| 53 virtual ~Factory() {} | 53 virtual ~Factory() {} |
| 54 | 54 |
| 55 // Ownership is not transfered through this interface as prerender_manager, | 55 // Ownership is not transfered through this interface as prerender_manager, |
| 56 // prerender_tracker, and profile are stored as weak pointers. | 56 // prerender_render_view_tracker, and profile are stored as weak pointers. |
| 57 virtual PrerenderContents* CreatePrerenderContents( | 57 virtual PrerenderContents* CreatePrerenderContents( |
| 58 PrerenderManager* prerender_manager, | 58 PrerenderManager* prerender_manager, |
| 59 PrerenderTracker* prerender_tracker, | 59 PrerenderRenderViewTracker* prerender_render_view_tracker, |
| 60 Profile* profile, | 60 Profile* profile, |
| 61 const GURL& url, | 61 const GURL& url, |
| 62 const content::Referrer& referrer, | 62 const content::Referrer& referrer, |
| 63 Origin origin, | 63 Origin origin, |
| 64 uint8 experiment_id) = 0; | 64 uint8 experiment_id) = 0; |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 DISALLOW_COPY_AND_ASSIGN(Factory); | 67 DISALLOW_COPY_AND_ASSIGN(Factory); |
| 68 }; | 68 }; |
| 69 | 69 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 // Returns true if |url| corresponds to a pending prerender. | 210 // Returns true if |url| corresponds to a pending prerender. |
| 211 bool IsPendingEntry(const GURL& url) const; | 211 bool IsPendingEntry(const GURL& url) const; |
| 212 | 212 |
| 213 // Reissues any pending prerender requests from the prerendered page. Also | 213 // Reissues any pending prerender requests from the prerendered page. Also |
| 214 // clears the list of pending requests. | 214 // clears the list of pending requests. |
| 215 void StartPendingPrerenders(); | 215 void StartPendingPrerenders(); |
| 216 | 216 |
| 217 protected: | 217 protected: |
| 218 PrerenderContents(PrerenderManager* prerender_manager, | 218 PrerenderContents(PrerenderManager* prerender_manager, |
| 219 PrerenderTracker* prerender_tracker, | 219 PrerenderRenderViewTracker* prerender_render_view_tracker, |
| 220 Profile* profile, | 220 Profile* profile, |
| 221 const GURL& url, | 221 const GURL& url, |
| 222 const content::Referrer& referrer, | 222 const content::Referrer& referrer, |
| 223 Origin origin, | 223 Origin origin, |
| 224 uint8 experiment_id); | 224 uint8 experiment_id); |
| 225 | 225 |
| 226 // Called whenever a RenderViewHost is created for prerendering. Only called | 226 // Called whenever a RenderViewHost is created for prerendering. Only called |
| 227 // once the RenderViewHost has a RenderView and RenderWidgetHostView. | 227 // once the RenderViewHost has a RenderView and RenderWidgetHostView. |
| 228 virtual void OnRenderViewHostCreated( | 228 virtual void OnRenderViewHostCreated( |
| 229 content::RenderViewHost* new_render_view_host); | 229 content::RenderViewHost* new_render_view_host); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 259 // Returns the RenderViewHost Delegate for this prerender. | 259 // Returns the RenderViewHost Delegate for this prerender. |
| 260 content::WebContents* GetWebContents(); | 260 content::WebContents* GetWebContents(); |
| 261 | 261 |
| 262 // Returns the ProcessMetrics for the render process, if it exists. | 262 // Returns the ProcessMetrics for the render process, if it exists. |
| 263 base::ProcessMetrics* MaybeGetProcessMetrics(); | 263 base::ProcessMetrics* MaybeGetProcessMetrics(); |
| 264 | 264 |
| 265 // The prerender manager owning this object. | 265 // The prerender manager owning this object. |
| 266 PrerenderManager* prerender_manager_; | 266 PrerenderManager* prerender_manager_; |
| 267 | 267 |
| 268 // The prerender tracker tracking prerenders. | 268 // The prerender tracker tracking prerenders. |
| 269 PrerenderTracker* prerender_tracker_; | 269 PrerenderRenderViewTracker* prerender_render_view_tracker_; |
| 270 | 270 |
| 271 // The URL being prerendered. | 271 // The URL being prerendered. |
| 272 GURL prerender_url_; | 272 GURL prerender_url_; |
| 273 | 273 |
| 274 // The referrer. | 274 // The referrer. |
| 275 content::Referrer referrer_; | 275 content::Referrer referrer_; |
| 276 | 276 |
| 277 // The profile being used | 277 // The profile being used |
| 278 Profile* profile_; | 278 Profile* profile_; |
| 279 | 279 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 291 // A vector of URLs that this prerendered page matches against. | 291 // A vector of URLs that this prerendered page matches against. |
| 292 // This array can contain more than element as a result of redirects, | 292 // This array can contain more than element as a result of redirects, |
| 293 // such as HTTP redirects or javascript redirects. | 293 // such as HTTP redirects or javascript redirects. |
| 294 std::vector<GURL> alias_urls_; | 294 std::vector<GURL> alias_urls_; |
| 295 | 295 |
| 296 bool has_stopped_loading_; | 296 bool has_stopped_loading_; |
| 297 | 297 |
| 298 // True when the main frame has finished loading. | 298 // True when the main frame has finished loading. |
| 299 bool has_finished_loading_; | 299 bool has_finished_loading_; |
| 300 | 300 |
| 301 // This must be the same value as the PrerenderTracker has recorded for | 301 // This must be the same value as the PrerenderRenderViewTracker has recorded |
| 302 // |this|, when |this| has a RenderView. | 302 // for |this|, when |this| has a RenderView. |
| 303 FinalStatus final_status_; | 303 FinalStatus final_status_; |
| 304 | 304 |
| 305 // The MatchComplete status of the prerender, indicating how it relates | 305 // The MatchComplete status of the prerender, indicating how it relates |
| 306 // to being a MatchComplete dummy (see definition of MatchCompleteStatus | 306 // to being a MatchComplete dummy (see definition of MatchCompleteStatus |
| 307 // above). | 307 // above). |
| 308 MatchCompleteStatus match_complete_status_; | 308 MatchCompleteStatus match_complete_status_; |
| 309 | 309 |
| 310 // Tracks whether or not prerendering has been cancelled by calling Destroy. | 310 // Tracks whether or not prerendering has been cancelled by calling Destroy. |
| 311 // Used solely to prevent double deletion. | 311 // Used solely to prevent double deletion. |
| 312 bool prerendering_has_been_cancelled_; | 312 bool prerendering_has_been_cancelled_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 345 |
| 346 // The size of the WebView from the launching page. | 346 // The size of the WebView from the launching page. |
| 347 gfx::Size size_; | 347 gfx::Size size_; |
| 348 | 348 |
| 349 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 349 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
| 350 }; | 350 }; |
| 351 | 351 |
| 352 } // namespace prerender | 352 } // namespace prerender |
| 353 | 353 |
| 354 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 354 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| OLD | NEW |