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_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 21 matching lines...) Expand all Loading... |
32 namespace content { | 32 namespace content { |
33 class RenderViewHost; | 33 class RenderViewHost; |
34 class SessionStorageNamespace; | 34 class SessionStorageNamespace; |
35 class WebContents; | 35 class WebContents; |
36 } | 36 } |
37 | 37 |
38 namespace history { | 38 namespace history { |
39 struct HistoryAddPageArgs; | 39 struct HistoryAddPageArgs; |
40 } | 40 } |
41 | 41 |
| 42 namespace net { |
| 43 class URLRequestContextGetter; |
| 44 } |
| 45 |
42 namespace prerender { | 46 namespace prerender { |
43 | 47 |
44 class PrerenderHandle; | 48 class PrerenderHandle; |
45 class PrerenderManager; | 49 class PrerenderManager; |
46 class PrerenderResourceThrottle; | 50 class PrerenderResourceThrottle; |
47 | 51 |
48 class PrerenderContents : public content::NotificationObserver, | 52 class PrerenderContents : public content::NotificationObserver, |
49 public content::WebContentsObserver { | 53 public content::WebContentsObserver, |
| 54 public base::SupportsWeakPtr<PrerenderContents> { |
50 public: | 55 public: |
51 // PrerenderContents::Create uses the currently registered Factory to create | 56 // PrerenderContents::Create uses the currently registered Factory to create |
52 // the PrerenderContents. Factory is intended for testing. | 57 // the PrerenderContents. Factory is intended for testing. |
53 class Factory { | 58 class Factory { |
54 public: | 59 public: |
55 Factory() {} | 60 Factory() {} |
56 virtual ~Factory() {} | 61 virtual ~Factory() {} |
57 | 62 |
58 // Ownership is not transfered through this interface as prerender_manager, | 63 // Ownership is not transfered through this interface as prerender_manager, |
59 // prerender_tracker, and profile are stored as weak pointers. | 64 // prerender_tracker, and profile are stored as weak pointers. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // starting a prerender, without actually creating the RenderView. | 149 // starting a prerender, without actually creating the RenderView. |
145 // |creator_child_id| is the id of the child process that caused the prerender | 150 // |creator_child_id| is the id of the child process that caused the prerender |
146 // to be created, and is needed so that the prerendered URLs can be sent to it | 151 // to be created, and is needed so that the prerendered URLs can be sent to it |
147 // so render-initiated navigations will swap in the prerendered page. |size| | 152 // so render-initiated navigations will swap in the prerendered page. |size| |
148 // indicates the rectangular dimensions that the prerendered page should be. | 153 // indicates the rectangular dimensions that the prerendered page should be. |
149 // |session_storage_namespace| indicates the namespace that the prerendered | 154 // |session_storage_namespace| indicates the namespace that the prerendered |
150 // page should be part of. | 155 // page should be part of. |
151 virtual void StartPrerendering( | 156 virtual void StartPrerendering( |
152 int creator_child_id, | 157 int creator_child_id, |
153 const gfx::Size& size, | 158 const gfx::Size& size, |
154 content::SessionStorageNamespace* session_storage_namespace); | 159 content::SessionStorageNamespace* session_storage_namespace, |
| 160 net::URLRequestContextGetter* request_context); |
155 | 161 |
156 // Verifies that the prerendering is not using too many resources, and kills | 162 // Verifies that the prerendering is not using too many resources, and kills |
157 // it if not. | 163 // it if not. |
158 void DestroyWhenUsingTooManyResources(); | 164 void DestroyWhenUsingTooManyResources(); |
159 | 165 |
160 content::RenderViewHost* GetRenderViewHostMutable(); | 166 content::RenderViewHost* GetRenderViewHostMutable(); |
161 const content::RenderViewHost* GetRenderViewHost() const; | 167 const content::RenderViewHost* GetRenderViewHost() const; |
162 | 168 |
163 PrerenderManager* prerender_manager() { return prerender_manager_; } | 169 PrerenderManager* prerender_manager() { return prerender_manager_; } |
164 | 170 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 // A running tally of the number of bytes this prerender has caused to be | 481 // A running tally of the number of bytes this prerender has caused to be |
476 // transferred over the network for resources. Updated with AddNetworkBytes. | 482 // transferred over the network for resources. Updated with AddNetworkBytes. |
477 int64 network_bytes_; | 483 int64 network_bytes_; |
478 | 484 |
479 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 485 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
480 }; | 486 }; |
481 | 487 |
482 } // namespace prerender | 488 } // namespace prerender |
483 | 489 |
484 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 490 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
OLD | NEW |