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

Side by Side Diff: content/browser/download/download_manager.cc

Issue 8515027: Define the public version of the browser side RenderProcessHost interface. This interface is not ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 "content/browser/download/download_manager.h" 5 #include "content/browser/download/download_manager.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/i18n/case_conversion.h" 12 #include "base/i18n/case_conversion.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/stringprintf.h" 15 #include "base/stringprintf.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "base/sys_string_conversions.h" 17 #include "base/sys_string_conversions.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "content/browser/browser_context.h" 19 #include "content/browser/browser_context.h"
20 #include "content/browser/download/download_create_info.h" 20 #include "content/browser/download/download_create_info.h"
21 #include "content/browser/download/download_file_manager.h" 21 #include "content/browser/download/download_file_manager.h"
22 #include "content/browser/download/download_id_factory.h" 22 #include "content/browser/download/download_id_factory.h"
23 #include "content/browser/download/download_item.h" 23 #include "content/browser/download/download_item.h"
24 #include "content/browser/download/download_persistent_store_info.h" 24 #include "content/browser/download/download_persistent_store_info.h"
25 #include "content/browser/download/download_stats.h" 25 #include "content/browser/download/download_stats.h"
26 #include "content/browser/download/download_status_updater.h" 26 #include "content/browser/download/download_status_updater.h"
27 #include "content/browser/download/interrupt_reasons.h" 27 #include "content/browser/download/interrupt_reasons.h"
28 #include "content/browser/renderer_host/render_process_host.h" 28 #include "content/browser/renderer_host/render_process_host_impl.h"
29 #include "content/browser/renderer_host/render_view_host.h" 29 #include "content/browser/renderer_host/render_view_host.h"
30 #include "content/browser/renderer_host/resource_dispatcher_host.h" 30 #include "content/browser/renderer_host/resource_dispatcher_host.h"
31 #include "content/browser/tab_contents/tab_contents.h" 31 #include "content/browser/tab_contents/tab_contents.h"
32 #include "content/public/browser/browser_thread.h" 32 #include "content/public/browser/browser_thread.h"
33 #include "content/public/browser/content_browser_client.h" 33 #include "content/public/browser/content_browser_client.h"
34 #include "content/public/browser/download_manager_delegate.h" 34 #include "content/public/browser/download_manager_delegate.h"
35 #include "content/public/browser/notification_service.h" 35 #include "content/public/browser/notification_service.h"
36 #include "content/public/browser/notification_types.h" 36 #include "content/public/browser/notification_types.h"
37 37
38 using content::BrowserThread; 38 using content::BrowserThread;
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 DCHECK(tab_contents); 707 DCHECK(tab_contents);
708 ResourceDispatcherHost* resource_dispatcher_host = 708 ResourceDispatcherHost* resource_dispatcher_host =
709 content::GetContentClient()->browser()->GetResourceDispatcherHost(); 709 content::GetContentClient()->browser()->GetResourceDispatcherHost();
710 // We send a pointer to content::ResourceContext, instead of the usual 710 // We send a pointer to content::ResourceContext, instead of the usual
711 // reference, so that a copy of the object isn't made. 711 // reference, so that a copy of the object isn't made.
712 // base::Bind can't handle 7 args, so we use URLParams and RenderParams. 712 // base::Bind can't handle 7 args, so we use URLParams and RenderParams.
713 BrowserThread::PostTask( 713 BrowserThread::PostTask(
714 BrowserThread::IO, FROM_HERE, 714 BrowserThread::IO, FROM_HERE,
715 base::Bind(&BeginDownload, 715 base::Bind(&BeginDownload,
716 URLParams(url, referrer), save_info, resource_dispatcher_host, 716 URLParams(url, referrer), save_info, resource_dispatcher_host,
717 RenderParams(tab_contents->GetRenderProcessHost()->id(), 717 RenderParams(tab_contents->GetRenderProcessHost()->GetID(),
718 tab_contents->render_view_host()->routing_id()), 718 tab_contents->render_view_host()->routing_id()),
719 &tab_contents->browser_context()->GetResourceContext())); 719 &tab_contents->browser_context()->GetResourceContext()));
720 } 720 }
721 721
722 void DownloadManager::AddObserver(Observer* observer) { 722 void DownloadManager::AddObserver(Observer* observer) {
723 observers_.AddObserver(observer); 723 observers_.AddObserver(observer);
724 observer->ModelChanged(); 724 observer->ModelChanged();
725 } 725 }
726 726
727 void DownloadManager::RemoveObserver(Observer* observer) { 727 void DownloadManager::RemoveObserver(Observer* observer) {
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 void DownloadManager::MarkDownloadOpened(DownloadItem* download) { 1073 void DownloadManager::MarkDownloadOpened(DownloadItem* download) {
1074 delegate_->UpdateItemInPersistentStore(download); 1074 delegate_->UpdateItemInPersistentStore(download);
1075 int num_unopened = 0; 1075 int num_unopened = 0;
1076 for (DownloadMap::iterator it = history_downloads_.begin(); 1076 for (DownloadMap::iterator it = history_downloads_.begin();
1077 it != history_downloads_.end(); ++it) { 1077 it != history_downloads_.end(); ++it) {
1078 if (it->second->IsComplete() && !it->second->opened()) 1078 if (it->second->IsComplete() && !it->second->opened())
1079 ++num_unopened; 1079 ++num_unopened;
1080 } 1080 }
1081 download_stats::RecordOpensOutstanding(num_unopened); 1081 download_stats::RecordOpensOutstanding(num_unopened);
1082 } 1082 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698