OLD | NEW |
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/download/save_package.h" | 5 #include "chrome/browser/download/save_package.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 // Pop SaveItem from waiting list. | 856 // Pop SaveItem from waiting list. |
857 SaveItem* save_item = waiting_item_queue_.front(); | 857 SaveItem* save_item = waiting_item_queue_.front(); |
858 waiting_item_queue_.pop(); | 858 waiting_item_queue_.pop(); |
859 | 859 |
860 // Add the item to in_progress_items_. | 860 // Add the item to in_progress_items_. |
861 SaveUrlItemMap::iterator it = in_progress_items_.find( | 861 SaveUrlItemMap::iterator it = in_progress_items_.find( |
862 save_item->url().spec()); | 862 save_item->url().spec()); |
863 DCHECK(it == in_progress_items_.end()); | 863 DCHECK(it == in_progress_items_.end()); |
864 in_progress_items_[save_item->url().spec()] = save_item; | 864 in_progress_items_[save_item->url().spec()] = save_item; |
865 save_item->Start(); | 865 save_item->Start(); |
| 866 GURL referrer; |
| 867 Profile* profile = tab_contents()->GetRenderProcessHost()->profile(); |
| 868 if (profile->GetPrefs()->GetBoolean(prefs::kEnableReferrers)) |
| 869 referrer = save_item->referrer(); |
866 file_manager_->SaveURL(save_item->url(), | 870 file_manager_->SaveURL(save_item->url(), |
867 save_item->referrer(), | 871 referrer, |
868 tab_contents()->GetRenderProcessHost()->id(), | 872 tab_contents()->GetRenderProcessHost()->id(), |
869 routing_id(), | 873 routing_id(), |
870 save_item->save_source(), | 874 save_item->save_source(), |
871 save_item->full_path(), | 875 save_item->full_path(), |
872 request_context_getter_.get(), | 876 request_context_getter_.get(), |
873 this); | 877 this); |
874 } while (process_all_remaining_items && waiting_item_queue_.size()); | 878 } while (process_all_remaining_items && waiting_item_queue_.size()); |
875 } | 879 } |
876 | 880 |
877 | 881 |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 } | 1466 } |
1463 | 1467 |
1464 // SelectFileDialog::Listener interface. | 1468 // SelectFileDialog::Listener interface. |
1465 void SavePackage::FileSelected(const FilePath& path, | 1469 void SavePackage::FileSelected(const FilePath& path, |
1466 int index, void* params) { | 1470 int index, void* params) { |
1467 ContinueSave(path, index); | 1471 ContinueSave(path, index); |
1468 } | 1472 } |
1469 | 1473 |
1470 void SavePackage::FileSelectionCanceled(void* params) { | 1474 void SavePackage::FileSelectionCanceled(void* params) { |
1471 } | 1475 } |
OLD | NEW |