| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_COMMON_USER_SCRIPT_H_ | 5 #ifndef EXTENSIONS_COMMON_USER_SCRIPT_H_ |
| 6 #define EXTENSIONS_COMMON_USER_SCRIPT_H_ | 6 #define EXTENSIONS_COMMON_USER_SCRIPT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 void set_run_location(RunLocation location) { run_location_ = location; } | 130 void set_run_location(RunLocation location) { run_location_ = location; } |
| 131 | 131 |
| 132 // Whether to emulate greasemonkey when running this script. | 132 // Whether to emulate greasemonkey when running this script. |
| 133 bool emulate_greasemonkey() const { return emulate_greasemonkey_; } | 133 bool emulate_greasemonkey() const { return emulate_greasemonkey_; } |
| 134 void set_emulate_greasemonkey(bool val) { emulate_greasemonkey_ = val; } | 134 void set_emulate_greasemonkey(bool val) { emulate_greasemonkey_ = val; } |
| 135 | 135 |
| 136 // Whether to match all frames, or only the top one. | 136 // Whether to match all frames, or only the top one. |
| 137 bool match_all_frames() const { return match_all_frames_; } | 137 bool match_all_frames() const { return match_all_frames_; } |
| 138 void set_match_all_frames(bool val) { match_all_frames_ = val; } | 138 void set_match_all_frames(bool val) { match_all_frames_ = val; } |
| 139 | 139 |
| 140 // Whether to match about:blank and about:srcdoc. |
| 141 bool match_about_blank() const { return match_about_blank_; } |
| 142 void set_match_about_blank(bool val) { match_about_blank_ = val; } |
| 143 |
| 140 // The globs, if any, that determine which pages this script runs against. | 144 // The globs, if any, that determine which pages this script runs against. |
| 141 // These are only used with "standalone" Greasemonkey-like user scripts. | 145 // These are only used with "standalone" Greasemonkey-like user scripts. |
| 142 const std::vector<std::string>& globs() const { return globs_; } | 146 const std::vector<std::string>& globs() const { return globs_; } |
| 143 void add_glob(const std::string& glob) { globs_.push_back(glob); } | 147 void add_glob(const std::string& glob) { globs_.push_back(glob); } |
| 144 void clear_globs() { globs_.clear(); } | 148 void clear_globs() { globs_.clear(); } |
| 145 const std::vector<std::string>& exclude_globs() const { | 149 const std::vector<std::string>& exclude_globs() const { |
| 146 return exclude_globs_; | 150 return exclude_globs_; |
| 147 } | 151 } |
| 148 void add_exclude_glob(const std::string& glob) { | 152 void add_exclude_glob(const std::string& glob) { |
| 149 exclude_globs_.push_back(glob); | 153 exclude_globs_.push_back(glob); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 std::string extension_id_; | 246 std::string extension_id_; |
| 243 | 247 |
| 244 // Whether we should try to emulate Greasemonkey's APIs when running this | 248 // Whether we should try to emulate Greasemonkey's APIs when running this |
| 245 // script. | 249 // script. |
| 246 bool emulate_greasemonkey_; | 250 bool emulate_greasemonkey_; |
| 247 | 251 |
| 248 // Whether the user script should run in all frames, or only just the top one. | 252 // Whether the user script should run in all frames, or only just the top one. |
| 249 // Defaults to false. | 253 // Defaults to false. |
| 250 bool match_all_frames_; | 254 bool match_all_frames_; |
| 251 | 255 |
| 256 // Whether the user script should run in about:blank and about:srcdoc as well. |
| 257 // Defaults to false. |
| 258 bool match_about_blank_; |
| 259 |
| 252 // True if the script should be injected into an incognito tab. | 260 // True if the script should be injected into an incognito tab. |
| 253 bool incognito_enabled_; | 261 bool incognito_enabled_; |
| 254 }; | 262 }; |
| 255 | 263 |
| 256 typedef std::vector<UserScript> UserScriptList; | 264 typedef std::vector<UserScript> UserScriptList; |
| 257 | 265 |
| 258 } // namespace extensions | 266 } // namespace extensions |
| 259 | 267 |
| 260 #endif // EXTENSIONS_COMMON_USER_SCRIPT_H_ | 268 #endif // EXTENSIONS_COMMON_USER_SCRIPT_H_ |
| OLD | NEW |