| 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 <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 download_item_->RemoveObserver(this); | 411 download_item_->RemoveObserver(this); |
| 412 download_item_->Remove(); | 412 download_item_->Remove(); |
| 413 download_item_ = NULL; | 413 download_item_ = NULL; |
| 414 } | 414 } |
| 415 crx_installer_ = NULL; | 415 crx_installer_ = NULL; |
| 416 | 416 |
| 417 if (pending_modules_.empty()) { | 417 if (pending_modules_.empty()) { |
| 418 CHECK_EQ(extension->id(), id_); | 418 CHECK_EQ(extension->id(), id_); |
| 419 ReportSuccess(); | 419 ReportSuccess(); |
| 420 } else { | 420 } else { |
| 421 const base::Version version_required(info.minimum_version); | 421 const Version version_required(info.minimum_version); |
| 422 if (version_required.IsValid() && | 422 if (version_required.IsValid() && |
| 423 extension->version()->CompareTo(version_required) < 0) { | 423 extension->version()->CompareTo(version_required) < 0) { |
| 424 // It should not happen, CrxInstaller will make sure the version is | 424 // It should not happen, CrxInstaller will make sure the version is |
| 425 // equal or newer than version_required. | 425 // equal or newer than version_required. |
| 426 ReportFailure(kDependencyNotFoundError, | 426 ReportFailure(kDependencyNotFoundError, |
| 427 FAILURE_REASON_DEPENDENCY_NOT_FOUND); | 427 FAILURE_REASON_DEPENDENCY_NOT_FOUND); |
| 428 } else if (!SharedModuleInfo::IsSharedModule(extension)) { | 428 } else if (!SharedModuleInfo::IsSharedModule(extension)) { |
| 429 // It should not happen, CrxInstaller will make sure it is a shared | 429 // It should not happen, CrxInstaller will make sure it is a shared |
| 430 // module. | 430 // module. |
| 431 ReportFailure(kDependencyNotSharedModuleError, | 431 ReportFailure(kDependencyNotSharedModuleError, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 483 |
| 484 DCHECK_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); | 484 DCHECK_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); |
| 485 DCHECK(!pending_modules_.empty()); | 485 DCHECK(!pending_modules_.empty()); |
| 486 download_item_ = item; | 486 download_item_ = item; |
| 487 download_item_->AddObserver(this); | 487 download_item_->AddObserver(this); |
| 488 if (pending_modules_.size() > 1) { | 488 if (pending_modules_.size() > 1) { |
| 489 // We are downloading a shared module. We need create an approval for it. | 489 // We are downloading a shared module. We need create an approval for it. |
| 490 scoped_ptr<Approval> approval = Approval::CreateForSharedModule(profile_); | 490 scoped_ptr<Approval> approval = Approval::CreateForSharedModule(profile_); |
| 491 const SharedModuleInfo::ImportInfo& info = pending_modules_.front(); | 491 const SharedModuleInfo::ImportInfo& info = pending_modules_.front(); |
| 492 approval->extension_id = info.extension_id; | 492 approval->extension_id = info.extension_id; |
| 493 const base::Version version_required(info.minimum_version); | 493 const Version version_required(info.minimum_version); |
| 494 | 494 |
| 495 if (version_required.IsValid()) { | 495 if (version_required.IsValid()) { |
| 496 approval->minimum_version.reset(new base::Version(version_required)); | 496 approval->minimum_version.reset( |
| 497 new Version(version_required)); |
| 497 } | 498 } |
| 498 download_item_->SetUserData(kApprovalKey, approval.release()); | 499 download_item_->SetUserData(kApprovalKey, approval.release()); |
| 499 } else { | 500 } else { |
| 500 // It is for the main module of the extension. We should use the provided | 501 // It is for the main module of the extension. We should use the provided |
| 501 // |approval_|. | 502 // |approval_|. |
| 502 if (approval_) | 503 if (approval_) |
| 503 download_item_->SetUserData(kApprovalKey, approval_.release()); | 504 download_item_->SetUserData(kApprovalKey, approval_.release()); |
| 504 } | 505 } |
| 505 | 506 |
| 506 if (!download_started_) { | 507 if (!download_started_) { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 1, | 783 1, |
| 783 kMaxSizeKb, | 784 kMaxSizeKb, |
| 784 kNumBuckets); | 785 kNumBuckets); |
| 785 } | 786 } |
| 786 UMA_HISTOGRAM_BOOLEAN( | 787 UMA_HISTOGRAM_BOOLEAN( |
| 787 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", | 788 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", |
| 788 total_bytes <= 0); | 789 total_bytes <= 0); |
| 789 } | 790 } |
| 790 | 791 |
| 791 } // namespace extensions | 792 } // namespace extensions |
| OLD | NEW |