| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/browser/pending_extension_info.h" | 5 #include "extensions/browser/pending_extension_info.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace extensions { | 9 namespace extensions { |
| 10 | 10 |
| 11 PendingExtensionInfo::PendingExtensionInfo( | 11 PendingExtensionInfo::PendingExtensionInfo( |
| 12 const std::string& id, | 12 const std::string& id, |
| 13 const std::string& install_parameter, |
| 13 const GURL& update_url, | 14 const GURL& update_url, |
| 14 const Version& version, | 15 const Version& version, |
| 15 ShouldAllowInstallPredicate should_allow_install, | 16 ShouldAllowInstallPredicate should_allow_install, |
| 16 bool is_from_sync, | 17 bool is_from_sync, |
| 17 bool install_silently, | 18 bool install_silently, |
| 18 Manifest::Location install_source, | 19 Manifest::Location install_source, |
| 19 int creation_flags, | 20 int creation_flags, |
| 20 bool mark_acknowledged) | 21 bool mark_acknowledged) |
| 21 : id_(id), | 22 : id_(id), |
| 22 update_url_(update_url), | 23 update_url_(update_url), |
| 23 version_(version), | 24 version_(version), |
| 25 install_parameter_(install_parameter), |
| 24 should_allow_install_(should_allow_install), | 26 should_allow_install_(should_allow_install), |
| 25 is_from_sync_(is_from_sync), | 27 is_from_sync_(is_from_sync), |
| 26 install_silently_(install_silently), | 28 install_silently_(install_silently), |
| 27 install_source_(install_source), | 29 install_source_(install_source), |
| 28 creation_flags_(creation_flags), | 30 creation_flags_(creation_flags), |
| 29 mark_acknowledged_(mark_acknowledged) {} | 31 mark_acknowledged_(mark_acknowledged) {} |
| 30 | 32 |
| 31 PendingExtensionInfo::PendingExtensionInfo() | 33 PendingExtensionInfo::PendingExtensionInfo() |
| 32 : update_url_(), | 34 : update_url_(), |
| 33 should_allow_install_(NULL), | 35 should_allow_install_(NULL), |
| 34 is_from_sync_(true), | 36 is_from_sync_(true), |
| 35 install_silently_(false), | 37 install_silently_(false), |
| 36 install_source_(Manifest::INVALID_LOCATION) {} | 38 install_source_(Manifest::INVALID_LOCATION) {} |
| 37 | 39 |
| 40 PendingExtensionInfo::~PendingExtensionInfo() {} |
| 41 |
| 38 bool PendingExtensionInfo::operator==(const PendingExtensionInfo& rhs) const { | 42 bool PendingExtensionInfo::operator==(const PendingExtensionInfo& rhs) const { |
| 39 return id_ == rhs.id_; | 43 return id_ == rhs.id_; |
| 40 } | 44 } |
| 41 | 45 |
| 42 int PendingExtensionInfo::CompareTo(const PendingExtensionInfo& other) const { | 46 int PendingExtensionInfo::CompareTo(const PendingExtensionInfo& other) const { |
| 43 DCHECK_EQ(id_, other.id_); | 47 DCHECK_EQ(id_, other.id_); |
| 44 if (version_.IsValid() && other.version_.IsValid()) { | 48 if (version_.IsValid() && other.version_.IsValid()) { |
| 45 int comparison = version_.CompareTo(other.version_); | 49 int comparison = version_.CompareTo(other.version_); |
| 46 | 50 |
| 47 // If the versions differ then return the version comparison result. | 51 // If the versions differ then return the version comparison result. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 59 // Different install sources; |this| has higher precedence if | 63 // Different install sources; |this| has higher precedence if |
| 60 // |install_source_| is the higher priority source. | 64 // |install_source_| is the higher priority source. |
| 61 Manifest::Location higher_priority_source = | 65 Manifest::Location higher_priority_source = |
| 62 Manifest::GetHigherPriorityLocation( | 66 Manifest::GetHigherPriorityLocation( |
| 63 install_source_, other.install_source_); | 67 install_source_, other.install_source_); |
| 64 | 68 |
| 65 return higher_priority_source == install_source_ ? 1 : -1; | 69 return higher_priority_source == install_source_ ? 1 : -1; |
| 66 } | 70 } |
| 67 | 71 |
| 68 } // namespace extensions | 72 } // namespace extensions |
| OLD | NEW |