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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 } | 485 } |
486 | 486 |
487 if (!download_started_) { | 487 if (!download_started_) { |
488 if (delegate_) | 488 if (delegate_) |
489 delegate_->OnExtensionDownloadStarted(id_, download_item_); | 489 delegate_->OnExtensionDownloadStarted(id_, download_item_); |
490 download_started_ = true; | 490 download_started_ = true; |
491 } | 491 } |
492 } | 492 } |
493 | 493 |
494 void WebstoreInstaller::OnDownloadUpdated(DownloadItem* download) { | 494 void WebstoreInstaller::OnDownloadUpdated(DownloadItem* download) { |
495 CHECK_EQ(download_item_, download); | 495 // DownloadItemImpl calls the observer for a completed item, ignore it. |
| 496 if (download_item_ != download) |
| 497 return; |
496 | 498 |
497 switch (download->GetState()) { | 499 switch (download->GetState()) { |
498 case DownloadItem::CANCELLED: | 500 case DownloadItem::CANCELLED: |
499 ReportFailure(kDownloadCanceledError, FAILURE_REASON_CANCELLED); | 501 ReportFailure(kDownloadCanceledError, FAILURE_REASON_CANCELLED); |
500 break; | 502 break; |
501 case DownloadItem::INTERRUPTED: | 503 case DownloadItem::INTERRUPTED: |
502 RecordInterrupt(download); | 504 RecordInterrupt(download); |
503 ReportFailure(kDownloadInterruptedError, FAILURE_REASON_OTHER); | 505 ReportFailure(kDownloadInterruptedError, FAILURE_REASON_OTHER); |
504 break; | 506 break; |
505 case DownloadItem::COMPLETE: | 507 case DownloadItem::COMPLETE: |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 1, | 752 1, |
751 kMaxSizeKb, | 753 kMaxSizeKb, |
752 kNumBuckets); | 754 kNumBuckets); |
753 } | 755 } |
754 UMA_HISTOGRAM_BOOLEAN( | 756 UMA_HISTOGRAM_BOOLEAN( |
755 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", | 757 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", |
756 total_bytes <= 0); | 758 total_bytes <= 0); |
757 } | 759 } |
758 | 760 |
759 } // namespace extensions | 761 } // namespace extensions |
OLD | NEW |