| 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
|
|
|