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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <utility> | 12 #include <utility> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "chrome/browser/prerender/prerender_final_status.h" | 20 #include "chrome/browser/prerender/prerender_final_status.h" |
21 #include "chrome/browser/prerender/prerender_origin.h" | 21 #include "chrome/browser/prerender/prerender_origin.h" |
22 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
24 #include "content/public/browser/web_contents_observer.h" | 24 #include "content/public/browser/web_contents_observer.h" |
25 #include "content/public/common/referrer.h" | 25 #include "content/public/common/referrer.h" |
26 #include "ui/gfx/geometry/size.h" | 26 #include "ui/gfx/geometry/size.h" |
mmenke
2016/08/19 15:22:29
Switch to Rect header.
Yusuf
2016/08/19 17:20:33
Done. Also switched to size in cc.
| |
27 | 27 |
28 class Profile; | 28 class Profile; |
29 | 29 |
30 namespace base { | 30 namespace base { |
31 class ProcessMetrics; | 31 class ProcessMetrics; |
32 } | 32 } |
33 | 33 |
34 namespace content { | 34 namespace content { |
35 class RenderViewHost; | 35 class RenderViewHost; |
36 class SessionStorageNamespace; | 36 class SessionStorageNamespace; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 | 103 |
104 static Factory* CreateFactory(); | 104 static Factory* CreateFactory(); |
105 | 105 |
106 // Returns a PrerenderContents from the given web_contents, if it's used for | 106 // Returns a PrerenderContents from the given web_contents, if it's used for |
107 // prerendering. Otherwise returns NULL. Handles a NULL input for | 107 // prerendering. Otherwise returns NULL. Handles a NULL input for |
108 // convenience. | 108 // convenience. |
109 static PrerenderContents* FromWebContents(content::WebContents* web_contents); | 109 static PrerenderContents* FromWebContents(content::WebContents* web_contents); |
110 | 110 |
111 // Start rendering the contents in the prerendered state. If | 111 // Start rendering the contents in the prerendered state. If |
112 // |is_control_group| is true, this will go through some of the mechanics of | 112 // |is_control_group| is true, this will go through some of the mechanics of |
113 // starting a prerender, without actually creating the RenderView. |size| | 113 // starting a prerender, without actually creating the RenderView. |bounds| |
114 // indicates the rectangular dimensions that the prerendered page should be. | 114 // indicates the rectangular dimensions that the prerendered page should have. |
115 // |session_storage_namespace| indicates the namespace that the prerendered | 115 // |session_storage_namespace| indicates the namespace that the prerendered |
116 // page should be part of. | 116 // page should be part of. |
117 virtual void StartPrerendering( | 117 virtual void StartPrerendering( |
118 const gfx::Size& size, | 118 const gfx::Rect& bounds, |
119 content::SessionStorageNamespace* session_storage_namespace); | 119 content::SessionStorageNamespace* session_storage_namespace); |
120 | 120 |
121 // Verifies that the prerendering is not using too many resources, and kills | 121 // Verifies that the prerendering is not using too many resources, and kills |
122 // it if not. | 122 // it if not. |
123 void DestroyWhenUsingTooManyResources(); | 123 void DestroyWhenUsingTooManyResources(); |
124 | 124 |
125 content::RenderViewHost* GetRenderViewHostMutable(); | 125 content::RenderViewHost* GetRenderViewHostMutable(); |
126 const content::RenderViewHost* GetRenderViewHost() const; | 126 const content::RenderViewHost* GetRenderViewHost() const; |
127 | 127 |
128 PrerenderManager* prerender_manager() { return prerender_manager_; } | 128 PrerenderManager* prerender_manager() { return prerender_manager_; } |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 | 336 |
337 std::unique_ptr<WebContentsDelegateImpl> web_contents_delegate_; | 337 std::unique_ptr<WebContentsDelegateImpl> web_contents_delegate_; |
338 | 338 |
339 // These are -1 before a RenderView is created. | 339 // These are -1 before a RenderView is created. |
340 int child_id_; | 340 int child_id_; |
341 int route_id_; | 341 int route_id_; |
342 | 342 |
343 // Origin for this prerender. | 343 // Origin for this prerender. |
344 Origin origin_; | 344 Origin origin_; |
345 | 345 |
346 // The size of the WebView from the launching page. | 346 // The bounds of the WebView from the launching page. |
347 gfx::Size size_; | 347 gfx::Rect bounds_; |
348 | 348 |
349 typedef std::vector<history::HistoryAddPageArgs> AddPageVector; | 349 typedef std::vector<history::HistoryAddPageArgs> AddPageVector; |
350 | 350 |
351 // Caches pages to be added to the history. | 351 // Caches pages to be added to the history. |
352 AddPageVector add_page_vector_; | 352 AddPageVector add_page_vector_; |
353 | 353 |
354 // Resources that are throttled, pending a prerender use. Can only access a | 354 // Resources that are throttled, pending a prerender use. Can only access a |
355 // throttle on the IO thread. | 355 // throttle on the IO thread. |
356 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_; | 356 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_; |
357 | 357 |
358 // A running tally of the number of bytes this prerender has caused to be | 358 // A running tally of the number of bytes this prerender has caused to be |
359 // transferred over the network for resources. Updated with AddNetworkBytes. | 359 // transferred over the network for resources. Updated with AddNetworkBytes. |
360 int64_t network_bytes_; | 360 int64_t network_bytes_; |
361 | 361 |
362 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 362 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
363 }; | 363 }; |
364 | 364 |
365 } // namespace prerender | 365 } // namespace prerender |
366 | 366 |
367 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 367 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
OLD | NEW |