summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/pending_extension_info.cc
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-14 21:19:28 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-14 21:19:28 +0000
commitf3d3b3843becc02b010ebbcf4087850c215f3ebc (patch)
tree5ea8398d29e2e80bcb5990abe9048104f025e6fe /chrome/browser/extensions/pending_extension_info.cc
parent05f1464c3ce00020d596f7da07254c4f83bef3a2 (diff)
downloadchromium_src-f3d3b3843becc02b010ebbcf4087850c215f3ebc.zip
chromium_src-f3d3b3843becc02b010ebbcf4087850c215f3ebc.tar.gz
chromium_src-f3d3b3843becc02b010ebbcf4087850c215f3ebc.tar.bz2
Remove the last c/b/e/extension_service.h includes from src/extensions
This breaks another unwanted dependency from src/extensions back to src/chrome. * Move PendingExtensionManager and PendingExtensionInfo back into chrome, as they are tied to the concepts of extension install/update and we have decided to keep that functionality in chrome for now. * Eliminate unused include in extension_function.cc No functional changes. BUG=none TEST=compiles TBR=zea@chromium.org for header file move touching chrome/browser/sync/test/integration/sync_extension_helper.cc Review URL: https://codereview.chromium.org/195763017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257203 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/pending_extension_info.cc')
-rw-r--r--chrome/browser/extensions/pending_extension_info.cc68
1 files changed, 68 insertions, 0 deletions
diff --git a/chrome/browser/extensions/pending_extension_info.cc b/chrome/browser/extensions/pending_extension_info.cc
new file mode 100644
index 0000000..bb0d452
--- /dev/null
+++ b/chrome/browser/extensions/pending_extension_info.cc
@@ -0,0 +1,68 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/pending_extension_info.h"
+
+#include "base/logging.h"
+
+namespace extensions {
+
+PendingExtensionInfo::PendingExtensionInfo(
+ const std::string& id,
+ const GURL& update_url,
+ const Version& version,
+ ShouldAllowInstallPredicate should_allow_install,
+ bool is_from_sync,
+ bool install_silently,
+ Manifest::Location install_source,
+ int creation_flags,
+ bool mark_acknowledged)
+ : id_(id),
+ update_url_(update_url),
+ version_(version),
+ should_allow_install_(should_allow_install),
+ is_from_sync_(is_from_sync),
+ install_silently_(install_silently),
+ install_source_(install_source),
+ creation_flags_(creation_flags),
+ mark_acknowledged_(mark_acknowledged) {}
+
+PendingExtensionInfo::PendingExtensionInfo()
+ : update_url_(),
+ should_allow_install_(NULL),
+ is_from_sync_(true),
+ install_silently_(false),
+ install_source_(Manifest::INVALID_LOCATION) {}
+
+bool PendingExtensionInfo::operator==(const PendingExtensionInfo& rhs) const {
+ return id_ == rhs.id_;
+}
+
+int PendingExtensionInfo::CompareTo(const PendingExtensionInfo& other) const {
+ DCHECK_EQ(id_, other.id_);
+ if (version_.IsValid() && other.version_.IsValid()) {
+ int comparison = version_.CompareTo(other.version_);
+
+ // If the versions differ then return the version comparison result.
+ if (comparison != 0)
+ return comparison;
+ }
+
+ // The versions aren't specified, or they are the same version. Check
+ // the install source.
+ if (install_source_ == other.install_source_) {
+ // Same install source, so |this| has the same precedence as |other|.
+ return 0;
+ }
+
+ // Different install sources; |this| has higher precedence if
+ // |install_source_| is the higher priority source.
+ Manifest::Location higher_priority_source =
+ Manifest::GetHigherPriorityLocation(
+ install_source_, other.install_source_);
+
+ return higher_priority_source == install_source_ ? 1 : -1;
+}
+
+} // namespace extensions