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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 }; | 70 }; |
71 | 71 |
72 class Observer { | 72 class Observer { |
73 public: | 73 public: |
74 // Signals that the prerender has started running. | 74 // Signals that the prerender has started running. |
75 virtual void OnPrerenderStart(PrerenderContents* contents) = 0; | 75 virtual void OnPrerenderStart(PrerenderContents* contents) = 0; |
76 | 76 |
77 // Signals that the prerender has had its load event. | 77 // Signals that the prerender has had its load event. |
78 virtual void OnPrerenderStopLoading(PrerenderContents* contents); | 78 virtual void OnPrerenderStopLoading(PrerenderContents* contents); |
79 | 79 |
| 80 // Signals that the prerender has had its 'DOMContentLoaded' event. |
| 81 virtual void OnPrerenderDomContentLoaded(PrerenderContents* contents); |
| 82 |
80 // Signals that the prerender has stopped running. A PrerenderContents with | 83 // Signals that the prerender has stopped running. A PrerenderContents with |
81 // an unset final status will always call OnPrerenderStop before being | 84 // an unset final status will always call OnPrerenderStop before being |
82 // destroyed. | 85 // destroyed. |
83 virtual void OnPrerenderStop(PrerenderContents* contents) = 0; | 86 virtual void OnPrerenderStop(PrerenderContents* contents) = 0; |
84 | 87 |
85 // Signals that this prerender has just become a MatchComplete replacement. | 88 // Signals that this prerender has just become a MatchComplete replacement. |
86 virtual void OnPrerenderCreatedMatchCompleteReplacement( | 89 virtual void OnPrerenderCreatedMatchCompleteReplacement( |
87 PrerenderContents* contents, PrerenderContents* replacement); | 90 PrerenderContents* contents, PrerenderContents* replacement); |
88 | 91 |
89 protected: | 92 protected: |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // |url| and |session_storage_namespace|. | 196 // |url| and |session_storage_namespace|. |
194 bool Matches( | 197 bool Matches( |
195 const GURL& url, | 198 const GURL& url, |
196 const content::SessionStorageNamespace* session_storage_namespace) const; | 199 const content::SessionStorageNamespace* session_storage_namespace) const; |
197 | 200 |
198 // content::WebContentsObserver implementation. | 201 // content::WebContentsObserver implementation. |
199 virtual void RenderFrameCreated( | 202 virtual void RenderFrameCreated( |
200 content::RenderFrameHost* render_frame_host) OVERRIDE; | 203 content::RenderFrameHost* render_frame_host) OVERRIDE; |
201 virtual void DidStopLoading( | 204 virtual void DidStopLoading( |
202 content::RenderViewHost* render_view_host) OVERRIDE; | 205 content::RenderViewHost* render_view_host) OVERRIDE; |
| 206 virtual void DocumentLoadedInFrame( |
| 207 int64 frame_id, content::RenderViewHost* render_view_host) OVERRIDE; |
203 virtual void DidStartProvisionalLoadForFrame( | 208 virtual void DidStartProvisionalLoadForFrame( |
204 int64 frame_id, | 209 int64 frame_id, |
205 int64 parent_frame_id, | 210 int64 parent_frame_id, |
206 bool is_main_frame, | 211 bool is_main_frame, |
207 const GURL& validated_url, | 212 const GURL& validated_url, |
208 bool is_error_page, | 213 bool is_error_page, |
209 bool is_iframe_srcdoc, | 214 bool is_iframe_srcdoc, |
210 content::RenderViewHost* render_view_host) OVERRIDE; | 215 content::RenderViewHost* render_view_host) OVERRIDE; |
| 216 virtual void DidCommitProvisionalLoadForFrame( |
| 217 int64 frame_id, |
| 218 const base::string16& frame_unique_name, |
| 219 bool is_main_frame, |
| 220 const GURL& url, |
| 221 content::PageTransition transition_type, |
| 222 content::RenderViewHost* render_view_host) OVERRIDE; |
211 virtual void DidFinishLoad( | 223 virtual void DidFinishLoad( |
212 int64 frame_id, | 224 int64 frame_id, |
213 const GURL& validated_url, | 225 const GURL& validated_url, |
214 bool is_main_frame, | 226 bool is_main_frame, |
215 content::RenderViewHost* render_view_host) OVERRIDE; | 227 content::RenderViewHost* render_view_host) OVERRIDE; |
216 virtual void DidNavigateMainFrame( | 228 virtual void DidNavigateMainFrame( |
217 const content::LoadCommittedDetails& details, | 229 const content::LoadCommittedDetails& details, |
218 const content::FrameNavigateParams& params) OVERRIDE; | 230 const content::FrameNavigateParams& params) OVERRIDE; |
219 virtual void DidGetRedirectForResourceRequest( | 231 virtual void DidGetRedirectForResourceRequest( |
220 content::RenderViewHost* render_view_host, | 232 content::RenderViewHost* render_view_host, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 313 |
302 // Set the final status for how the PrerenderContents was used. This | 314 // Set the final status for how the PrerenderContents was used. This |
303 // should only be called once, and should be called before the prerender | 315 // should only be called once, and should be called before the prerender |
304 // contents are destroyed. | 316 // contents are destroyed. |
305 void SetFinalStatus(FinalStatus final_status); | 317 void SetFinalStatus(FinalStatus final_status); |
306 | 318 |
307 // These call out to methods on our Observers, using our observer_list_. Note | 319 // These call out to methods on our Observers, using our observer_list_. Note |
308 // that NotifyPrerenderStop() also clears the observer list. | 320 // that NotifyPrerenderStop() also clears the observer list. |
309 void NotifyPrerenderStart(); | 321 void NotifyPrerenderStart(); |
310 void NotifyPrerenderStopLoading(); | 322 void NotifyPrerenderStopLoading(); |
| 323 void NotifyPrerenderDomContentLoaded(); |
311 void NotifyPrerenderStop(); | 324 void NotifyPrerenderStop(); |
312 void NotifyPrerenderCreatedMatchCompleteReplacement( | 325 void NotifyPrerenderCreatedMatchCompleteReplacement( |
313 PrerenderContents* replacement); | 326 PrerenderContents* replacement); |
314 | 327 |
315 // Called whenever a RenderViewHost is created for prerendering. Only called | 328 // Called whenever a RenderViewHost is created for prerendering. Only called |
316 // once the RenderViewHost has a RenderView and RenderWidgetHostView. | 329 // once the RenderViewHost has a RenderView and RenderWidgetHostView. |
317 virtual void OnRenderViewHostCreated( | 330 virtual void OnRenderViewHostCreated( |
318 content::RenderViewHost* new_render_view_host); | 331 content::RenderViewHost* new_render_view_host); |
319 | 332 |
320 content::NotificationRegistrar& notification_registrar() { | 333 content::NotificationRegistrar& notification_registrar() { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 | 431 |
419 // Origin for this prerender. | 432 // Origin for this prerender. |
420 Origin origin_; | 433 Origin origin_; |
421 | 434 |
422 // Experiment during which this prerender is performed. | 435 // Experiment during which this prerender is performed. |
423 uint8 experiment_id_; | 436 uint8 experiment_id_; |
424 | 437 |
425 // The process that created the child id. | 438 // The process that created the child id. |
426 int creator_child_id_; | 439 int creator_child_id_; |
427 | 440 |
| 441 // Main frame ID of last committed page. |
| 442 int64 main_frame_id_; |
| 443 |
428 // The size of the WebView from the launching page. | 444 // The size of the WebView from the launching page. |
429 gfx::Size size_; | 445 gfx::Size size_; |
430 | 446 |
431 typedef std::vector<history::HistoryAddPageArgs> AddPageVector; | 447 typedef std::vector<history::HistoryAddPageArgs> AddPageVector; |
432 | 448 |
433 // Caches pages to be added to the history. | 449 // Caches pages to be added to the history. |
434 AddPageVector add_page_vector_; | 450 AddPageVector add_page_vector_; |
435 | 451 |
436 // The alias session storage namespace for this prerender. | 452 // The alias session storage namespace for this prerender. |
437 scoped_refptr<content::SessionStorageNamespace> | 453 scoped_refptr<content::SessionStorageNamespace> |
438 alias_session_storage_namespace; | 454 alias_session_storage_namespace; |
439 | 455 |
440 // Indicates what internal cookie events (see prerender_contents.cc) have | 456 // Indicates what internal cookie events (see prerender_contents.cc) have |
441 // occurred, using 1 bit for each possible InternalCookieEvent. | 457 // occurred, using 1 bit for each possible InternalCookieEvent. |
442 int cookie_status_; | 458 int cookie_status_; |
443 | 459 |
444 // Resources that are throttled, pending a prerender use. Can only access a | 460 // Resources that are throttled, pending a prerender use. Can only access a |
445 // throttle on the IO thread. | 461 // throttle on the IO thread. |
446 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_; | 462 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_; |
447 | 463 |
448 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 464 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
449 }; | 465 }; |
450 | 466 |
451 } // namespace prerender | 467 } // namespace prerender |
452 | 468 |
453 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 469 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
OLD | NEW |