| 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_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // destroyed as well. | 266 // destroyed as well. |
| 267 // | 267 // |
| 268 // If the CLEAR_PRERENDER_HISTORY bit is set, the prerender history is | 268 // If the CLEAR_PRERENDER_HISTORY bit is set, the prerender history is |
| 269 // cleared, including any entries newly created by destroying them in | 269 // cleared, including any entries newly created by destroying them in |
| 270 // response to the CLEAR_PRERENDER_CONTENTS flag. | 270 // response to the CLEAR_PRERENDER_CONTENTS flag. |
| 271 // | 271 // |
| 272 // Intended to be used when clearing the cache or history. | 272 // Intended to be used when clearing the cache or history. |
| 273 void ClearData(int clear_flags); | 273 void ClearData(int clear_flags); |
| 274 | 274 |
| 275 // Record a final status of a prerendered page in a histogram. | 275 // Record a final status of a prerendered page in a histogram. |
| 276 // This variation allows specifying whether prerendering had been started | 276 void RecordFinalStatus(Origin origin, FinalStatus final_status) const; |
| 277 // (necessary to flag MatchComplete dummies). | |
| 278 void RecordFinalStatusWithMatchCompleteStatus( | |
| 279 Origin origin, | |
| 280 PrerenderContents::MatchCompleteStatus mc_status, | |
| 281 FinalStatus final_status) const; | |
| 282 | 277 |
| 283 // content::NotificationObserver | 278 // content::NotificationObserver |
| 284 void Observe(int type, | 279 void Observe(int type, |
| 285 const content::NotificationSource& source, | 280 const content::NotificationSource& source, |
| 286 const content::NotificationDetails& details) override; | 281 const content::NotificationDetails& details) override; |
| 287 | 282 |
| 288 // MediaCaptureDevicesDispatcher::Observer | 283 // MediaCaptureDevicesDispatcher::Observer |
| 289 void OnCreatingAudioStream(int render_process_id, | 284 void OnCreatingAudioStream(int render_process_id, |
| 290 int render_frame_id) override; | 285 int render_frame_id) override; |
| 291 | 286 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 487 |
| 493 // Returns a new Value representing the pages currently being prerendered. The | 488 // Returns a new Value representing the pages currently being prerendered. The |
| 494 // caller is responsible for delete'ing the return value. | 489 // caller is responsible for delete'ing the return value. |
| 495 base::Value* GetActivePrerendersAsValue() const; | 490 base::Value* GetActivePrerendersAsValue() const; |
| 496 | 491 |
| 497 // Destroys all pending prerenders using FinalStatus. Also deletes them as | 492 // Destroys all pending prerenders using FinalStatus. Also deletes them as |
| 498 // well as any swapped out WebContents queued for destruction. | 493 // well as any swapped out WebContents queued for destruction. |
| 499 // Used both on destruction, and when clearing the browsing history. | 494 // Used both on destruction, and when clearing the browsing history. |
| 500 void DestroyAllContents(FinalStatus final_status); | 495 void DestroyAllContents(FinalStatus final_status); |
| 501 | 496 |
| 502 // Helper function to destroy a PrerenderContents with the specified | |
| 503 // final_status, while at the same time recording that for the MatchComplete | |
| 504 // case, that this prerender would have been used. | |
| 505 void DestroyAndMarkMatchCompleteAsUsed(PrerenderContents* prerender_contents, | |
| 506 FinalStatus final_status); | |
| 507 | |
| 508 // Records the final status a prerender in the case that a PrerenderContents | 497 // Records the final status a prerender in the case that a PrerenderContents |
| 509 // was never created, and also adds a PrerenderHistory entry. | 498 // was never created, and also adds a PrerenderHistory entry. |
| 510 // This is a helper function which will ultimately call | |
| 511 // RecordFinalStatusWthMatchCompleteStatus, using MATCH_COMPLETE_DEFAULT. | |
| 512 void RecordFinalStatusWithoutCreatingPrerenderContents( | 499 void RecordFinalStatusWithoutCreatingPrerenderContents( |
| 513 const GURL& url, Origin origin, FinalStatus final_status) const; | 500 const GURL& url, Origin origin, FinalStatus final_status) const; |
| 514 | 501 |
| 515 | 502 |
| 516 // Swaps a prerender |prerender_data| for |url| into the tab, replacing | 503 // Swaps a prerender |prerender_data| for |url| into the tab, replacing |
| 517 // |web_contents|. Returns the new WebContents that was swapped in, or NULL | 504 // |web_contents|. Returns the new WebContents that was swapped in, or NULL |
| 518 // if a swap-in was not possible. If |should_replace_current_entry| is true, | 505 // if a swap-in was not possible. If |should_replace_current_entry| is true, |
| 519 // the current history entry in |web_contents| is replaced. | 506 // the current history entry in |web_contents| is replaced. |
| 520 content::WebContents* SwapInternal(const GURL& url, | 507 content::WebContents* SwapInternal(const GURL& url, |
| 521 content::WebContents* web_contents, | 508 content::WebContents* web_contents, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 // Set of process hosts being prerendered. | 560 // Set of process hosts being prerendered. |
| 574 typedef std::set<content::RenderProcessHost*> PrerenderProcessSet; | 561 typedef std::set<content::RenderProcessHost*> PrerenderProcessSet; |
| 575 PrerenderProcessSet prerender_process_hosts_; | 562 PrerenderProcessSet prerender_process_hosts_; |
| 576 | 563 |
| 577 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 564 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 578 }; | 565 }; |
| 579 | 566 |
| 580 } // namespace prerender | 567 } // namespace prerender |
| 581 | 568 |
| 582 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 569 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |