diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 08:01:50 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 08:01:50 +0000 |
commit | 4259f9cc708d8f67d7f935d267da9a7ffa852b65 (patch) | |
tree | 48992e2008df8ff57c600b65f71946774ab074e3 /chrome/common/extensions/user_script.h | |
parent | 86fd92283a371973f175b34f39ba8dd6ef86d7bc (diff) | |
download | chromium_src-4259f9cc708d8f67d7f935d267da9a7ffa852b65.zip chromium_src-4259f9cc708d8f67d7f935d267da9a7ffa852b65.tar.gz chromium_src-4259f9cc708d8f67d7f935d267da9a7ffa852b65.tar.bz2 |
Implement chromium.self in content scripts, so that developers don't
have to know and copy/paste their extension ID.
This required moving the code that defaults the extension ID earlier
in the load process.
Also fixed some bugs:
* fixed a bug that was causing all user scripts to get executed in
the same context.
* made the greasemonkey api only available in 'standalone' user
scripts.
* re-added the anonymous function wrapper that is supposed to wrap
content scripts.
Also added unit tests for the fixed bugs.
Review URL: http://codereview.chromium.org/60112
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13238 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/user_script.h')
-rw-r--r-- | chrome/common/extensions/user_script.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/common/extensions/user_script.h b/chrome/common/extensions/user_script.h index 1a8d6df..070ead3 100644 --- a/chrome/common/extensions/user_script.h +++ b/chrome/common/extensions/user_script.h @@ -111,6 +111,11 @@ class UserScript { FileList& css_scripts() { return css_scripts_; } const FileList& css_scripts() const { return css_scripts_; } + const std::string& extension_id() const { return extension_id_; } + void set_extension_id(const std::string& id) { extension_id_ = id; } + + bool is_standalone() { return extension_id_.empty(); } + // Returns true if the script should be applied to the specified URL, false // otherwise. bool MatchesUrl(const GURL& url); @@ -141,6 +146,10 @@ class UserScript { // List of css scripts defined in content_scripts FileList css_scripts_; + + // The ID of the extension this script is a part of, if any. Can be empty if + // the script is a "standlone" user script. + std::string extension_id_; }; typedef std::vector<UserScript> UserScriptList; |