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> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/browser/prerender/prerender_final_status.h" | 16 #include "chrome/browser/prerender/prerender_final_status.h" |
17 #include "chrome/browser/prerender/prerender_origin.h" | 17 #include "chrome/browser/prerender/prerender_origin.h" |
18 #include "content/public/browser/favicon_download_delegate.h" | |
18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
20 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
21 #include "content/public/common/referrer.h" | 22 #include "content/public/common/referrer.h" |
22 #include "ui/gfx/size.h" | 23 #include "ui/gfx/size.h" |
23 | 24 |
24 class Profile; | 25 class Profile; |
25 class TabContents; | 26 class TabContents; |
26 struct FaviconURL; | 27 |
27 | 28 |
28 namespace base { | 29 namespace base { |
29 class ProcessMetrics; | 30 class ProcessMetrics; |
30 } | 31 } |
31 | 32 |
32 namespace content { | 33 namespace content { |
34 struct FaviconURL; | |
33 class RenderViewHost; | 35 class RenderViewHost; |
34 class SessionStorageNamespace; | 36 class SessionStorageNamespace; |
35 class WebContents; | 37 class WebContents; |
36 } | 38 } |
37 | 39 |
38 namespace history { | 40 namespace history { |
39 struct HistoryAddPageArgs; | 41 struct HistoryAddPageArgs; |
40 } | 42 } |
41 | 43 |
42 namespace prerender { | 44 namespace prerender { |
43 | 45 |
44 class PrerenderHandle; | 46 class PrerenderHandle; |
45 class PrerenderManager; | 47 class PrerenderManager; |
46 class PrerenderRenderViewHostObserver; | 48 class PrerenderRenderViewHostObserver; |
47 class PrerenderTracker; | 49 class PrerenderTracker; |
48 | 50 |
49 class PrerenderContents : public content::NotificationObserver, | 51 class PrerenderContents : public content::NotificationObserver, |
50 public content::WebContentsObserver { | 52 public content::WebContentsObserver, |
53 public content::FaviconDownloadDelegate { | |
51 public: | 54 public: |
52 // PrerenderContents::Create uses the currently registered Factory to create | 55 // PrerenderContents::Create uses the currently registered Factory to create |
53 // the PrerenderContents. Factory is intended for testing. | 56 // the PrerenderContents. Factory is intended for testing. |
54 class Factory { | 57 class Factory { |
55 public: | 58 public: |
56 Factory() {} | 59 Factory() {} |
57 virtual ~Factory() {} | 60 virtual ~Factory() {} |
58 | 61 |
59 // Ownership is not transfered through this interface as prerender_manager, | 62 // Ownership is not transfered through this interface as prerender_manager, |
60 // prerender_tracker, and profile are stored as weak pointers. | 63 // prerender_tracker, and profile are stored as weak pointers. |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 base::TimeTicks load_start_time_; | 300 base::TimeTicks load_start_time_; |
298 | 301 |
299 private: | 302 private: |
300 class TabContentsDelegateImpl; | 303 class TabContentsDelegateImpl; |
301 | 304 |
302 // Needs to be able to call the constructor. | 305 // Needs to be able to call the constructor. |
303 friend class PrerenderContentsFactoryImpl; | 306 friend class PrerenderContentsFactoryImpl; |
304 | 307 |
305 friend class PrerenderRenderViewHostObserver; | 308 friend class PrerenderRenderViewHostObserver; |
306 | 309 |
307 // Message handlers. | 310 // Update |icon_url_| when a favicon url of page is updated. |
308 void OnUpdateFaviconURL(int32 page_id, const std::vector<FaviconURL>& urls); | 311 void UpdateFaviconURL(int32 page_id, |
312 const std::vector<content::FaviconURL>& urls); | |
309 | 313 |
310 // Returns the RenderViewHost Delegate for this prerender. | 314 // Returns the RenderViewHost Delegate for this prerender. |
311 content::WebContents* GetWebContents(); | 315 content::WebContents* GetWebContents(); |
312 | 316 |
313 // Returns the ProcessMetrics for the render process, if it exists. | 317 // Returns the ProcessMetrics for the render process, if it exists. |
314 base::ProcessMetrics* MaybeGetProcessMetrics(); | 318 base::ProcessMetrics* MaybeGetProcessMetrics(); |
315 | 319 |
316 // The prerender manager owning this object. | 320 // The prerender manager owning this object. |
317 PrerenderManager* prerender_manager_; | 321 PrerenderManager* prerender_manager_; |
318 | 322 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
371 // RenderViewHost for this object. | 375 // RenderViewHost for this object. |
372 scoped_ptr<base::ProcessMetrics> process_metrics_; | 376 scoped_ptr<base::ProcessMetrics> process_metrics_; |
373 | 377 |
374 // The prerendered TabContents; may be null. | 378 // The prerendered TabContents; may be null. |
375 scoped_ptr<TabContents> prerender_contents_; | 379 scoped_ptr<TabContents> prerender_contents_; |
376 | 380 |
377 scoped_ptr<PrerenderRenderViewHostObserver> render_view_host_observer_; | 381 scoped_ptr<PrerenderRenderViewHostObserver> render_view_host_observer_; |
378 | 382 |
379 scoped_ptr<TabContentsDelegateImpl> tab_contents_delegate_; | 383 scoped_ptr<TabContentsDelegateImpl> tab_contents_delegate_; |
380 | 384 |
385 | |
jam
2012/11/27 01:16:31
nit: undo
Cait (Slow)
2012/11/28 00:11:45
Done.
| |
381 // These are -1 before a RenderView is created. | 386 // These are -1 before a RenderView is created. |
382 int child_id_; | 387 int child_id_; |
383 int route_id_; | 388 int route_id_; |
384 | 389 |
385 // Origin for this prerender. | 390 // Origin for this prerender. |
386 Origin origin_; | 391 Origin origin_; |
387 | 392 |
388 // Experiment during which this prerender is performed. | 393 // Experiment during which this prerender is performed. |
389 uint8 experiment_id_; | 394 uint8 experiment_id_; |
390 | 395 |
(...skipping 10 matching lines...) Expand all Loading... | |
401 | 406 |
402 // Caches pages to be added to the history. | 407 // Caches pages to be added to the history. |
403 AddPageVector add_page_vector_; | 408 AddPageVector add_page_vector_; |
404 | 409 |
405 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 410 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
406 }; | 411 }; |
407 | 412 |
408 } // namespace prerender | 413 } // namespace prerender |
409 | 414 |
410 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 415 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
OLD | NEW |