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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // set the initial window size of the RenderViewHost used for prerendering. | 94 // set the initial window size of the RenderViewHost used for prerendering. |
95 // Returns true if the URL was added, false if it was not. | 95 // Returns true if the URL was added, false if it was not. |
96 // If the RenderViewHost source is itself prerendering, the prerender is added | 96 // If the RenderViewHost source is itself prerendering, the prerender is added |
97 // as a pending prerender. | 97 // as a pending prerender. |
98 bool AddPrerenderFromLinkRelPrerender(int process_id, int route_id, | 98 bool AddPrerenderFromLinkRelPrerender(int process_id, int route_id, |
99 const GURL& url, const GURL& referrer); | 99 const GURL& url, const GURL& referrer); |
100 | 100 |
101 // Adds a prerender for |url| if valid. As the prerender request is coming | 101 // Adds a prerender for |url| if valid. As the prerender request is coming |
102 // from a source without a RenderViewHost (i.e., the omnibox) we don't have a | 102 // from a source without a RenderViewHost (i.e., the omnibox) we don't have a |
103 // child or route id, or a referrer. This method uses sensible values for | 103 // child or route id, or a referrer. This method uses sensible values for |
104 // those. | 104 // those. The |session_storage_namespace| matches the namespace of the active |
105 bool AddPrerenderFromOmnibox(const GURL& url); | 105 // tab at the time the prerender is generated from the omnibox. |
| 106 bool AddPrerenderFromOmnibox( |
| 107 const GURL& url, |
| 108 SessionStorageNamespace* session_storage_namespace); |
106 | 109 |
107 // Destroy all prerenders for the given child route id pair and assign a final | 110 // Destroy all prerenders for the given child route id pair and assign a final |
108 // status to them. | 111 // status to them. |
109 virtual void DestroyPrerenderForRenderView(int process_id, int view_id, | 112 virtual void DestroyPrerenderForRenderView(int process_id, int view_id, |
110 FinalStatus final_status); | 113 FinalStatus final_status); |
111 | 114 |
112 // Cancels all active prerenders. | 115 // Cancels all active prerenders. |
113 void CancelAllPrerenders(); | 116 void CancelAllPrerenders(); |
114 | 117 |
115 // For a given TabContents that wants to navigate to the URL supplied, | 118 // For a given TabContents that wants to navigate to the URL supplied, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 241 |
239 struct PrerenderContentsData; | 242 struct PrerenderContentsData; |
240 struct NavigationRecord; | 243 struct NavigationRecord; |
241 | 244 |
242 class OnCloseTabContentsDeleter; | 245 class OnCloseTabContentsDeleter; |
243 | 246 |
244 class MostVisitedSites; | 247 class MostVisitedSites; |
245 | 248 |
246 // Adds a prerender for |url| from referrer |referrer| initiated from the | 249 // Adds a prerender for |url| from referrer |referrer| initiated from the |
247 // RenderViewHost specified by |child_route_id_pair|. The |origin| specifies | 250 // RenderViewHost specified by |child_route_id_pair|. The |origin| specifies |
248 // how the prerender was added. | 251 // how the prerender was added. If the |session_storage_namespace| is NULL, |
| 252 // it is discovered using the RenderViewHost specified by |
| 253 // |child_route_id_pair|. |
249 bool AddPrerender( | 254 bool AddPrerender( |
250 Origin origin, | 255 Origin origin, |
251 const std::pair<int, int>& child_route_id_pair, | 256 const std::pair<int, int>& child_route_id_pair, |
252 const GURL& url, | 257 const GURL& url, |
253 const GURL& referrer); | 258 const GURL& referrer, |
| 259 SessionStorageNamespace* session_storage_namespace); |
254 | 260 |
255 // Adds a pending preload issued by the prerendering RenderView identified by | 261 // Adds a pending preload issued by the prerendering RenderView identified by |
256 // |child_route_id_pair|. If and when that prerendering RenderView is used, | 262 // |child_route_id_pair|. If and when that prerendering RenderView is used, |
257 // the specified prerender will start. | 263 // the specified prerender will start. |
258 void AddPendingPrerender(Origin origin, | 264 void AddPendingPrerender(Origin origin, |
259 const std::pair<int, int>& child_route_id_pair, | 265 const std::pair<int, int>& child_route_id_pair, |
260 const GURL& url, | 266 const GURL& url, |
261 const GURL& referrer); | 267 const GURL& referrer); |
262 | 268 |
263 // Retrieves the PrerenderContents object for the specified URL, if it | 269 // Retrieves the PrerenderContents object for the specified URL, if it |
(...skipping 22 matching lines...) Expand all Loading... |
286 | 292 |
287 // Posts a task to call PeriodicCleanup. Results in quicker destruction of | 293 // Posts a task to call PeriodicCleanup. Results in quicker destruction of |
288 // objects. If |this| is deleted before the task is run, the task will | 294 // objects. If |this| is deleted before the task is run, the task will |
289 // automatically be cancelled. | 295 // automatically be cancelled. |
290 void PostCleanupTask(); | 296 void PostCleanupTask(); |
291 | 297 |
292 bool IsPrerenderElementFresh(const base::Time start) const; | 298 bool IsPrerenderElementFresh(const base::Time start) const; |
293 void DeleteOldEntries(); | 299 void DeleteOldEntries(); |
294 virtual base::Time GetCurrentTime() const; | 300 virtual base::Time GetCurrentTime() const; |
295 virtual base::TimeTicks GetCurrentTimeTicks() const; | 301 virtual base::TimeTicks GetCurrentTimeTicks() const; |
296 virtual PrerenderContents* CreatePrerenderContents(const GURL& url, | 302 virtual PrerenderContents* CreatePrerenderContents( |
297 const GURL& referrer, | 303 const GURL& url, |
298 Origin origin, | 304 const GURL& referrer, |
299 uint8 experiment_id); | 305 Origin origin, |
| 306 uint8 experiment_id); |
300 | 307 |
301 // Checks if the PrerenderContents has been added to the pending delete list. | 308 // Checks if the PrerenderContents has been added to the pending delete list. |
302 bool IsPendingDelete(PrerenderContents* entry) const; | 309 bool IsPendingDelete(PrerenderContents* entry) const; |
303 | 310 |
304 // Deletes any PrerenderContents that have been added to the pending delete | 311 // Deletes any PrerenderContents that have been added to the pending delete |
305 // list. | 312 // list. |
306 void DeletePendingDeleteEntries(); | 313 void DeletePendingDeleteEntries(); |
307 | 314 |
308 // Finds the specified PrerenderContents and returns it, if it exists. | 315 // Finds the specified PrerenderContents and returns it, if it exists. |
309 // Returns NULL otherwise. Unlike GetEntry, the PrerenderManager maintains | 316 // Returns NULL otherwise. Unlike GetEntry, the PrerenderManager maintains |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 421 |
415 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 422 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
416 }; | 423 }; |
417 | 424 |
418 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 425 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
419 int render_process_id); | 426 int render_process_id); |
420 | 427 |
421 } // namespace prerender | 428 } // namespace prerender |
422 | 429 |
423 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 430 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |