Chromium Code Reviews| Index: chrome/browser/prerender/prerender_contents.cc |
| =================================================================== |
| --- chrome/browser/prerender/prerender_contents.cc (revision 74194) |
| +++ chrome/browser/prerender/prerender_contents.cc (working copy) |
| @@ -11,6 +11,7 @@ |
| #include "chrome/browser/prerender/prerender_manager.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/renderer_host/render_view_host.h" |
| +#include "chrome/browser/renderer_host/resource_request_details.h" |
| #include "chrome/browser/renderer_host/site_instance.h" |
| #include "chrome/browser/renderer_preferences_util.h" |
| #include "chrome/browser/ui/login/login_prompt.h" |
| @@ -82,6 +83,10 @@ |
| registrar_.Add(this, NotificationType::AUTH_CANCELLED, |
| NotificationService::AllSources()); |
| + // Register all responses to see if we should cancel. |
| + registrar_.Add(this, NotificationType::DOWNLOAD_STARTED, |
|
cbentzel
2011/02/09 12:19:15
Instead of registering with AllSources, you could
dominich
2011/02/09 22:33:30
Done.
|
| + NotificationService::AllSources()); |
| + |
| DCHECK(load_start_time_.is_null()); |
| load_start_time_ = base::TimeTicks::Now(); |
| @@ -206,6 +211,18 @@ |
| break; |
| } |
| + case NotificationType::DOWNLOAD_STARTED: { |
| + // If the download is started from a RenderViewHost that we are |
| + // delegating, kill the prerender. This will also stop the download and |
| + // navigating to the page will restart it as expected. |
| + RenderViewHostDelegate* rvhd = |
| + Source<RenderViewHostDelegate>(source).ptr(); |
| + if (rvhd == this) { |
| + Destroy(FINAL_STATUS_DOWNLOAD); |
|
cbentzel
2011/02/09 12:11:14
Nit: I'd like an explicit return here, since Destr
dominich
2011/02/09 22:33:30
I'll add the same to the AUTH_* cases above.
dominich
2011/02/09 22:33:30
Done.
|
| + } |
| + break; |
| + } |
| + |
| default: |
| NOTREACHED() << "Unexpected notification sent."; |
| break; |