Chromium Code Reviews| 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 <memory> | 10 #include <memory> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 | 43 |
| 44 namespace chrome_browser_net { | 44 namespace chrome_browser_net { |
| 45 enum class NetworkPredictionStatus; | 45 enum class NetworkPredictionStatus; |
| 46 } | 46 } |
| 47 | 47 |
| 48 namespace content { | 48 namespace content { |
| 49 class WebContents; | 49 class WebContents; |
| 50 } | 50 } |
| 51 | 51 |
| 52 namespace gfx { | 52 namespace gfx { |
| 53 class Size; | 53 class Size; |
|
mmenke
2016/08/19 15:22:29
Need to add Rect here.
| |
| 54 } | 54 } |
| 55 | 55 |
| 56 namespace offline_pages { | 56 namespace offline_pages { |
| 57 class PrerenderAdapterTest; | 57 class PrerenderAdapterTest; |
| 58 } | 58 } |
| 59 | 59 |
| 60 namespace prerender { | 60 namespace prerender { |
| 61 | 61 |
| 62 class PrerenderHandle; | 62 class PrerenderHandle; |
| 63 class PrerenderHistory; | 63 class PrerenderHistory; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 // PrerenderHandle or NULL. | 124 // PrerenderHandle or NULL. |
| 125 std::unique_ptr<PrerenderHandle> AddPrerenderFromOmnibox( | 125 std::unique_ptr<PrerenderHandle> AddPrerenderFromOmnibox( |
| 126 const GURL& url, | 126 const GURL& url, |
| 127 content::SessionStorageNamespace* session_storage_namespace, | 127 content::SessionStorageNamespace* session_storage_namespace, |
| 128 const gfx::Size& size); | 128 const gfx::Size& size); |
| 129 | 129 |
| 130 std::unique_ptr<PrerenderHandle> AddPrerenderFromExternalRequest( | 130 std::unique_ptr<PrerenderHandle> AddPrerenderFromExternalRequest( |
| 131 const GURL& url, | 131 const GURL& url, |
| 132 const content::Referrer& referrer, | 132 const content::Referrer& referrer, |
| 133 content::SessionStorageNamespace* session_storage_namespace, | 133 content::SessionStorageNamespace* session_storage_namespace, |
| 134 const gfx::Size& size); | 134 const gfx::Rect& bounds); |
| 135 | 135 |
| 136 // Adds a prerender from an external request that will prerender even on | 136 // Adds a prerender from an external request that will prerender even on |
| 137 // cellular networks as long as the user setting for prerendering is ON. | 137 // cellular networks as long as the user setting for prerendering is ON. |
| 138 std::unique_ptr<PrerenderHandle> AddPrerenderOnCellularFromExternalRequest( | 138 std::unique_ptr<PrerenderHandle> AddPrerenderOnCellularFromExternalRequest( |
| 139 const GURL& url, | 139 const GURL& url, |
| 140 const content::Referrer& referrer, | 140 const content::Referrer& referrer, |
| 141 content::SessionStorageNamespace* session_storage_namespace, | 141 content::SessionStorageNamespace* session_storage_namespace, |
| 142 const gfx::Size& size); | 142 const gfx::Rect& bounds); |
| 143 | 143 |
| 144 // Adds a prerender for Instant Search |url| if valid. The | 144 // Adds a prerender for Instant Search |url| if valid. The |
| 145 // |session_storage_namespace| matches the namespace of the active tab at the | 145 // |session_storage_namespace| matches the namespace of the active tab at the |
| 146 // time the prerender is generated. Returns a PrerenderHandle or NULL. | 146 // time the prerender is generated. Returns a PrerenderHandle or NULL. |
| 147 std::unique_ptr<PrerenderHandle> AddPrerenderForInstant( | 147 std::unique_ptr<PrerenderHandle> AddPrerenderForInstant( |
| 148 const GURL& url, | 148 const GURL& url, |
| 149 content::SessionStorageNamespace* session_storage_namespace, | 149 content::SessionStorageNamespace* session_storage_namespace, |
| 150 const gfx::Size& size); | 150 const gfx::Size& size); |
| 151 | 151 |
| 152 // Adds a prerender for the background loader. Returns a PrerenderHandle if | 152 // Adds a prerender for the background loader. Returns a PrerenderHandle if |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 // Returns whether prerendering is currently enabled or the reason why it is | 406 // Returns whether prerendering is currently enabled or the reason why it is |
| 407 // disabled. | 407 // disabled. |
| 408 chrome_browser_net::NetworkPredictionStatus GetPredictionStatus() const; | 408 chrome_browser_net::NetworkPredictionStatus GetPredictionStatus() const; |
| 409 | 409 |
| 410 // Returns whether prerendering is currently enabled or the reason why it is | 410 // Returns whether prerendering is currently enabled or the reason why it is |
| 411 // disabled after taking into account the origin of the request. | 411 // disabled after taking into account the origin of the request. |
| 412 chrome_browser_net::NetworkPredictionStatus GetPredictionStatusForOrigin( | 412 chrome_browser_net::NetworkPredictionStatus GetPredictionStatusForOrigin( |
| 413 Origin origin) const; | 413 Origin origin) const; |
| 414 | 414 |
| 415 // Adds a prerender for |url| from |referrer|. The |origin| specifies how the | 415 // Adds a prerender for |url| from |referrer|. The |origin| specifies how the |
| 416 // prerender was added. If |size| is empty, then | 416 // prerender was added. If |bounds| is empty, then |
| 417 // PrerenderContents::StartPrerendering will instead use a default from | 417 // PrerenderContents::StartPrerendering will instead use a default from |
| 418 // PrerenderConfig. Returns a PrerenderHandle or NULL. | 418 // PrerenderConfig. Returns a PrerenderHandle or NULL. |
| 419 std::unique_ptr<PrerenderHandle> AddPrerender( | 419 std::unique_ptr<PrerenderHandle> AddPrerender( |
| 420 Origin origin, | 420 Origin origin, |
| 421 const GURL& url, | 421 const GURL& url, |
| 422 const content::Referrer& referrer, | 422 const content::Referrer& referrer, |
| 423 const gfx::Size& size, | 423 const gfx::Rect& bounds, |
| 424 content::SessionStorageNamespace* session_storage_namespace); | 424 content::SessionStorageNamespace* session_storage_namespace); |
| 425 | 425 |
| 426 void StartSchedulingPeriodicCleanups(); | 426 void StartSchedulingPeriodicCleanups(); |
| 427 void StopSchedulingPeriodicCleanups(); | 427 void StopSchedulingPeriodicCleanups(); |
| 428 | 428 |
| 429 void EvictOldestPrerendersIfNecessary(); | 429 void EvictOldestPrerendersIfNecessary(); |
| 430 | 430 |
| 431 // Deletes stale and cancelled prerendered PrerenderContents, as well as | 431 // Deletes stale and cancelled prerendered PrerenderContents, as well as |
| 432 // WebContents that have been replaced by prerendered WebContents. | 432 // WebContents that have been replaced by prerendered WebContents. |
| 433 // Also identifies and kills PrerenderContents that use too much | 433 // Also identifies and kills PrerenderContents that use too much |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 560 // Set of process hosts being prerendered. | 560 // Set of process hosts being prerendered. |
| 561 using PrerenderProcessSet = std::set<content::RenderProcessHost*>; | 561 using PrerenderProcessSet = std::set<content::RenderProcessHost*>; |
| 562 PrerenderProcessSet prerender_process_hosts_; | 562 PrerenderProcessSet prerender_process_hosts_; |
| 563 | 563 |
| 564 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 564 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 565 }; | 565 }; |
| 566 | 566 |
| 567 } // namespace prerender | 567 } // namespace prerender |
| 568 | 568 |
| 569 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 569 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |