| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 class Observer { | 73 class Observer { |
| 74 public: | 74 public: |
| 75 // Signals that the prerender has started running. | 75 // Signals that the prerender has started running. |
| 76 virtual void OnPrerenderStart(PrerenderContents* contents) = 0; | 76 virtual void OnPrerenderStart(PrerenderContents* contents) = 0; |
| 77 | 77 |
| 78 // Signals that the prerender has had its load event. | 78 // Signals that the prerender has had its load event. |
| 79 virtual void OnPrerenderStopLoading(PrerenderContents* contents); | 79 virtual void OnPrerenderStopLoading(PrerenderContents* contents); |
| 80 | 80 |
| 81 // Signals that the prerender has had its 'DOMContentLoaded' event. |
| 82 virtual void OnPrerenderDomContentLoaded(PrerenderContents* contents); |
| 83 |
| 81 // Signals that the prerender has stopped running. A PrerenderContents with | 84 // Signals that the prerender has stopped running. A PrerenderContents with |
| 82 // an unset final status will always call OnPrerenderStop before being | 85 // an unset final status will always call OnPrerenderStop before being |
| 83 // destroyed. | 86 // destroyed. |
| 84 virtual void OnPrerenderStop(PrerenderContents* contents) = 0; | 87 virtual void OnPrerenderStop(PrerenderContents* contents) = 0; |
| 85 | 88 |
| 86 // Signals that this prerender has just become a MatchComplete replacement. | 89 // Signals that this prerender has just become a MatchComplete replacement. |
| 87 virtual void OnPrerenderCreatedMatchCompleteReplacement( | 90 virtual void OnPrerenderCreatedMatchCompleteReplacement( |
| 88 PrerenderContents* contents, PrerenderContents* replacement); | 91 PrerenderContents* contents, PrerenderContents* replacement); |
| 89 | 92 |
| 90 protected: | 93 protected: |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // |url| and |session_storage_namespace|. | 198 // |url| and |session_storage_namespace|. |
| 196 bool Matches( | 199 bool Matches( |
| 197 const GURL& url, | 200 const GURL& url, |
| 198 const content::SessionStorageNamespace* session_storage_namespace) const; | 201 const content::SessionStorageNamespace* session_storage_namespace) const; |
| 199 | 202 |
| 200 // content::WebContentsObserver implementation. | 203 // content::WebContentsObserver implementation. |
| 201 virtual void RenderFrameCreated( | 204 virtual void RenderFrameCreated( |
| 202 content::RenderFrameHost* render_frame_host) OVERRIDE; | 205 content::RenderFrameHost* render_frame_host) OVERRIDE; |
| 203 virtual void DidStopLoading( | 206 virtual void DidStopLoading( |
| 204 content::RenderViewHost* render_view_host) OVERRIDE; | 207 content::RenderViewHost* render_view_host) OVERRIDE; |
| 208 virtual void DocumentLoadedInFrame( |
| 209 int64 frame_id, content::RenderViewHost* render_view_host) OVERRIDE; |
| 205 virtual void DidStartProvisionalLoadForFrame( | 210 virtual void DidStartProvisionalLoadForFrame( |
| 206 int64 frame_id, | 211 int64 frame_id, |
| 207 int64 parent_frame_id, | 212 int64 parent_frame_id, |
| 208 bool is_main_frame, | 213 bool is_main_frame, |
| 209 const GURL& validated_url, | 214 const GURL& validated_url, |
| 210 bool is_error_page, | 215 bool is_error_page, |
| 211 bool is_iframe_srcdoc, | 216 bool is_iframe_srcdoc, |
| 212 content::RenderViewHost* render_view_host) OVERRIDE; | 217 content::RenderViewHost* render_view_host) OVERRIDE; |
| 213 virtual void DidFinishLoad( | 218 virtual void DidFinishLoad( |
| 214 int64 frame_id, | 219 int64 frame_id, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 310 |
| 306 // Set the final status for how the PrerenderContents was used. This | 311 // Set the final status for how the PrerenderContents was used. This |
| 307 // should only be called once, and should be called before the prerender | 312 // should only be called once, and should be called before the prerender |
| 308 // contents are destroyed. | 313 // contents are destroyed. |
| 309 void SetFinalStatus(FinalStatus final_status); | 314 void SetFinalStatus(FinalStatus final_status); |
| 310 | 315 |
| 311 // These call out to methods on our Observers, using our observer_list_. Note | 316 // These call out to methods on our Observers, using our observer_list_. Note |
| 312 // that NotifyPrerenderStop() also clears the observer list. | 317 // that NotifyPrerenderStop() also clears the observer list. |
| 313 void NotifyPrerenderStart(); | 318 void NotifyPrerenderStart(); |
| 314 void NotifyPrerenderStopLoading(); | 319 void NotifyPrerenderStopLoading(); |
| 320 void NotifyPrerenderDomContentLoaded(); |
| 315 void NotifyPrerenderStop(); | 321 void NotifyPrerenderStop(); |
| 316 void NotifyPrerenderCreatedMatchCompleteReplacement( | 322 void NotifyPrerenderCreatedMatchCompleteReplacement( |
| 317 PrerenderContents* replacement); | 323 PrerenderContents* replacement); |
| 318 | 324 |
| 319 // Called whenever a RenderViewHost is created for prerendering. Only called | 325 // Called whenever a RenderViewHost is created for prerendering. Only called |
| 320 // once the RenderViewHost has a RenderView and RenderWidgetHostView. | 326 // once the RenderViewHost has a RenderView and RenderWidgetHostView. |
| 321 virtual void OnRenderViewHostCreated( | 327 virtual void OnRenderViewHostCreated( |
| 322 content::RenderViewHost* new_render_view_host); | 328 content::RenderViewHost* new_render_view_host); |
| 323 | 329 |
| 324 content::NotificationRegistrar& notification_registrar() { | 330 content::NotificationRegistrar& notification_registrar() { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 // Resources that are throttled, pending a prerender use. Can only access a | 455 // Resources that are throttled, pending a prerender use. Can only access a |
| 450 // throttle on the IO thread. | 456 // throttle on the IO thread. |
| 451 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_; | 457 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_; |
| 452 | 458 |
| 453 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 459 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
| 454 }; | 460 }; |
| 455 | 461 |
| 456 } // namespace prerender | 462 } // namespace prerender |
| 457 | 463 |
| 458 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 464 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| OLD | NEW |