| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // and substitutes the prerendered RVH into the TabContents. |opener_url| is | 121 // and substitutes the prerendered RVH into the TabContents. |opener_url| is |
| 122 // set to the window.opener url that the TabContents should have set and | 122 // set to the window.opener url that the TabContents should have set and |
| 123 // will be empty if there is no opener set. Returns whether or not a | 123 // will be empty if there is no opener set. Returns whether or not a |
| 124 // prerendered RVH could be used or not. | 124 // prerendered RVH could be used or not. |
| 125 bool MaybeUsePrerenderedPage(TabContents* tab_contents, | 125 bool MaybeUsePrerenderedPage(TabContents* tab_contents, |
| 126 const GURL& url, | 126 const GURL& url, |
| 127 const GURL& opener_url); | 127 const GURL& opener_url); |
| 128 | 128 |
| 129 // Moves a PrerenderContents to the pending delete list from the list of | 129 // Moves a PrerenderContents to the pending delete list from the list of |
| 130 // active prerenders when prerendering should be cancelled. | 130 // active prerenders when prerendering should be cancelled. |
| 131 void MoveEntryToPendingDelete(PrerenderContents* entry); | 131 void MoveEntryToPendingDelete(PrerenderContents* entry, |
| 132 FinalStatus final_status); |
| 132 | 133 |
| 133 // Records the perceived page load time for a page - effectively the time from | 134 // Records the perceived page load time for a page - effectively the time from |
| 134 // when the user navigates to a page to when it finishes loading. The actual | 135 // when the user navigates to a page to when it finishes loading. The actual |
| 135 // load may have started prior to navigation due to prerender hints. | 136 // load may have started prior to navigation due to prerender hints. |
| 136 // This must be called on the UI thread. | 137 // This must be called on the UI thread. |
| 137 static void RecordPerceivedPageLoadTime( | 138 static void RecordPerceivedPageLoadTime( |
| 138 base::TimeDelta perceived_page_load_time, | 139 base::TimeDelta perceived_page_load_time, |
| 139 TabContents* tab_contents, | 140 TabContents* tab_contents, |
| 140 const GURL& url); | 141 const GURL& url); |
| 141 | 142 |
| 142 // Returns whether prerendering is currently enabled for this manager. | 143 // Returns whether prerendering is currently enabled for this manager. |
| 143 // Must be called on the UI thread. | 144 // Must be called on the UI thread. |
| 144 bool is_enabled() const; | 145 bool is_enabled() const; |
| 145 | 146 |
| 146 // Set whether prerendering is currently enabled for this manager. | 147 // Set whether prerendering is currently enabled for this manager. |
| 147 // Must be called on the UI thread. | 148 // Must be called on the UI thread. |
| 148 // If |enabled| is false, existing prerendered pages will still persist until | 149 // If |enabled| is false, existing prerendered pages will still persist until |
| 149 // they time out, but new ones will not be generated. | 150 // they time out, but new ones will not be generated. |
| 150 void set_enabled(bool enabled); | 151 void set_enabled(bool enabled); |
| 151 | 152 |
| 152 static PrerenderManagerMode GetMode(); | 153 static PrerenderManagerMode GetMode(); |
| 153 static void SetMode(PrerenderManagerMode mode); | 154 static void SetMode(PrerenderManagerMode mode); |
| 154 static bool IsPrerenderingPossible(); | 155 static bool IsPrerenderingPossible(); |
| 156 static bool ActuallyPrerendering(); |
| 155 static bool IsControlGroup(); | 157 static bool IsControlGroup(); |
| 156 static bool IsNoUseGroup(); | 158 static bool IsNoUseGroup(); |
| 157 | 159 |
| 158 // Query the list of current prerender pages to see if the given tab contents | 160 // Query the list of current prerender pages to see if the given tab contents |
| 159 // is prerendering a page. | 161 // is prerendering a page. |
| 160 bool IsTabContentsPrerendering(TabContents* tab_contents) const; | 162 bool IsTabContentsPrerendering(TabContents* tab_contents) const; |
| 161 | 163 |
| 162 // Maintaining and querying the set of TabContents belonging to this | 164 // Maintaining and querying the set of TabContents belonging to this |
| 163 // PrerenderManager that are currently showing prerendered pages. | 165 // PrerenderManager that are currently showing prerendered pages. |
| 164 void MarkTabContentsAsPrerendered(TabContents* tab_contents); | 166 void MarkTabContentsAsPrerendered(TabContents* tab_contents); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 | 425 |
| 424 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 426 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 425 }; | 427 }; |
| 426 | 428 |
| 427 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 429 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
| 428 int render_process_id); | 430 int render_process_id); |
| 429 | 431 |
| 430 } // namespace prerender | 432 } // namespace prerender |
| 431 | 433 |
| 432 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 434 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |