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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 "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"
(...skipping 13 matching lines...) Expand all
24 #include "content/browser/download/download_item.h" 24 #include "content/browser/download/download_item.h"
25 #include "content/browser/download/download_manager_delegate.h" 25 #include "content/browser/download/download_manager_delegate.h"
26 #include "content/browser/download/download_persistent_store_info.h" 26 #include "content/browser/download/download_persistent_store_info.h"
27 #include "content/browser/download/download_stats.h" 27 #include "content/browser/download/download_stats.h"
28 #include "content/browser/download/download_status_updater.h" 28 #include "content/browser/download/download_status_updater.h"
29 #include "content/browser/download/interrupt_reasons.h" 29 #include "content/browser/download/interrupt_reasons.h"
30 #include "content/browser/renderer_host/render_process_host.h" 30 #include "content/browser/renderer_host/render_process_host.h"
31 #include "content/browser/renderer_host/render_view_host.h" 31 #include "content/browser/renderer_host/render_view_host.h"
32 #include "content/browser/renderer_host/resource_dispatcher_host.h" 32 #include "content/browser/renderer_host/resource_dispatcher_host.h"
33 #include "content/browser/tab_contents/tab_contents.h" 33 #include "content/browser/tab_contents/tab_contents.h"
34 #include "content/common/notification_service.h"
35 #include "content/public/browser/content_browser_client.h" 34 #include "content/public/browser/content_browser_client.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 namespace { 38 namespace {
39 39
40 void BeginDownload( 40 void BeginDownload(
41 const GURL& url, 41 const GURL& url,
42 const GURL& referrer, 42 const GURL& referrer,
43 const DownloadSaveInfo& save_info, 43 const DownloadSaveInfo& save_info,
44 ResourceDispatcherHost* resource_dispatcher_host, 44 ResourceDispatcherHost* resource_dispatcher_host,
45 int render_process_id, 45 int render_process_id,
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 SavePageDownloadFinished(download); 1066 SavePageDownloadFinished(download);
1067 } 1067 }
1068 1068
1069 void DownloadManager::SavePageDownloadFinished(DownloadItem* download) { 1069 void DownloadManager::SavePageDownloadFinished(DownloadItem* download) {
1070 if (download->db_handle() != DownloadItem::kUninitializedHandle) { 1070 if (download->db_handle() != DownloadItem::kUninitializedHandle) {
1071 delegate_->UpdateItemInPersistentStore(download); 1071 delegate_->UpdateItemInPersistentStore(download);
1072 DCHECK(ContainsKey(save_page_downloads_, download->id())); 1072 DCHECK(ContainsKey(save_page_downloads_, download->id()));
1073 save_page_downloads_.erase(download->id()); 1073 save_page_downloads_.erase(download->id());
1074 1074
1075 if (download->IsComplete()) 1075 if (download->IsComplete())
1076 NotificationService::current()->Notify( 1076 content::NotificationService::current()->Notify(
1077 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, 1077 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED,
1078 content::Source<DownloadManager>(this), 1078 content::Source<DownloadManager>(this),
1079 content::Details<DownloadItem>(download)); 1079 content::Details<DownloadItem>(download));
1080 } 1080 }
1081 } 1081 }
1082 1082
1083 void DownloadManager::MarkDownloadOpened(DownloadItem* download) { 1083 void DownloadManager::MarkDownloadOpened(DownloadItem* download) {
1084 delegate_->UpdateItemInPersistentStore(download); 1084 delegate_->UpdateItemInPersistentStore(download);
1085 int num_unopened = 0; 1085 int num_unopened = 0;
1086 for (DownloadMap::iterator it = history_downloads_.begin(); 1086 for (DownloadMap::iterator it = history_downloads_.begin();
1087 it != history_downloads_.end(); ++it) { 1087 it != history_downloads_.end(); ++it) {
1088 if (it->second->IsComplete() && !it->second->opened()) 1088 if (it->second->IsComplete() && !it->second->opened())
1089 ++num_unopened; 1089 ++num_unopened;
1090 } 1090 }
1091 download_stats::RecordOpensOutstanding(num_unopened); 1091 download_stats::RecordOpensOutstanding(num_unopened);
1092 } 1092 }
OLDNEW
« no previous file with comments | « content/browser/debugger/worker_devtools_manager.cc ('k') | content/browser/download/mhtml_generation_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698