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/save_package.h" | 5 #include "content/browser/download/save_package.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 } | 248 } |
249 | 249 |
250 STLDeleteValues(&saved_success_items_); | 250 STLDeleteValues(&saved_success_items_); |
251 STLDeleteValues(&in_progress_items_); | 251 STLDeleteValues(&in_progress_items_); |
252 STLDeleteValues(&saved_failed_items_); | 252 STLDeleteValues(&saved_failed_items_); |
253 | 253 |
254 file_manager_ = NULL; | 254 file_manager_ = NULL; |
255 } | 255 } |
256 | 256 |
257 GURL SavePackage::GetUrlToBeSaved() { | 257 GURL SavePackage::GetUrlToBeSaved() { |
258 // Instead of using web_contents_.GetURL here, we use url() (which is the | 258 // Instead of using web_contents_.GetURL here, we use url() (which is the |
Charlie Reis
2013/08/16 22:10:14
Wow, this is confusing on multiple levels. :)
Fi
nasko
2013/09/12 17:56:31
Done.
| |
259 // "real" url of the page) from the NavigationEntry because it reflects its | 259 // "real" url of the page) from the NavigationEntry because it reflects its |
260 // origin rather than the displayed one (returned by GetURL) which may be | 260 // origin rather than the displayed one (returned by GetURL) which may be |
261 // different (like having "view-source:" on the front). | 261 // different (like having "view-source:" on the front). |
262 NavigationEntry* active_entry = | 262 NavigationEntry* active_entry = |
263 web_contents()->GetController().GetActiveEntry(); | 263 web_contents()->GetController().GetVisibleEntry(); |
264 return active_entry->GetURL(); | 264 return active_entry->GetURL(); |
265 } | 265 } |
266 | 266 |
267 void SavePackage::Cancel(bool user_action) { | 267 void SavePackage::Cancel(bool user_action) { |
268 if (!canceled()) { | 268 if (!canceled()) { |
269 if (user_action) | 269 if (user_action) |
270 user_canceled_ = true; | 270 user_canceled_ = true; |
271 else | 271 else |
272 disk_error_occurred_ = true; | 272 disk_error_occurred_ = true; |
273 Stop(); | 273 Stop(); |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1446 | 1446 |
1447 void SavePackage::FinalizeDownloadEntry() { | 1447 void SavePackage::FinalizeDownloadEntry() { |
1448 DCHECK(download_); | 1448 DCHECK(download_); |
1449 DCHECK(download_manager_); | 1449 DCHECK(download_manager_); |
1450 | 1450 |
1451 download_manager_->OnSavePackageSuccessfullyFinished(download_); | 1451 download_manager_->OnSavePackageSuccessfullyFinished(download_); |
1452 StopObservation(); | 1452 StopObservation(); |
1453 } | 1453 } |
1454 | 1454 |
1455 } // namespace content | 1455 } // namespace content |
OLD | NEW |