OLD | NEW |
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 151 matching lines...) Loading... |
162 DownloadItemFactoryImpl() {} | 162 DownloadItemFactoryImpl() {} |
163 virtual ~DownloadItemFactoryImpl() {} | 163 virtual ~DownloadItemFactoryImpl() {} |
164 | 164 |
165 virtual DownloadItemImpl* CreatePersistedItem( | 165 virtual DownloadItemImpl* CreatePersistedItem( |
166 DownloadItemImplDelegate* delegate, | 166 DownloadItemImplDelegate* delegate, |
167 uint32 download_id, | 167 uint32 download_id, |
168 const base::FilePath& current_path, | 168 const base::FilePath& current_path, |
169 const base::FilePath& target_path, | 169 const base::FilePath& target_path, |
170 const std::vector<GURL>& url_chain, | 170 const std::vector<GURL>& url_chain, |
171 const GURL& referrer_url, | 171 const GURL& referrer_url, |
| 172 const std::string& mime_type, |
| 173 const std::string& original_mime_type, |
172 const base::Time& start_time, | 174 const base::Time& start_time, |
173 const base::Time& end_time, | 175 const base::Time& end_time, |
174 const std::string& etag, | 176 const std::string& etag, |
175 const std::string& last_modified, | 177 const std::string& last_modified, |
176 int64 received_bytes, | 178 int64 received_bytes, |
177 int64 total_bytes, | 179 int64 total_bytes, |
178 DownloadItem::DownloadState state, | 180 DownloadItem::DownloadState state, |
179 DownloadDangerType danger_type, | 181 DownloadDangerType danger_type, |
180 DownloadInterruptReason interrupt_reason, | 182 DownloadInterruptReason interrupt_reason, |
181 bool opened, | 183 bool opened, |
182 const net::BoundNetLog& bound_net_log) OVERRIDE { | 184 const net::BoundNetLog& bound_net_log) OVERRIDE { |
183 return new DownloadItemImpl( | 185 return new DownloadItemImpl( |
184 delegate, | 186 delegate, |
185 download_id, | 187 download_id, |
186 current_path, | 188 current_path, |
187 target_path, | 189 target_path, |
188 url_chain, | 190 url_chain, |
189 referrer_url, | 191 referrer_url, |
| 192 mime_type, |
| 193 original_mime_type, |
190 start_time, | 194 start_time, |
191 end_time, | 195 end_time, |
192 etag, | 196 etag, |
193 last_modified, | 197 last_modified, |
194 received_bytes, | 198 received_bytes, |
195 total_bytes, | 199 total_bytes, |
196 state, | 200 state, |
197 danger_type, | 201 danger_type, |
198 interrupt_reason, | 202 interrupt_reason, |
199 opened, | 203 opened, |
(...skipping 412 matching lines...) Loading... |
612 void DownloadManagerImpl::RemoveObserver(Observer* observer) { | 616 void DownloadManagerImpl::RemoveObserver(Observer* observer) { |
613 observers_.RemoveObserver(observer); | 617 observers_.RemoveObserver(observer); |
614 } | 618 } |
615 | 619 |
616 DownloadItem* DownloadManagerImpl::CreateDownloadItem( | 620 DownloadItem* DownloadManagerImpl::CreateDownloadItem( |
617 uint32 id, | 621 uint32 id, |
618 const base::FilePath& current_path, | 622 const base::FilePath& current_path, |
619 const base::FilePath& target_path, | 623 const base::FilePath& target_path, |
620 const std::vector<GURL>& url_chain, | 624 const std::vector<GURL>& url_chain, |
621 const GURL& referrer_url, | 625 const GURL& referrer_url, |
| 626 const std::string& mime_type, |
| 627 const std::string& original_mime_type, |
622 const base::Time& start_time, | 628 const base::Time& start_time, |
623 const base::Time& end_time, | 629 const base::Time& end_time, |
624 const std::string& etag, | 630 const std::string& etag, |
625 const std::string& last_modified, | 631 const std::string& last_modified, |
626 int64 received_bytes, | 632 int64 received_bytes, |
627 int64 total_bytes, | 633 int64 total_bytes, |
628 DownloadItem::DownloadState state, | 634 DownloadItem::DownloadState state, |
629 DownloadDangerType danger_type, | 635 DownloadDangerType danger_type, |
630 DownloadInterruptReason interrupt_reason, | 636 DownloadInterruptReason interrupt_reason, |
631 bool opened) { | 637 bool opened) { |
632 if (ContainsKey(downloads_, id)) { | 638 if (ContainsKey(downloads_, id)) { |
633 NOTREACHED(); | 639 NOTREACHED(); |
634 return NULL; | 640 return NULL; |
635 } | 641 } |
636 DownloadItemImpl* item = item_factory_->CreatePersistedItem( | 642 DownloadItemImpl* item = item_factory_->CreatePersistedItem( |
637 this, | 643 this, |
638 id, | 644 id, |
639 current_path, | 645 current_path, |
640 target_path, | 646 target_path, |
641 url_chain, | 647 url_chain, |
642 referrer_url, | 648 referrer_url, |
| 649 mime_type, |
| 650 original_mime_type, |
643 start_time, | 651 start_time, |
644 end_time, | 652 end_time, |
645 etag, | 653 etag, |
646 last_modified, | 654 last_modified, |
647 received_bytes, | 655 received_bytes, |
648 total_bytes, | 656 total_bytes, |
649 state, | 657 state, |
650 danger_type, | 658 danger_type, |
651 interrupt_reason, | 659 interrupt_reason, |
652 opened, | 660 opened, |
(...skipping 55 matching lines...) Loading... |
708 if (delegate_) | 716 if (delegate_) |
709 delegate_->OpenDownload(download); | 717 delegate_->OpenDownload(download); |
710 } | 718 } |
711 | 719 |
712 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 720 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
713 if (delegate_) | 721 if (delegate_) |
714 delegate_->ShowDownloadInShell(download); | 722 delegate_->ShowDownloadInShell(download); |
715 } | 723 } |
716 | 724 |
717 } // namespace content | 725 } // namespace content |
OLD | NEW |