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