| 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 "chrome/browser/extensions/webstore_installer.h" | 5 #include "chrome/browser/extensions/webstore_installer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 if (download_item_) { | 452 if (download_item_) { |
| 453 download_item_->RemoveObserver(this); | 453 download_item_->RemoveObserver(this); |
| 454 download_item_ = NULL; | 454 download_item_ = NULL; |
| 455 } | 455 } |
| 456 } | 456 } |
| 457 | 457 |
| 458 void WebstoreInstaller::OnDownloadStarted( | 458 void WebstoreInstaller::OnDownloadStarted( |
| 459 const std::string& extension_id, | 459 const std::string& extension_id, |
| 460 DownloadItem* item, | 460 DownloadItem* item, |
| 461 content::DownloadInterruptReason interrupt_reason) { | 461 content::DownloadInterruptReason interrupt_reason) { |
| 462 if (!item) { | 462 if (!item || interrupt_reason != content::DOWNLOAD_INTERRUPT_REASON_NONE) { |
| 463 DCHECK_NE(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); | 463 if (item) |
| 464 item->Remove(); |
| 464 ReportFailure(content::DownloadInterruptReasonToString(interrupt_reason), | 465 ReportFailure(content::DownloadInterruptReasonToString(interrupt_reason), |
| 465 FAILURE_REASON_OTHER); | 466 FAILURE_REASON_OTHER); |
| 466 return; | 467 return; |
| 467 } | 468 } |
| 468 | 469 |
| 469 bool found = false; | 470 bool found = false; |
| 470 for (const auto& module : pending_modules_) { | 471 for (const auto& module : pending_modules_) { |
| 471 if (extension_id == module.extension_id) { | 472 if (extension_id == module.extension_id) { |
| 472 found = true; | 473 found = true; |
| 473 break; | 474 break; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 1, | 792 1, |
| 792 kMaxSizeKb, | 793 kMaxSizeKb, |
| 793 kNumBuckets); | 794 kNumBuckets); |
| 794 } | 795 } |
| 795 UMA_HISTOGRAM_BOOLEAN( | 796 UMA_HISTOGRAM_BOOLEAN( |
| 796 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", | 797 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", |
| 797 total_bytes <= 0); | 798 total_bytes <= 0); |
| 798 } | 799 } |
| 799 | 800 |
| 800 } // namespace extensions | 801 } // namespace extensions |
| OLD | NEW |