Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: extensions/common/alias.cc

Issue 2379763003: Extract permission alias info from PermissionsProvider (Closed)
Patch Set: not nesting Alias in AliasProvider Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/common/alias.cc
diff --git a/extensions/common/alias.cc b/extensions/common/alias.cc
new file mode 100644
index 0000000000000000000000000000000000000000..34c4ca78ff5863bb54f8efe2e7c385474786caa2
--- /dev/null
+++ b/extensions/common/alias.cc
@@ -0,0 +1,36 @@
+// Copyright 2016 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 "extensions/common/alias.h"
+
+#include "base/logging.h"
+#include "base/version.h"
+#include "components/version_info/version_info.h"
+
+namespace extensions {
+
+namespace {
+
+bool CurrentVersionWithinAliasVersionBound(const char* version_string) {
+ if (!version_string)
+ return true;
+ base::Version upper_version_bound(version_string);
+ CHECK(upper_version_bound.IsValid());
+
+ base::Version current_version(version_info::GetVersionNumber());
+ return upper_version_bound.CompareTo(current_version) > 0;
+}
+
+} // namespace
+
+Alias::Alias(const char* const name,
+ const char* const real_name,
+ const char* const upper_version_bound)
+ : name_(name),
+ real_name_(real_name),
+ valid_(CurrentVersionWithinAliasVersionBound(upper_version_bound)) {}
+
+Alias::~Alias() {}
+
+} // namespace extension

Powered by Google App Engine
This is Rietveld 408576698