Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(674)

Side by Side Diff: chrome/browser/prerender/prerender_contents.h

Issue 6966017: Remove a chrome dependency by removing Prerender from ResourceDispatcherHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 22 matching lines...) Expand all
33 class ProcessMetrics; 33 class ProcessMetrics;
34 } 34 }
35 35
36 namespace gfx { 36 namespace gfx {
37 class Rect; 37 class Rect;
38 } 38 }
39 39
40 namespace prerender { 40 namespace prerender {
41 41
42 class PrerenderManager; 42 class PrerenderManager;
43 class PrerenderTracker;
43 44
44 // This class is a peer of TabContents. It can host a renderer, but does not 45 // This class is a peer of TabContents. It can host a renderer, but does not
45 // have any visible display. Its navigation is not managed by a 46 // have any visible display. Its navigation is not managed by a
46 // NavigationController because is has no facility for navigating (other than 47 // NavigationController because is has no facility for navigating (other than
47 // programatically view window.location.href) or RenderViewHostManager because 48 // programatically view window.location.href) or RenderViewHostManager because
48 // it is never allowed to navigate across a SiteInstance boundary. 49 // it is never allowed to navigate across a SiteInstance boundary.
49 // TODO(dominich): Remove RenderViewHostDelegate inheritance when UseTabContents 50 // TODO(dominich): Remove RenderViewHostDelegate inheritance when UseTabContents
50 // returns true by default. 51 // returns true by default.
51 class PrerenderContents : public RenderViewHostDelegate, 52 class PrerenderContents : public RenderViewHostDelegate,
52 public RenderViewHostDelegate::View, 53 public RenderViewHostDelegate::View,
53 public NotificationObserver, 54 public NotificationObserver,
54 public TabContentsObserver, 55 public TabContentsObserver,
55 public JavaScriptAppModalDialogDelegate, 56 public JavaScriptAppModalDialogDelegate,
56 public DownloadTabHelperDelegate { 57 public DownloadTabHelperDelegate {
57 public: 58 public:
58 // PrerenderContents::Create uses the currently registered Factory to create 59 // PrerenderContents::Create uses the currently registered Factory to create
59 // the PrerenderContents. Factory is intended for testing. 60 // the PrerenderContents. Factory is intended for testing.
60 class Factory { 61 class Factory {
61 public: 62 public:
62 Factory() {} 63 Factory() {}
63 virtual ~Factory() {} 64 virtual ~Factory() {}
64 65
66 // Ownership is not transfered through this interface as prerender_manager,
67 // prerender_tracker, and profile are stored as weak pointers.
65 virtual PrerenderContents* CreatePrerenderContents( 68 virtual PrerenderContents* CreatePrerenderContents(
66 PrerenderManager* prerender_manager, 69 PrerenderManager* prerender_manager,
70 PrerenderTracker* prerender_tracker,
67 Profile* profile, 71 Profile* profile,
68 const GURL& url, 72 const GURL& url,
69 const GURL& referrer) = 0; 73 const GURL& referrer) = 0;
70 74
71 private: 75 private:
72 DISALLOW_COPY_AND_ASSIGN(Factory); 76 DISALLOW_COPY_AND_ASSIGN(Factory);
73 }; 77 };
74 78
75 virtual ~PrerenderContents(); 79 virtual ~PrerenderContents();
76 80
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 255 }
252 256
253 // Applies all the URL history encountered during prerendering to the 257 // Applies all the URL history encountered during prerendering to the
254 // new tab. 258 // new tab.
255 void CommitHistory(TabContentsWrapper* tab); 259 void CommitHistory(TabContentsWrapper* tab);
256 260
257 int32 starting_page_id() { return starting_page_id_; } 261 int32 starting_page_id() { return starting_page_id_; }
258 262
259 protected: 263 protected:
260 PrerenderContents(PrerenderManager* prerender_manager, 264 PrerenderContents(PrerenderManager* prerender_manager,
265 PrerenderTracker* prerender_tracker,
261 Profile* profile, 266 Profile* profile,
262 const GURL& url, 267 const GURL& url,
263 const GURL& referrer); 268 const GURL& referrer);
264 269
265 const GURL& prerender_url() const { return prerender_url_; } 270 const GURL& prerender_url() const { return prerender_url_; }
266 271
267 NotificationRegistrar& notification_registrar() { 272 NotificationRegistrar& notification_registrar() {
268 return notification_registrar_; 273 return notification_registrar_;
269 } 274 }
270 275
(...skipping 18 matching lines...) Expand all
289 294
290 // Returns the RenderViewHost Delegate for this prerender. 295 // Returns the RenderViewHost Delegate for this prerender.
291 RenderViewHostDelegate* GetRenderViewHostDelegate(); 296 RenderViewHostDelegate* GetRenderViewHostDelegate();
292 297
293 // Returns the ProcessMetrics for the render process, if it exists. 298 // Returns the ProcessMetrics for the render process, if it exists.
294 base::ProcessMetrics* MaybeGetProcessMetrics(); 299 base::ProcessMetrics* MaybeGetProcessMetrics();
295 300
296 // The prerender manager owning this object. 301 // The prerender manager owning this object.
297 PrerenderManager* prerender_manager_; 302 PrerenderManager* prerender_manager_;
298 303
304 // The prerender tracker tracking prerenders.
305 PrerenderTracker* prerender_tracker_;
306
299 // The host for our HTML content. 307 // The host for our HTML content.
300 RenderViewHost* render_view_host_; 308 RenderViewHost* render_view_host_;
301 309
302 // Common implementations of some RenderViewHostDelegate::View methods. 310 // Common implementations of some RenderViewHostDelegate::View methods.
303 RenderViewHostDelegateViewHelper delegate_view_helper_; 311 RenderViewHostDelegateViewHelper delegate_view_helper_;
304 312
305 // The URL being prerendered. 313 // The URL being prerendered.
306 GURL prerender_url_; 314 GURL prerender_url_;
307 315
308 // The referrer. 316 // The referrer.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 376
369 // Offset by which to offset prerendered pages 377 // Offset by which to offset prerendered pages
370 static const int32 kPrerenderPageIdOffset = 10; 378 static const int32 kPrerenderPageIdOffset = 10;
371 379
372 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); 380 DISALLOW_COPY_AND_ASSIGN(PrerenderContents);
373 }; 381 };
374 382
375 } // namespace prerender 383 } // namespace prerender
376 384
377 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ 385 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | chrome/browser/prerender/prerender_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698