| 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 <map> | 10 #include <map> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 PRERENDER_MODE_DISABLED, | 46 PRERENDER_MODE_DISABLED, |
| 47 PRERENDER_MODE_ENABLED, | 47 PRERENDER_MODE_ENABLED, |
| 48 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP, | 48 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP, |
| 49 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP, | 49 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP, |
| 50 PRERENDER_MODE_MAX | 50 PRERENDER_MODE_MAX |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 // Owned by a Profile object for the lifetime of the profile. | 53 // Owned by a Profile object for the lifetime of the profile. |
| 54 explicit PrerenderManager(Profile* profile); | 54 explicit PrerenderManager(Profile* profile); |
| 55 | 55 |
| 56 // Preloads the URL supplied. alias_urls indicates URLs that redirect | 56 // Preloads |url| if valid. |alias_urls| indicates URLs that redirect |
| 57 // to the same URL to be preloaded. Returns true if the URL was added, | 57 // to the same URL to be preloaded. |child_route_id_pair| identifies the |
| 58 // false if it was not. | 58 // RenderViewHost that the prerender request came from and is used to |
| 59 bool AddPreload(const GURL& url, const std::vector<GURL>& alias_urls, | 59 // set the initial window size of the RenderViewHost used for prerendering. |
| 60 const GURL& referrer); | 60 // Returns true if the URL was added, false if it was not. |
| 61 bool AddPreload( |
| 62 const std::pair<int, int>& child_route_id_pair, |
| 63 const GURL& url, |
| 64 const std::vector<GURL>& alias_urls, |
| 65 const GURL& referrer); |
| 61 | 66 |
| 62 void AddPendingPreload(const std::pair<int, int>& child_route_id_pair, | 67 void AddPendingPreload(const std::pair<int, int>& child_route_id_pair, |
| 63 const GURL& url, | 68 const GURL& url, |
| 64 const std::vector<GURL>& alias_urls, | 69 const std::vector<GURL>& alias_urls, |
| 65 const GURL& referrer); | 70 const GURL& referrer); |
| 66 | 71 |
| 67 // For a given TabContents that wants to navigate to the URL supplied, | 72 // For a given TabContents that wants to navigate to the URL supplied, |
| 68 // determines whether a preloaded version of the URL can be used, | 73 // determines whether a preloaded version of the URL can be used, |
| 69 // and substitutes the prerendered RVH into the TabContents. Returns | 74 // and substitutes the prerendered RVH into the TabContents. Returns |
| 70 // whether or not a prerendered RVH could be used or not. | 75 // whether or not a prerendered RVH could be used or not. |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 248 |
| 244 // Track time of last prerender to limit prerender spam. | 249 // Track time of last prerender to limit prerender spam. |
| 245 base::TimeTicks last_prerender_start_time_; | 250 base::TimeTicks last_prerender_start_time_; |
| 246 | 251 |
| 247 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 252 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 248 }; | 253 }; |
| 249 | 254 |
| 250 } // prerender | 255 } // prerender |
| 251 | 256 |
| 252 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 257 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |