| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 407 |
| 408 WebstoreInstaller::~WebstoreInstaller() { | 408 WebstoreInstaller::~WebstoreInstaller() { |
| 409 controller_ = NULL; | 409 controller_ = NULL; |
| 410 if (download_item_) { | 410 if (download_item_) { |
| 411 download_item_->RemoveObserver(this); | 411 download_item_->RemoveObserver(this); |
| 412 download_item_ = NULL; | 412 download_item_ = NULL; |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 | 415 |
| 416 void WebstoreInstaller::OnDownloadStarted( | 416 void WebstoreInstaller::OnDownloadStarted( |
| 417 DownloadItem* item, net::Error error) { | 417 DownloadItem* item, |
| 418 content::DownloadInterruptReason interrupt_reason) { |
| 418 if (!item) { | 419 if (!item) { |
| 419 DCHECK_NE(net::OK, error); | 420 DCHECK_NE(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
| 420 ReportFailure(net::ErrorToString(error), FAILURE_REASON_OTHER); | 421 ReportFailure(content::DownloadInterruptReasonToString(interrupt_reason), |
| 422 FAILURE_REASON_OTHER); |
| 421 return; | 423 return; |
| 422 } | 424 } |
| 423 | 425 |
| 424 DCHECK_EQ(net::OK, error); | 426 DCHECK_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
| 425 DCHECK(!pending_modules_.empty()); | 427 DCHECK(!pending_modules_.empty()); |
| 426 download_item_ = item; | 428 download_item_ = item; |
| 427 download_item_->AddObserver(this); | 429 download_item_->AddObserver(this); |
| 428 if (pending_modules_.size() > 1) { | 430 if (pending_modules_.size() > 1) { |
| 429 // We are downloading a shared module. We need create an approval for it. | 431 // We are downloading a shared module. We need create an approval for it. |
| 430 scoped_ptr<Approval> approval = Approval::CreateForSharedModule(profile_); | 432 scoped_ptr<Approval> approval = Approval::CreateForSharedModule(profile_); |
| 431 const SharedModuleInfo::ImportInfo& info = pending_modules_.front(); | 433 const SharedModuleInfo::ImportInfo& info = pending_modules_.front(); |
| 432 approval->extension_id = info.extension_id; | 434 approval->extension_id = info.extension_id; |
| 433 const Version version_required(info.minimum_version); | 435 const Version version_required(info.minimum_version); |
| 434 | 436 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 1, | 661 1, |
| 660 kMaxSizeKb, | 662 kMaxSizeKb, |
| 661 kNumBuckets); | 663 kNumBuckets); |
| 662 } | 664 } |
| 663 UMA_HISTOGRAM_BOOLEAN( | 665 UMA_HISTOGRAM_BOOLEAN( |
| 664 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", | 666 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", |
| 665 total_bytes <= 0); | 667 total_bytes <= 0); |
| 666 } | 668 } |
| 667 | 669 |
| 668 } // namespace extensions | 670 } // namespace extensions |
| OLD | NEW |