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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 const net::CookieList* cookie_list); | 353 const net::CookieList* cookie_list); |
354 | 354 |
355 // Arranges for all session storage merges to hang indefinitely. This is used | 355 // Arranges for all session storage merges to hang indefinitely. This is used |
356 // to reliably test various swap abort cases. | 356 // to reliably test various swap abort cases. |
357 static void HangSessionStorageMergesForTesting(); | 357 static void HangSessionStorageMergesForTesting(); |
358 | 358 |
359 // Notification that a prerender has completed and its bytes should be | 359 // Notification that a prerender has completed and its bytes should be |
360 // recorded. | 360 // recorded. |
361 void RecordNetworkBytes(Origin origin, bool used, int64 prerender_bytes); | 361 void RecordNetworkBytes(Origin origin, bool used, int64 prerender_bytes); |
362 | 362 |
| 363 // Returns whether prerendering is currently enabled for this manager. |
| 364 bool IsEnabled() const; |
| 365 |
363 // Add to the running tally of bytes transferred over the network for this | 366 // Add to the running tally of bytes transferred over the network for this |
364 // profile if prerendering is currently enabled. | 367 // profile if prerendering is currently enabled. |
365 void AddProfileNetworkBytesIfEnabled(int64 bytes); | 368 void AddProfileNetworkBytesIfEnabled(int64 bytes); |
366 | 369 |
367 // Registers a new ProcessHost performing a prerender. Called by | 370 // Registers a new ProcessHost performing a prerender. Called by |
368 // PrerenderContents. | 371 // PrerenderContents. |
369 void AddPrerenderProcessHost(content::RenderProcessHost* process_host); | 372 void AddPrerenderProcessHost(content::RenderProcessHost* process_host); |
370 | 373 |
371 // Returns whether or not |process_host| may be reused for new navigations | 374 // Returns whether or not |process_host| may be reused for new navigations |
372 // from a prerendering perspective. Currently, if Prerender Cookie Stores are | 375 // from a prerendering perspective. Currently, if Prerender Cookie Stores are |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 FinalStatus final_status); | 656 FinalStatus final_status); |
654 | 657 |
655 // Records the final status a prerender in the case that a PrerenderContents | 658 // Records the final status a prerender in the case that a PrerenderContents |
656 // was never created, and also adds a PrerenderHistory entry. | 659 // was never created, and also adds a PrerenderHistory entry. |
657 // This is a helper function which will ultimately call | 660 // This is a helper function which will ultimately call |
658 // RecordFinalStatusWthMatchCompleteStatus, using MATCH_COMPLETE_DEFAULT. | 661 // RecordFinalStatusWthMatchCompleteStatus, using MATCH_COMPLETE_DEFAULT. |
659 void RecordFinalStatusWithoutCreatingPrerenderContents( | 662 void RecordFinalStatusWithoutCreatingPrerenderContents( |
660 const GURL& url, Origin origin, uint8 experiment_id, | 663 const GURL& url, Origin origin, uint8 experiment_id, |
661 FinalStatus final_status) const; | 664 FinalStatus final_status) const; |
662 | 665 |
663 // Returns whether prerendering is currently enabled for this manager. | |
664 // Must be called on the UI thread. | |
665 bool IsEnabled() const; | |
666 | 666 |
667 void CookieChanged(ChromeCookieDetails* details); | 667 void CookieChanged(ChromeCookieDetails* details); |
668 void CookieChangedAnyCookiesLeftLookupResult(const std::string& domain_key, | 668 void CookieChangedAnyCookiesLeftLookupResult(const std::string& domain_key, |
669 bool cookies_exist); | 669 bool cookies_exist); |
670 void LoggedInPredictorDataReceived(scoped_ptr<LoggedInStateMap> new_map); | 670 void LoggedInPredictorDataReceived(scoped_ptr<LoggedInStateMap> new_map); |
671 | 671 |
672 void RecordEvent(PrerenderContents* contents, PrerenderEvent event) const; | 672 void RecordEvent(PrerenderContents* contents, PrerenderEvent event) const; |
673 | 673 |
674 // Swaps a prerender |prerender_data| for |url| into the tab, replacing | 674 // Swaps a prerender |prerender_data| for |url| into the tab, replacing |
675 // |web_contents|. Returns the new WebContents that was swapped in, or NULL | 675 // |web_contents|. Returns the new WebContents that was swapped in, or NULL |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 bool cookie_store_loaded_; | 759 bool cookie_store_loaded_; |
760 | 760 |
761 base::Closure on_cookie_store_loaded_cb_for_testing_; | 761 base::Closure on_cookie_store_loaded_cb_for_testing_; |
762 | 762 |
763 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 763 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
764 }; | 764 }; |
765 | 765 |
766 } // namespace prerender | 766 } // namespace prerender |
767 | 767 |
768 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 768 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |