summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorjyasskin@chromium.org <jyasskin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-07 09:15:20 +0000
committerjyasskin@chromium.org <jyasskin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-07 09:15:20 +0000
commit53d5f0f46dfcdadb4a3d35e145f37a2aaa8d9567 (patch)
treeb5496d108690e80dec94aace867dfd80fb5c4795 /extensions
parent077b34bc2416ba9a9c443f5e78de31f3fbb9f090 (diff)
downloadchromium_src-53d5f0f46dfcdadb4a3d35e145f37a2aaa8d9567.zip
chromium_src-53d5f0f46dfcdadb4a3d35e145f37a2aaa8d9567.tar.gz
chromium_src-53d5f0f46dfcdadb4a3d35e145f37a2aaa8d9567.tar.bz2
Define the ExtensionId typedef, and use it in extension.h.
This is primarily for documentation now, but one could imagine using a more efficient representation for this known-length string once everywhere is converted to use the same type name. Review URL: https://codereview.chromium.org/189123005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255563 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions')
-rw-r--r--extensions/common/extension.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/extensions/common/extension.h b/extensions/common/extension.h
index 4ea11b4..85062d1 100644
--- a/extensions/common/extension.h
+++ b/extensions/common/extension.h
@@ -48,6 +48,13 @@ class APIPermissionSet;
class ManifestPermissionSet;
class PermissionSet;
+// Uniquely identifies an Extension, using 32 characters from the alphabet
+// 'a'-'p'. An empty string represents "no extension".
+//
+// Note: If this gets used heavily in files that don't otherwise need to include
+// extension.h, we should pull it into a dedicated header.
+typedef std::string ExtensionId;
+
// Represents a Chrome extension.
// Once created, an Extension object is immutable, with the exception of its
// RuntimeData. This makes it safe to use on any thread, since access to the
@@ -171,7 +178,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
Manifest::Location location,
const base::DictionaryValue& value,
int flags,
- const std::string& explicit_id,
+ const ExtensionId& explicit_id,
std::string* error);
// Valid schemes for web extent URLPatterns.
@@ -227,7 +234,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
bool is_public);
// Returns the base extension url for a given |extension_id|.
- static GURL GetBaseURLFromExtensionId(const std::string& extension_id);
+ static GURL GetBaseURLFromExtensionId(const ExtensionId& extension_id);
// DEPRECATED: These methods have been moved to PermissionsData.
// TODO(rdevlin.cronin): remove these once all calls have been updated.
@@ -274,7 +281,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
const base::FilePath& path() const { return path_; }
const GURL& url() const { return extension_url_; }
Manifest::Location location() const;
- const std::string& id() const;
+ const ExtensionId& id() const;
const base::Version* version() const { return version_.get(); }
const std::string VersionString() const;
const std::string& name() const { return name_; }
@@ -340,7 +347,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// The chosen ID will be set in |manifest|.
static bool InitExtensionID(extensions::Manifest* manifest,
const base::FilePath& path,
- const std::string& explicit_id,
+ const ExtensionId& explicit_id,
int creation_flags,
base::string16* error);
@@ -460,19 +467,19 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
};
typedef std::vector<scoped_refptr<const Extension> > ExtensionList;
-typedef std::set<std::string> ExtensionIdSet;
-typedef std::vector<std::string> ExtensionIdList;
+typedef std::set<ExtensionId> ExtensionIdSet;
+typedef std::vector<ExtensionId> ExtensionIdList;
// Handy struct to pass core extension info around.
struct ExtensionInfo {
ExtensionInfo(const base::DictionaryValue* manifest,
- const std::string& id,
+ const ExtensionId& id,
const base::FilePath& path,
Manifest::Location location);
~ExtensionInfo();
scoped_ptr<base::DictionaryValue> extension_manifest;
- std::string extension_id;
+ ExtensionId extension_id;
base::FilePath extension_path;
Manifest::Location extension_location;