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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 static const char* GetModeString(); | 179 static const char* GetModeString(); |
180 static bool IsPrerenderingPossible(); | 180 static bool IsPrerenderingPossible(); |
181 static bool ActuallyPrerendering(); | 181 static bool ActuallyPrerendering(); |
182 static bool IsControlGroup(); | 182 static bool IsControlGroup(); |
183 static bool IsNoUseGroup(); | 183 static bool IsNoUseGroup(); |
184 | 184 |
185 // Query the list of current prerender pages to see if the given web contents | 185 // Query the list of current prerender pages to see if the given web contents |
186 // is prerendering a page. | 186 // is prerendering a page. |
187 bool IsWebContentsPrerendering(content::WebContents* web_contents) const; | 187 bool IsWebContentsPrerendering(content::WebContents* web_contents) const; |
188 | 188 |
189 // Returns true if there is a prerendered page for the given URL and it has | |
190 // finished loading. Only valid if called before MaybeUsePrerenderedPage. | |
191 bool DidPrerenderFinishLoading(const GURL& url) const; | |
192 | |
193 // Maintaining and querying the set of WebContents belonging to this | 189 // Maintaining and querying the set of WebContents belonging to this |
194 // PrerenderManager that are currently showing prerendered pages. | 190 // PrerenderManager that are currently showing prerendered pages. |
195 void MarkWebContentsAsPrerendered(content::WebContents* web_contents); | 191 void MarkWebContentsAsPrerendered(content::WebContents* web_contents); |
196 void MarkWebContentsAsWouldBePrerendered(content::WebContents* web_contents); | 192 void MarkWebContentsAsWouldBePrerendered(content::WebContents* web_contents); |
197 void MarkWebContentsAsNotPrerendered(content::WebContents* web_contents); | 193 void MarkWebContentsAsNotPrerendered(content::WebContents* web_contents); |
198 bool IsWebContentsPrerendered(content::WebContents* web_contents) const; | 194 bool IsWebContentsPrerendered(content::WebContents* web_contents) const; |
199 bool WouldWebContentsBePrerendered(content::WebContents* web_contents) const; | 195 bool WouldWebContentsBePrerendered(content::WebContents* web_contents) const; |
200 | 196 |
201 // Checks whether |url| has been recently navigated to. | 197 // Checks whether |url| has been recently navigated to. |
202 bool HasRecentlyBeenNavigatedTo(const GURL& url); | 198 bool HasRecentlyBeenNavigatedTo(const GURL& url); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 bool IsPrerenderElementFresh(const base::Time start) const; | 347 bool IsPrerenderElementFresh(const base::Time start) const; |
352 void DeleteOldEntries(); | 348 void DeleteOldEntries(); |
353 virtual base::Time GetCurrentTime() const; | 349 virtual base::Time GetCurrentTime() const; |
354 virtual base::TimeTicks GetCurrentTimeTicks() const; | 350 virtual base::TimeTicks GetCurrentTimeTicks() const; |
355 virtual PrerenderContents* CreatePrerenderContents( | 351 virtual PrerenderContents* CreatePrerenderContents( |
356 const GURL& url, | 352 const GURL& url, |
357 const content::Referrer& referrer, | 353 const content::Referrer& referrer, |
358 Origin origin, | 354 Origin origin, |
359 uint8 experiment_id); | 355 uint8 experiment_id); |
360 | 356 |
361 // Checks if the PrerenderContents has been added to the pending delete list. | |
362 bool IsPendingDelete(PrerenderContents* entry) const; | |
363 | |
364 // Deletes any PrerenderContents that have been added to the pending delete | 357 // Deletes any PrerenderContents that have been added to the pending delete |
365 // list. | 358 // list. |
366 void DeletePendingDeleteEntries(); | 359 void DeletePendingDeleteEntries(); |
367 | 360 |
368 // Finds the specified PrerenderContentsData/PrerenderContents and returns it, | 361 // Finds the specified PrerenderContentsData/PrerenderContents and returns it, |
369 // if it exists. Returns NULL otherwise. Unlike GetEntry, the | 362 // if it exists. Returns NULL otherwise. Unlike GetEntry, the |
370 // PrerenderManager maintains ownership of the PrerenderContents. | 363 // PrerenderManager maintains ownership of the PrerenderContents. |
371 PrerenderContentsData* FindEntryData(const GURL& url); | 364 PrerenderContentsData* FindEntryData(const GURL& url); |
372 PrerenderContents* FindEntry(const GURL& url) const; | 365 PrerenderContents* FindEntry(const GURL& url) const; |
373 | 366 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 483 |
491 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 484 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
492 }; | 485 }; |
493 | 486 |
494 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 487 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
495 int render_process_id); | 488 int render_process_id); |
496 | 489 |
497 } // namespace prerender | 490 } // namespace prerender |
498 | 491 |
499 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 492 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |