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

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

Issue 11363222: Persist download interrupt reason, both target and current paths, and url_chain. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed try bot problems, specifically issues in http://crbug.com/172672 Created 7 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_impl.h" 5 #include "content/browser/download/download_manager_impl.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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 162
163 class DownloadItemFactoryImpl : public DownloadItemFactory { 163 class DownloadItemFactoryImpl : public DownloadItemFactory {
164 public: 164 public:
165 DownloadItemFactoryImpl() {} 165 DownloadItemFactoryImpl() {}
166 virtual ~DownloadItemFactoryImpl() {} 166 virtual ~DownloadItemFactoryImpl() {}
167 167
168 virtual DownloadItemImpl* CreatePersistedItem( 168 virtual DownloadItemImpl* CreatePersistedItem(
169 DownloadItemImplDelegate* delegate, 169 DownloadItemImplDelegate* delegate,
170 DownloadId download_id, 170 DownloadId download_id,
171 const FilePath& path, 171 const FilePath& current_path,
172 const GURL& url, 172 const FilePath& target_path,
173 const std::vector<GURL>& url_chain,
173 const GURL& referrer_url, 174 const GURL& referrer_url,
174 const base::Time& start_time, 175 const base::Time& start_time,
175 const base::Time& end_time, 176 const base::Time& end_time,
176 int64 received_bytes, 177 int64 received_bytes,
177 int64 total_bytes, 178 int64 total_bytes,
178 DownloadItem::DownloadState state, 179 DownloadItem::DownloadState state,
180 DownloadDangerType danger_type,
181 DownloadInterruptReason interrupt_reason,
179 bool opened, 182 bool opened,
180 const net::BoundNetLog& bound_net_log) OVERRIDE { 183 const net::BoundNetLog& bound_net_log) OVERRIDE {
181 return new DownloadItemImpl( 184 return new DownloadItemImpl(
182 delegate, 185 delegate,
183 download_id, 186 download_id,
184 path, 187 current_path,
185 url, 188 target_path,
189 url_chain,
186 referrer_url, 190 referrer_url,
187 start_time, 191 start_time,
188 end_time, 192 end_time,
189 received_bytes, 193 received_bytes,
190 total_bytes, 194 total_bytes,
191 state, 195 state,
196 danger_type,
197 interrupt_reason,
192 opened, 198 opened,
193 bound_net_log); 199 bound_net_log);
194 } 200 }
195 201
196 virtual DownloadItemImpl* CreateActiveItem( 202 virtual DownloadItemImpl* CreateActiveItem(
197 DownloadItemImplDelegate* delegate, 203 DownloadItemImplDelegate* delegate,
198 const DownloadCreateInfo& info, 204 const DownloadCreateInfo& info,
199 const net::BoundNetLog& bound_net_log) OVERRIDE { 205 const net::BoundNetLog& bound_net_log) OVERRIDE {
200 return new DownloadItemImpl(delegate, info, bound_net_log); 206 return new DownloadItemImpl(delegate, info, bound_net_log);
201 } 207 }
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 590
585 void DownloadManagerImpl::AddObserver(Observer* observer) { 591 void DownloadManagerImpl::AddObserver(Observer* observer) {
586 observers_.AddObserver(observer); 592 observers_.AddObserver(observer);
587 } 593 }
588 594
589 void DownloadManagerImpl::RemoveObserver(Observer* observer) { 595 void DownloadManagerImpl::RemoveObserver(Observer* observer) {
590 observers_.RemoveObserver(observer); 596 observers_.RemoveObserver(observer);
591 } 597 }
592 598
593 DownloadItem* DownloadManagerImpl::CreateDownloadItem( 599 DownloadItem* DownloadManagerImpl::CreateDownloadItem(
594 const FilePath& path, 600 const FilePath& current_path,
595 const GURL& url, 601 const FilePath& target_path,
602 const std::vector<GURL>& url_chain,
596 const GURL& referrer_url, 603 const GURL& referrer_url,
597 const base::Time& start_time, 604 const base::Time& start_time,
598 const base::Time& end_time, 605 const base::Time& end_time,
599 int64 received_bytes, 606 int64 received_bytes,
600 int64 total_bytes, 607 int64 total_bytes,
601 DownloadItem::DownloadState state, 608 DownloadItem::DownloadState state,
609 DownloadDangerType danger_type,
610 DownloadInterruptReason interrupt_reason,
602 bool opened) { 611 bool opened) {
603 DownloadItemImpl* item = item_factory_->CreatePersistedItem( 612 DownloadItemImpl* item = item_factory_->CreatePersistedItem(
604 this, 613 this,
605 GetNextId(), 614 GetNextId(),
606 path, 615 current_path,
607 url, 616 target_path,
617 url_chain,
608 referrer_url, 618 referrer_url,
609 start_time, 619 start_time,
610 end_time, 620 end_time,
611 received_bytes, 621 received_bytes,
612 total_bytes, 622 total_bytes,
613 state, 623 state,
624 danger_type,
625 interrupt_reason,
614 opened, 626 opened,
615 net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD)); 627 net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD));
616 DCHECK(!ContainsKey(downloads_, item->GetId())); 628 DCHECK(!ContainsKey(downloads_, item->GetId()));
617 downloads_[item->GetId()] = item; 629 downloads_[item->GetId()] = item;
618 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(this, item)); 630 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(this, item));
619 VLOG(20) << __FUNCTION__ << "() download = " << item->DebugString(true); 631 VLOG(20) << __FUNCTION__ << "() download = " << item->DebugString(true);
620 return item; 632 return item;
621 } 633 }
622 634
623 // TODO(asanka) Move into an observer. 635 // TODO(asanka) Move into an observer.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 if (delegate_ && open_enabled_) // Some tests disable OpenDownload(). 686 if (delegate_ && open_enabled_) // Some tests disable OpenDownload().
675 delegate_->OpenDownload(download); 687 delegate_->OpenDownload(download);
676 } 688 }
677 689
678 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { 690 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) {
679 if (delegate_) 691 if (delegate_)
680 delegate_->ShowDownloadInShell(download); 692 delegate_->ShowDownloadInShell(download);
681 } 693 }
682 694
683 } // namespace content 695 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698