| OLD | NEW |
| 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/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/prerender/prerender_final_status.h" | 15 #include "chrome/browser/prerender/prerender_final_status.h" |
| 16 #include "chrome/browser/ui/download/download_tab_helper_delegate.h" | |
| 17 #include "content/browser/tab_contents/tab_contents_observer.h" | 16 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 18 #include "content/browser/renderer_host/render_view_host_delegate.h" | 17 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 19 #include "content/common/notification_registrar.h" | 18 #include "content/common/notification_registrar.h" |
| 20 | 19 |
| 21 class RenderViewHost; | 20 class RenderViewHost; |
| 22 class TabContents; | 21 class TabContents; |
| 23 class TabContentsWrapper; | 22 class TabContentsWrapper; |
| 24 struct FaviconURL; | 23 struct FaviconURL; |
| 25 struct ViewHostMsg_FrameNavigate_Params; | 24 struct ViewHostMsg_FrameNavigate_Params; |
| 26 | 25 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 37 class PrerenderManager; | 36 class PrerenderManager; |
| 38 class PrerenderRenderViewHostObserver; | 37 class PrerenderRenderViewHostObserver; |
| 39 class PrerenderTracker; | 38 class PrerenderTracker; |
| 40 | 39 |
| 41 // This class is a peer of TabContents. It can host a renderer, but does not | 40 // This class is a peer of TabContents. It can host a renderer, but does not |
| 42 // have any visible display. Its navigation is not managed by a | 41 // have any visible display. Its navigation is not managed by a |
| 43 // NavigationController because is has no facility for navigating (other than | 42 // NavigationController because is has no facility for navigating (other than |
| 44 // programatically view window.location.href) or RenderViewHostManager because | 43 // programatically view window.location.href) or RenderViewHostManager because |
| 45 // it is never allowed to navigate across a SiteInstance boundary. | 44 // it is never allowed to navigate across a SiteInstance boundary. |
| 46 class PrerenderContents : public NotificationObserver, | 45 class PrerenderContents : public NotificationObserver, |
| 47 public TabContentsObserver, | 46 public TabContentsObserver { |
| 48 public DownloadTabHelperDelegate { | |
| 49 public: | 47 public: |
| 50 // PrerenderContents::Create uses the currently registered Factory to create | 48 // PrerenderContents::Create uses the currently registered Factory to create |
| 51 // the PrerenderContents. Factory is intended for testing. | 49 // the PrerenderContents. Factory is intended for testing. |
| 52 class Factory { | 50 class Factory { |
| 53 public: | 51 public: |
| 54 Factory() {} | 52 Factory() {} |
| 55 virtual ~Factory() {} | 53 virtual ~Factory() {} |
| 56 | 54 |
| 57 // Ownership is not transfered through this interface as prerender_manager, | 55 // Ownership is not transfered through this interface as prerender_manager, |
| 58 // prerender_tracker, and profile are stored as weak pointers. | 56 // prerender_tracker, and profile are stored as weak pointers. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 virtual void OnRenderViewGone(int status, int exit_code); | 128 virtual void OnRenderViewGone(int status, int exit_code); |
| 131 | 129 |
| 132 // TabContentsObserver implementation. | 130 // TabContentsObserver implementation. |
| 133 virtual void DidStopLoading() OVERRIDE; | 131 virtual void DidStopLoading() OVERRIDE; |
| 134 | 132 |
| 135 // NotificationObserver | 133 // NotificationObserver |
| 136 virtual void Observe(int type, | 134 virtual void Observe(int type, |
| 137 const NotificationSource& source, | 135 const NotificationSource& source, |
| 138 const NotificationDetails& details) OVERRIDE; | 136 const NotificationDetails& details) OVERRIDE; |
| 139 | 137 |
| 140 // DownloadTabHelperDelegate implementation. | |
| 141 virtual bool CanDownload(int request_id) OVERRIDE; | |
| 142 virtual void OnStartDownload(DownloadItem* download, | |
| 143 TabContentsWrapper* tab) OVERRIDE; | |
| 144 | |
| 145 // Adds an alias URL, for one of the many redirections. If the URL can not | 138 // Adds an alias URL, for one of the many redirections. If the URL can not |
| 146 // be prerendered - for example, it's an ftp URL - |this| will be destroyed | 139 // be prerendered - for example, it's an ftp URL - |this| will be destroyed |
| 147 // and false is returned. Otherwise, true is returned and the alias is | 140 // and false is returned. Otherwise, true is returned and the alias is |
| 148 // remembered. | 141 // remembered. |
| 149 virtual bool AddAliasURL(const GURL& url); | 142 virtual bool AddAliasURL(const GURL& url); |
| 150 | 143 |
| 151 // The preview TabContents (may be null). | 144 // The preview TabContents (may be null). |
| 152 TabContentsWrapper* prerender_contents() const { | 145 TabContentsWrapper* prerender_contents() const { |
| 153 return prerender_contents_.get(); | 146 return prerender_contents_.get(); |
| 154 } | 147 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 275 |
| 283 // Offset by which to offset prerendered pages | 276 // Offset by which to offset prerendered pages |
| 284 static const int32 kPrerenderPageIdOffset = 10; | 277 static const int32 kPrerenderPageIdOffset = 10; |
| 285 | 278 |
| 286 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 279 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
| 287 }; | 280 }; |
| 288 | 281 |
| 289 } // namespace prerender | 282 } // namespace prerender |
| 290 | 283 |
| 291 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 284 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| OLD | NEW |