diff options
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/extensions/extension.cc | 8 | ||||
-rw-r--r-- | chrome/common/extensions/extension.h | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 9b74737..33baff8 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -12,6 +12,7 @@ #include "base/string_util.h" #include "base/third_party/nss/blapi.h" #include "base/third_party/nss/sha256.h" +#include "chrome/common/chrome_constants.h" #include "chrome/common/extensions/extension_error_reporter.h" #include "chrome/common/extensions/extension_error_utils.h" #include "chrome/common/extensions/user_script.h" @@ -199,6 +200,13 @@ const std::string Extension::VersionString() const { } // static +bool Extension::IsExtension(const FilePath& file_name) { + return file_name.MatchesExtension( + FilePath::StringType(FILE_PATH_LITERAL(".")) + + chrome::kExtensionFileExtension); +} + +// static bool Extension::IdIsValid(const std::string& id) { // Verify that the id is legal. if (id.size() != (kIdSize * 2)) diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index 1b774ae..ec14b0b 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -142,6 +142,9 @@ class Extension { explicit Extension(const FilePath& path); virtual ~Extension(); + // Returns true if the specified file is an extension. + static bool IsExtension(const FilePath& file_name); + // Resets the id counter. This is only useful for unit tests. static void ResetGeneratedIdCounter() { id_counter_ = 0; |