summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension.h
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-06 06:17:54 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-06 06:17:54 +0000
commit84ac7f362e565c096851a783ca7163b78e19b659 (patch)
tree7f671e9c025e4e4b37468240e9be7a28926f6a7c /chrome/common/extensions/extension.h
parent17492f531825be1522991579c1a1bd6af2d8c4b1 (diff)
downloadchromium_src-84ac7f362e565c096851a783ca7163b78e19b659.zip
chromium_src-84ac7f362e565c096851a783ca7163b78e19b659.tar.gz
chromium_src-84ac7f362e565c096851a783ca7163b78e19b659.tar.bz2
Generate IDs for --load-extension by hashing the path instead
of incrementing a static counter. BUG=21281 TEST=Load an unpacked extension from chrome://extensions/ that does not have an ID in its manifest. The resulting ID should be random-looking, not something like "aaaaaa". Review URL: http://codereview.chromium.org/256049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension.h')
-rw-r--r--chrome/common/extensions/extension.h23
1 files changed, 3 insertions, 20 deletions
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index d77e5e27..c01d948 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -106,17 +106,9 @@ class Extension {
// The mimetype used for extensions.
static const char kMimeType[];
- Extension()
- : location_(INVALID), is_theme_(false),
- background_page_ready_(false) {}
explicit Extension(const FilePath& path);
virtual ~Extension();
- // Resets the id counter. This is only useful for unit tests.
- static void ResetGeneratedIdCounter() {
- id_counter_ = 0;
- }
-
// Checks to see if the extension has a valid ID.
static bool IdIsValid(const std::string& id);
@@ -160,10 +152,9 @@ class Extension {
// Does a simple base64 encoding of |input| into |output|.
static bool ProducePEM(const std::string& input, std::string* output);
- // Note: The result is coverted to lower-case because the browser enforces
- // hosts to be lower-case in omni-bar.
- static bool GenerateIdFromPublicKey(const std::string& input,
- std::string* output);
+ // Generates an extension ID from arbitrary input. The same input string will
+ // always generate the same output ID.
+ static bool GenerateId(const std::string& input, std::string* output);
// Expects base64 encoded |input| and formats into |output| including
// the appropriate header & footer.
@@ -281,14 +272,6 @@ class Extension {
void SetBackgroundPageReady();
private:
- // Counter used to assign ids to extensions that are loaded using
- // --load-extension.
- static int id_counter_;
-
- // Returns the next counter id. Intentionally post-incrementing so that first
- // value is 0.
- static int NextGeneratedId() { return id_counter_++; }
-
// Helper method that loads a UserScript object from a
// dictionary in the content_script list of the manifest.
bool LoadUserScriptHelper(const DictionaryValue* content_script,