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); | |
133 | 132 |
134 // Records the perceived page load time for a page - effectively the time from | 133 // Records the perceived page load time for a page - effectively the time from |
135 // when the user navigates to a page to when it finishes loading. The actual | 134 // when the user navigates to a page to when it finishes loading. The actual |
136 // load may have started prior to navigation due to prerender hints. | 135 // load may have started prior to navigation due to prerender hints. |
137 // This must be called on the UI thread. | 136 // This must be called on the UI thread. |
138 static void RecordPerceivedPageLoadTime( | 137 static void RecordPerceivedPageLoadTime( |
139 base::TimeDelta perceived_page_load_time, | 138 base::TimeDelta perceived_page_load_time, |
140 TabContents* tab_contents, | 139 TabContents* tab_contents, |
141 const GURL& url); | 140 const GURL& url); |
142 | 141 |
143 // Returns whether prerendering is currently enabled for this manager. | 142 // Returns whether prerendering is currently enabled for this manager. |
144 // Must be called on the UI thread. | 143 // Must be called on the UI thread. |
145 bool is_enabled() const; | 144 bool is_enabled() const; |
146 | 145 |
147 // Set whether prerendering is currently enabled for this manager. | 146 // Set whether prerendering is currently enabled for this manager. |
148 // Must be called on the UI thread. | 147 // Must be called on the UI thread. |
149 // If |enabled| is false, existing prerendered pages will still persist until | 148 // If |enabled| is false, existing prerendered pages will still persist until |
150 // they time out, but new ones will not be generated. | 149 // they time out, but new ones will not be generated. |
151 void set_enabled(bool enabled); | 150 void set_enabled(bool enabled); |
152 | 151 |
153 static PrerenderManagerMode GetMode(); | 152 static PrerenderManagerMode GetMode(); |
154 static void SetMode(PrerenderManagerMode mode); | 153 static void SetMode(PrerenderManagerMode mode); |
155 static bool IsPrerenderingPossible(); | 154 static bool IsPrerenderingPossible(); |
156 static bool ActuallyPrerendering(); | |
157 static bool IsControlGroup(); | 155 static bool IsControlGroup(); |
158 | 156 |
159 // Query the list of current prerender pages to see if the given tab contents | 157 // Query the list of current prerender pages to see if the given tab contents |
160 // is prerendering a page. | 158 // is prerendering a page. |
161 bool IsTabContentsPrerendering(TabContents* tab_contents) const; | 159 bool IsTabContentsPrerendering(TabContents* tab_contents) const; |
162 | 160 |
163 // Maintaining and querying the set of TabContents belonging to this | 161 // Maintaining and querying the set of TabContents belonging to this |
164 // PrerenderManager that are currently showing prerendered pages. | 162 // PrerenderManager that are currently showing prerendered pages. |
165 void MarkTabContentsAsPrerendered(TabContents* tab_contents); | 163 void MarkTabContentsAsPrerendered(TabContents* tab_contents); |
166 void MarkTabContentsAsWouldBePrerendered(TabContents* tab_contents); | 164 void MarkTabContentsAsWouldBePrerendered(TabContents* tab_contents); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 422 |
425 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 423 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
426 }; | 424 }; |
427 | 425 |
428 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 426 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
429 int render_process_id); | 427 int render_process_id); |
430 | 428 |
431 } // namespace prerender | 429 } // namespace prerender |
432 | 430 |
433 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 431 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |