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

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

Issue 7374008: Move download stuff from download helper back to TabContents. This is basically a revert of r8576... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 5 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 #include "chrome/browser/prerender/prerender_contents.h" 5 #include "chrome/browser/prerender/prerender_contents.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 510 }
511 set_final_status(final_status); 511 set_final_status(final_status);
512 512
513 // We may destroy the PrerenderContents before we have initialized the 513 // We may destroy the PrerenderContents before we have initialized the
514 // RenderViewHost. Otherwise set the Observer's PrerenderContents to NULL to 514 // RenderViewHost. Otherwise set the Observer's PrerenderContents to NULL to
515 // avoid any more messages being sent. 515 // avoid any more messages being sent.
516 if (render_view_host_observer_.get()) 516 if (render_view_host_observer_.get())
517 render_view_host_observer_->set_prerender_contents(NULL); 517 render_view_host_observer_->set_prerender_contents(NULL);
518 } 518 }
519 519
520 bool PrerenderContents::CanDownload(int request_id) {
521 Destroy(FINAL_STATUS_DOWNLOAD);
522 // Cancel the download.
523 return false;
524 }
525
526 void PrerenderContents::OnStartDownload(DownloadItem* download,
527 TabContentsWrapper* tab) {
528 // Prerendered pages should never be able to download files.
529 NOTREACHED();
530 }
531
532 base::ProcessMetrics* PrerenderContents::MaybeGetProcessMetrics() { 520 base::ProcessMetrics* PrerenderContents::MaybeGetProcessMetrics() {
533 if (process_metrics_.get() == NULL) { 521 if (process_metrics_.get() == NULL) {
534 // If a PrenderContents hasn't started prerending, don't be fully formed. 522 // If a PrenderContents hasn't started prerending, don't be fully formed.
535 if (!render_view_host() || !render_view_host()->process()) 523 if (!render_view_host() || !render_view_host()->process())
536 return NULL; 524 return NULL;
537 base::ProcessHandle handle = render_view_host()->process()->GetHandle(); 525 base::ProcessHandle handle = render_view_host()->process()->GetHandle();
538 if (handle == base::kNullProcessHandle) 526 if (handle == base::kNullProcessHandle)
539 return NULL; 527 return NULL;
540 #if !defined(OS_MACOSX) 528 #if !defined(OS_MACOSX)
541 process_metrics_.reset(base::ProcessMetrics::CreateProcessMetrics(handle)); 529 process_metrics_.reset(base::ProcessMetrics::CreateProcessMetrics(handle));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 return NULL; 583 return NULL;
596 DictionaryValue* dict_value = new DictionaryValue(); 584 DictionaryValue* dict_value = new DictionaryValue();
597 dict_value->SetString("url", prerender_url_.spec()); 585 dict_value->SetString("url", prerender_url_.spec());
598 base::TimeTicks current_time = base::TimeTicks::Now(); 586 base::TimeTicks current_time = base::TimeTicks::Now();
599 base::TimeDelta duration = current_time - load_start_time_; 587 base::TimeDelta duration = current_time - load_start_time_;
600 dict_value->SetInteger("duration", duration.InSeconds()); 588 dict_value->SetInteger("duration", duration.InSeconds());
601 return dict_value; 589 return dict_value;
602 } 590 }
603 591
604 } // namespace prerender 592 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698