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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 22 matching lines...) Expand all Loading... |
33 class SessionStorageNamespace; | 33 class SessionStorageNamespace; |
34 class WebContents; | 34 class WebContents; |
35 } | 35 } |
36 | 36 |
37 namespace prerender { | 37 namespace prerender { |
38 | 38 |
39 class PrerenderManager; | 39 class PrerenderManager; |
40 class PrerenderRenderViewHostObserver; | 40 class PrerenderRenderViewHostObserver; |
41 class PrerenderTracker; | 41 class PrerenderTracker; |
42 | 42 |
43 // This class is a peer of TabContents. It can host a renderer, but does not | |
44 // have any visible display. Its navigation is not managed by a | |
45 // NavigationController because is has no facility for navigating (other than | |
46 // programatically view window.location.href) or RenderViewHostManager because | |
47 // it is never allowed to navigate across a SiteInstance boundary. | |
48 class PrerenderContents : public content::NotificationObserver, | 43 class PrerenderContents : public content::NotificationObserver, |
49 public content::WebContentsObserver { | 44 public content::WebContentsObserver { |
50 public: | 45 public: |
51 // PrerenderContents::Create uses the currently registered Factory to create | 46 // PrerenderContents::Create uses the currently registered Factory to create |
52 // the PrerenderContents. Factory is intended for testing. | 47 // the PrerenderContents. Factory is intended for testing. |
53 class Factory { | 48 class Factory { |
54 public: | 49 public: |
55 Factory() {} | 50 Factory() {} |
56 virtual ~Factory() {} | 51 virtual ~Factory() {} |
57 | 52 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 175 |
181 // Adds an alias URL, for one of the many redirections. If the URL can not | 176 // Adds an alias URL, for one of the many redirections. If the URL can not |
182 // be prerendered - for example, it's an ftp URL - |this| will be destroyed | 177 // be prerendered - for example, it's an ftp URL - |this| will be destroyed |
183 // and false is returned. Otherwise, true is returned and the alias is | 178 // and false is returned. Otherwise, true is returned and the alias is |
184 // remembered. | 179 // remembered. |
185 virtual bool AddAliasURL(const GURL& url); | 180 virtual bool AddAliasURL(const GURL& url); |
186 | 181 |
187 // Adds all alias URLs from another prerender. | 182 // Adds all alias URLs from another prerender. |
188 void AddAliasURLsFromOtherPrerenderContents(PrerenderContents* other_pc); | 183 void AddAliasURLsFromOtherPrerenderContents(PrerenderContents* other_pc); |
189 | 184 |
190 // The preview TabContents (may be null). | 185 // The preview TabContentsWrapper (may be null). |
191 TabContentsWrapper* prerender_contents() const { | 186 TabContentsWrapper* prerender_contents() const { |
192 return prerender_contents_.get(); | 187 return prerender_contents_.get(); |
193 } | 188 } |
194 | 189 |
195 TabContentsWrapper* ReleasePrerenderContents(); | 190 TabContentsWrapper* ReleasePrerenderContents(); |
196 | 191 |
197 // Sets the final status, calls OnDestroy and adds |this| to the | 192 // Sets the final status, calls OnDestroy and adds |this| to the |
198 // PrerenderManager's pending deletes list. | 193 // PrerenderManager's pending deletes list. |
199 void Destroy(FinalStatus reason); | 194 void Destroy(FinalStatus reason); |
200 | 195 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // The referrer. | 270 // The referrer. |
276 content::Referrer referrer_; | 271 content::Referrer referrer_; |
277 | 272 |
278 // The profile being used | 273 // The profile being used |
279 Profile* profile_; | 274 Profile* profile_; |
280 | 275 |
281 // Information about the title and URL of the page that this class as a | 276 // Information about the title and URL of the page that this class as a |
282 // RenderViewHostDelegate has received from the RenderView. | 277 // RenderViewHostDelegate has received from the RenderView. |
283 // Used to apply to the new RenderViewHost delegate that might eventually | 278 // Used to apply to the new RenderViewHost delegate that might eventually |
284 // own the contained RenderViewHost when the prerendered page is shown | 279 // own the contained RenderViewHost when the prerendered page is shown |
285 // in a TabContents. | 280 // in a WebContents. |
286 string16 title_; | 281 string16 title_; |
287 int32 page_id_; | 282 int32 page_id_; |
288 GURL url_; | 283 GURL url_; |
289 GURL icon_url_; | 284 GURL icon_url_; |
290 content::NotificationRegistrar notification_registrar_; | 285 content::NotificationRegistrar notification_registrar_; |
291 | 286 |
292 // A vector of URLs that this prerendered page matches against. | 287 // A vector of URLs that this prerendered page matches against. |
293 // This array can contain more than element as a result of redirects, | 288 // This array can contain more than element as a result of redirects, |
294 // such as HTTP redirects or javascript redirects. | 289 // such as HTTP redirects or javascript redirects. |
295 std::vector<GURL> alias_urls_; | 290 std::vector<GURL> alias_urls_; |
(...skipping 20 matching lines...) Expand all Loading... |
316 | 311 |
317 // Time at which we started to load the URL. This is used to compute | 312 // Time at which we started to load the URL. This is used to compute |
318 // the time elapsed from initiating a prerender until the time the | 313 // the time elapsed from initiating a prerender until the time the |
319 // (potentially only partially) prerendered page is shown to the user. | 314 // (potentially only partially) prerendered page is shown to the user. |
320 base::TimeTicks load_start_time_; | 315 base::TimeTicks load_start_time_; |
321 | 316 |
322 // Process Metrics of the render process associated with the | 317 // Process Metrics of the render process associated with the |
323 // RenderViewHost for this object. | 318 // RenderViewHost for this object. |
324 scoped_ptr<base::ProcessMetrics> process_metrics_; | 319 scoped_ptr<base::ProcessMetrics> process_metrics_; |
325 | 320 |
326 // The prerendered TabContents; may be null. | 321 // The prerendered TabContentsWrapper; may be null. |
327 scoped_ptr<TabContentsWrapper> prerender_contents_; | 322 scoped_ptr<TabContentsWrapper> prerender_contents_; |
328 | 323 |
329 scoped_ptr<PrerenderRenderViewHostObserver> render_view_host_observer_; | 324 scoped_ptr<PrerenderRenderViewHostObserver> render_view_host_observer_; |
330 | 325 |
331 scoped_ptr<TabContentsDelegateImpl> tab_contents_delegate_; | 326 scoped_ptr<TabContentsDelegateImpl> tab_contents_delegate_; |
332 | 327 |
333 // These are -1 before a RenderView is created. | 328 // These are -1 before a RenderView is created. |
334 int child_id_; | 329 int child_id_; |
335 int route_id_; | 330 int route_id_; |
336 | 331 |
337 // Origin for this prerender. | 332 // Origin for this prerender. |
338 Origin origin_; | 333 Origin origin_; |
339 | 334 |
340 // Experiment during which this prerender is performed. | 335 // Experiment during which this prerender is performed. |
341 uint8 experiment_id_; | 336 uint8 experiment_id_; |
342 | 337 |
343 // List of all pages the prerendered page has tried to prerender. | 338 // List of all pages the prerendered page has tried to prerender. |
344 PendingPrerenderList pending_prerender_list_; | 339 PendingPrerenderList pending_prerender_list_; |
345 | 340 |
346 // The process that created the child id. | 341 // The process that created the child id. |
347 int creator_child_id_; | 342 int creator_child_id_; |
348 | 343 |
349 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 344 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
350 }; | 345 }; |
351 | 346 |
352 } // namespace prerender | 347 } // namespace prerender |
353 | 348 |
354 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 349 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
OLD | NEW |