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

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

Issue 7004039: Cancel downloads earlier when prerendering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove outdated comment 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>
11 11
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "chrome/browser/prerender/prerender_final_status.h" 14 #include "chrome/browser/prerender/prerender_final_status.h"
15 #include "chrome/browser/prerender/prerender_render_view_host_observer.h" 15 #include "chrome/browser/prerender/prerender_render_view_host_observer.h"
16 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" 16 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
17 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" 17 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h"
18 #include "chrome/browser/ui/download/download_tab_helper_delegate.h"
18 #include "content/browser/renderer_host/render_view_host_delegate.h" 19 #include "content/browser/renderer_host/render_view_host_delegate.h"
19 #include "content/browser/tab_contents/tab_contents_observer.h" 20 #include "content/browser/tab_contents/tab_contents_observer.h"
20 #include "content/common/notification_registrar.h" 21 #include "content/common/notification_registrar.h"
21 #include "content/common/window_container_type.h" 22 #include "content/common/window_container_type.h"
22 #include "webkit/glue/window_open_disposition.h" 23 #include "webkit/glue/window_open_disposition.h"
23 24
24 class RenderViewHost; 25 class RenderViewHost;
25 class TabContents; 26 class TabContents;
26 class TabContentsWrapper; 27 class TabContentsWrapper;
27 struct FaviconURL; 28 struct FaviconURL;
(...skipping 16 matching lines...) Expand all
44 // have any visible display. Its navigation is not managed by a 45 // have any visible display. Its navigation is not managed by a
45 // NavigationController because is has no facility for navigating (other than 46 // NavigationController because is has no facility for navigating (other than
46 // programatically view window.location.href) or RenderViewHostManager because 47 // programatically view window.location.href) or RenderViewHostManager because
47 // it is never allowed to navigate across a SiteInstance boundary. 48 // it is never allowed to navigate across a SiteInstance boundary.
48 // TODO(dominich): Remove RenderViewHostDelegate inheritance when UseTabContents 49 // TODO(dominich): Remove RenderViewHostDelegate inheritance when UseTabContents
49 // returns true by default. 50 // returns true by default.
50 class PrerenderContents : public RenderViewHostDelegate, 51 class PrerenderContents : public RenderViewHostDelegate,
51 public RenderViewHostDelegate::View, 52 public RenderViewHostDelegate::View,
52 public NotificationObserver, 53 public NotificationObserver,
53 public TabContentsObserver, 54 public TabContentsObserver,
54 public JavaScriptAppModalDialogDelegate { 55 public JavaScriptAppModalDialogDelegate,
56 public DownloadTabHelperDelegate {
55 public: 57 public:
56 // PrerenderContents::Create uses the currently registered Factory to create 58 // PrerenderContents::Create uses the currently registered Factory to create
57 // the PrerenderContents. Factory is intended for testing. 59 // the PrerenderContents. Factory is intended for testing.
58 class Factory { 60 class Factory {
59 public: 61 public:
60 Factory() {} 62 Factory() {}
61 virtual ~Factory() {} 63 virtual ~Factory() {}
62 64
63 virtual PrerenderContents* CreatePrerenderContents( 65 virtual PrerenderContents* CreatePrerenderContents(
64 PrerenderManager* prerender_manager, 66 PrerenderManager* prerender_manager,
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 virtual TabContents* AsTabContents() OVERRIDE; 213 virtual TabContents* AsTabContents() OVERRIDE;
212 virtual ExtensionHost* AsExtensionHost() OVERRIDE; 214 virtual ExtensionHost* AsExtensionHost() OVERRIDE;
213 215
214 virtual void UpdateInspectorSetting(const std::string& key, 216 virtual void UpdateInspectorSetting(const std::string& key,
215 const std::string& value) OVERRIDE; 217 const std::string& value) OVERRIDE;
216 virtual void ClearInspectorSettings() OVERRIDE; 218 virtual void ClearInspectorSettings() OVERRIDE;
217 219
218 virtual void RendererUnresponsive(RenderViewHost* render_view_host, 220 virtual void RendererUnresponsive(RenderViewHost* render_view_host,
219 bool is_during_unload) OVERRIDE; 221 bool is_during_unload) OVERRIDE;
220 222
223 // DownloadTabHelperDelegate implementation.
224 virtual bool CanDownload(int request_id) OVERRIDE;
225 virtual void OnStartDownload(DownloadItem* download,
226 TabContentsWrapper* tab) OVERRIDE;
227
221 // Adds an alias URL, for one of the many redirections. If the URL can not 228 // Adds an alias URL, for one of the many redirections. If the URL can not
222 // be prerendered - for example, it's an ftp URL - |this| will be destroyed 229 // be prerendered - for example, it's an ftp URL - |this| will be destroyed
223 // and false is returned. Otherwise, true is returned and the alias is 230 // and false is returned. Otherwise, true is returned and the alias is
224 // remembered. 231 // remembered.
225 bool AddAliasURL(const GURL& url); 232 bool AddAliasURL(const GURL& url);
226 233
227 // The preview TabContents (may be null). 234 // The preview TabContents (may be null).
228 TabContentsWrapper* prerender_contents() const { 235 TabContentsWrapper* prerender_contents() const {
229 return prerender_contents_.get(); 236 return prerender_contents_.get();
230 } 237 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 // These are -1 before a RenderView is created. 355 // These are -1 before a RenderView is created.
349 int child_id_; 356 int child_id_;
350 int route_id_; 357 int route_id_;
351 358
352 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); 359 DISALLOW_COPY_AND_ASSIGN(PrerenderContents);
353 }; 360 };
354 361
355 } // namespace prerender 362 } // namespace prerender
356 363
357 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ 364 #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