OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 18 matching lines...) Expand all Loading... |
29 // This class is a peer of TabContents. It can host a renderer, but does not | 29 // This class is a peer of TabContents. It can host a renderer, but does not |
30 // have any visible display. Its navigation is not managed by a | 30 // have any visible display. Its navigation is not managed by a |
31 // NavigationController because is has no facility for navigating (other than | 31 // NavigationController because is has no facility for navigating (other than |
32 // programatically view window.location.href) or RenderViewHostManager because | 32 // programatically view window.location.href) or RenderViewHostManager because |
33 // it is never allowed to navigate across a SiteInstance boundary. | 33 // it is never allowed to navigate across a SiteInstance boundary. |
34 class PrerenderContents : public RenderViewHostDelegate, | 34 class PrerenderContents : public RenderViewHostDelegate, |
35 public RenderViewHostDelegate::View, | 35 public RenderViewHostDelegate::View, |
36 public NotificationObserver, | 36 public NotificationObserver, |
37 public JavaScriptAppModalDialogDelegate { | 37 public JavaScriptAppModalDialogDelegate { |
38 public: | 38 public: |
| 39 // PrerenderContents::Create uses the currently registered Factory to create |
| 40 // the PrerenderContents. Factory is intended for testing. |
| 41 class Factory { |
| 42 public: |
| 43 virtual PrerenderContents* CreatePrerenderContents( |
| 44 PrerenderManager* prerender_manager, Profile* profile, const GURL& url, |
| 45 const std::vector<GURL>& alias_urls) = 0; |
| 46 virtual ~Factory() {} |
| 47 }; |
| 48 |
39 PrerenderContents(PrerenderManager* prerender_manager, Profile* profile, | 49 PrerenderContents(PrerenderManager* prerender_manager, Profile* profile, |
40 const GURL& url, const std::vector<GURL>& alias_urls); | 50 const GURL& url, const std::vector<GURL>& alias_urls); |
41 virtual ~PrerenderContents(); | 51 virtual ~PrerenderContents(); |
42 virtual void StartPrerendering(); | 52 virtual void StartPrerendering(); |
43 | 53 |
44 RenderViewHost* render_view_host() { return render_view_host_; } | 54 RenderViewHost* render_view_host() { return render_view_host_; } |
45 // Allows replacing of the RenderViewHost owned by this class, including | 55 // Allows replacing of the RenderViewHost owned by this class, including |
46 // replacing with a NULL value. When a caller uses this, the caller will | 56 // replacing with a NULL value. When a caller uses this, the caller will |
47 // own (and is responsible for freeing) the old RVH. | 57 // own (and is responsible for freeing) the old RVH. |
48 void set_render_view_host(RenderViewHost* rvh) { render_view_host_ = rvh; } | 58 void set_render_view_host(RenderViewHost* rvh) { render_view_host_ = rvh; } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 192 |
183 // A vector of URLs that this prerendered page matches against. | 193 // A vector of URLs that this prerendered page matches against. |
184 // This array can contain more than element as a result of redirects, | 194 // This array can contain more than element as a result of redirects, |
185 // such as HTTP redirects or javascript redirects. | 195 // such as HTTP redirects or javascript redirects. |
186 std::vector<GURL> alias_urls_; | 196 std::vector<GURL> alias_urls_; |
187 | 197 |
188 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 198 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
189 }; | 199 }; |
190 | 200 |
191 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 201 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
OLD | NEW |