| 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 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 const GURL& url, | 127 const GURL& url, |
| 128 content::SessionStorageNamespace* session_storage_namespace, | 128 content::SessionStorageNamespace* session_storage_namespace, |
| 129 const gfx::Size& size); | 129 const gfx::Size& size); |
| 130 | 130 |
| 131 PrerenderHandle* AddPrerenderFromExternalRequest( | 131 PrerenderHandle* AddPrerenderFromExternalRequest( |
| 132 const GURL& url, | 132 const GURL& url, |
| 133 const content::Referrer& referrer, | 133 const content::Referrer& referrer, |
| 134 content::SessionStorageNamespace* session_storage_namespace, | 134 content::SessionStorageNamespace* session_storage_namespace, |
| 135 const gfx::Size& size); | 135 const gfx::Size& size); |
| 136 | 136 |
| 137 // Adds a prerender from an external request that will prerender even on |
| 138 // cellular networks as long as the user setting for prerendering is ON. |
| 139 PrerenderHandle* AddPrerenderOnCellularFromExternalRequest( |
| 140 const GURL& url, |
| 141 const content::Referrer& referrer, |
| 142 content::SessionStorageNamespace* session_storage_namespace, |
| 143 const gfx::Size& size); |
| 144 |
| 137 // Adds a prerender for Instant Search |url| if valid. The | 145 // Adds a prerender for Instant Search |url| if valid. The |
| 138 // |session_storage_namespace| matches the namespace of the active tab at the | 146 // |session_storage_namespace| matches the namespace of the active tab at the |
| 139 // time the prerender is generated. Returns a caller-owned PrerenderHandle* or | 147 // time the prerender is generated. Returns a caller-owned PrerenderHandle* or |
| 140 // NULL. | 148 // NULL. |
| 141 PrerenderHandle* AddPrerenderForInstant( | 149 PrerenderHandle* AddPrerenderForInstant( |
| 142 const GURL& url, | 150 const GURL& url, |
| 143 content::SessionStorageNamespace* session_storage_namespace, | 151 content::SessionStorageNamespace* session_storage_namespace, |
| 144 const gfx::Size& size); | 152 const gfx::Size& size); |
| 145 | 153 |
| 146 // Cancels all active prerenders. | 154 // Cancels all active prerenders. |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 396 |
| 389 // Time window for which we record old navigations, in milliseconds. | 397 // Time window for which we record old navigations, in milliseconds. |
| 390 static const int kNavigationRecordWindowMs = 5000; | 398 static const int kNavigationRecordWindowMs = 5000; |
| 391 | 399 |
| 392 void OnCancelPrerenderHandle(PrerenderData* prerender_data); | 400 void OnCancelPrerenderHandle(PrerenderData* prerender_data); |
| 393 | 401 |
| 394 // Returns whether prerendering is currently enabled or the reason why it is | 402 // Returns whether prerendering is currently enabled or the reason why it is |
| 395 // disabled. | 403 // disabled. |
| 396 chrome_browser_net::NetworkPredictionStatus GetPredictionStatus() const; | 404 chrome_browser_net::NetworkPredictionStatus GetPredictionStatus() const; |
| 397 | 405 |
| 406 // Returns whether prerendering is currently enabled or the reason why it is |
| 407 // disabled after taking into account the origin of the request. |
| 408 chrome_browser_net::NetworkPredictionStatus GetPredictionStatusForOrigin( |
| 409 Origin origin) const; |
| 410 |
| 398 // Adds a prerender for |url| from |referrer|. The |origin| specifies how the | 411 // Adds a prerender for |url| from |referrer|. The |origin| specifies how the |
| 399 // prerender was added. If |size| is empty, then | 412 // prerender was added. If |size| is empty, then |
| 400 // PrerenderContents::StartPrerendering will instead use a default from | 413 // PrerenderContents::StartPrerendering will instead use a default from |
| 401 // PrerenderConfig. Returns a PrerenderHandle*, owned by the caller, or NULL. | 414 // PrerenderConfig. Returns a PrerenderHandle*, owned by the caller, or NULL. |
| 402 PrerenderHandle* AddPrerender( | 415 PrerenderHandle* AddPrerender( |
| 403 Origin origin, | 416 Origin origin, |
| 404 const GURL& url, | 417 const GURL& url, |
| 405 const content::Referrer& referrer, | 418 const content::Referrer& referrer, |
| 406 const gfx::Size& size, | 419 const gfx::Size& size, |
| 407 content::SessionStorageNamespace* session_storage_namespace); | 420 content::SessionStorageNamespace* session_storage_namespace); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 // Set of process hosts being prerendered. | 561 // Set of process hosts being prerendered. |
| 549 typedef std::set<content::RenderProcessHost*> PrerenderProcessSet; | 562 typedef std::set<content::RenderProcessHost*> PrerenderProcessSet; |
| 550 PrerenderProcessSet prerender_process_hosts_; | 563 PrerenderProcessSet prerender_process_hosts_; |
| 551 | 564 |
| 552 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 565 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 553 }; | 566 }; |
| 554 | 567 |
| 555 } // namespace prerender | 568 } // namespace prerender |
| 556 | 569 |
| 557 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 570 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |