Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: chrome/common/extensions/user_script.h

Issue 60112: Implement chromium.self in content scripts, fix bugs (Closed)
Patch Set: fixedy fixedy Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/chrome.gyp ('k') | chrome/common/extensions/user_script.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Chromium Authors. All rights reserved. 1 // Copyright 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_
6 #define CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_ 6 #define CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_
7 7
8 #include <vector> 8 #include <vector>
9 #include <string> 9 #include <string>
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 void clear_url_patterns() { url_patterns_.clear(); } 104 void clear_url_patterns() { url_patterns_.clear(); }
105 105
106 // List of js scripts for this user script 106 // List of js scripts for this user script
107 FileList& js_scripts() { return js_scripts_; } 107 FileList& js_scripts() { return js_scripts_; }
108 const FileList& js_scripts() const { return js_scripts_; } 108 const FileList& js_scripts() const { return js_scripts_; }
109 109
110 // List of css scripts for this user script 110 // List of css scripts for this user script
111 FileList& css_scripts() { return css_scripts_; } 111 FileList& css_scripts() { return css_scripts_; }
112 const FileList& css_scripts() const { return css_scripts_; } 112 const FileList& css_scripts() const { return css_scripts_; }
113 113
114 const std::string& extension_id() const { return extension_id_; }
115 void set_extension_id(const std::string& id) { extension_id_ = id; }
116
117 bool is_standalone() { return extension_id_.empty(); }
118
114 // Returns true if the script should be applied to the specified URL, false 119 // Returns true if the script should be applied to the specified URL, false
115 // otherwise. 120 // otherwise.
116 bool MatchesUrl(const GURL& url); 121 bool MatchesUrl(const GURL& url);
117 122
118 // Serialize the UserScript into a pickle. The content of the scripts and 123 // Serialize the UserScript into a pickle. The content of the scripts and
119 // paths to UserScript::Files will not be serialized! 124 // paths to UserScript::Files will not be serialized!
120 void Pickle(::Pickle* pickle) const; 125 void Pickle(::Pickle* pickle) const;
121 126
122 // Deserialize the script from a pickle. Note that this always succeeds 127 // Deserialize the script from a pickle. Note that this always succeeds
123 // because presumably we were the one that pickled it, and we did it 128 // because presumably we were the one that pickled it, and we did it
(...skipping 10 matching lines...) Expand all
134 139
135 // URLPatterns that determine pages to inject the script into. These are 140 // URLPatterns that determine pages to inject the script into. These are
136 // only used with scripts that are part of extensions. 141 // only used with scripts that are part of extensions.
137 std::vector<URLPattern> url_patterns_; 142 std::vector<URLPattern> url_patterns_;
138 143
139 // List of js scripts defined in content_scripts 144 // List of js scripts defined in content_scripts
140 FileList js_scripts_; 145 FileList js_scripts_;
141 146
142 // List of css scripts defined in content_scripts 147 // List of css scripts defined in content_scripts
143 FileList css_scripts_; 148 FileList css_scripts_;
149
150 // The ID of the extension this script is a part of, if any. Can be empty if
151 // the script is a "standlone" user script.
152 std::string extension_id_;
144 }; 153 };
145 154
146 typedef std::vector<UserScript> UserScriptList; 155 typedef std::vector<UserScript> UserScriptList;
147 156
148 #endif // CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_ 157 #endif // CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_
OLDNEW
« no previous file with comments | « chrome/chrome.gyp ('k') | chrome/common/extensions/user_script.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698