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