OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 21 matching lines...) Expand all Loading... |
32 URLPattern::SCHEME_FILE | | 32 URLPattern::SCHEME_FILE | |
33 URLPattern::SCHEME_FTP | 33 URLPattern::SCHEME_FTP |
34 }; | 34 }; |
35 | 35 |
36 // Check if a URL should be treated as a user script and converted to an | 36 // Check if a URL should be treated as a user script and converted to an |
37 // extension. | 37 // extension. |
38 static bool IsURLUserScript(const GURL& url, const std::string& mime_type); | 38 static bool IsURLUserScript(const GURL& url, const std::string& mime_type); |
39 | 39 |
40 // Locations that user scripts can be run inside the document. | 40 // Locations that user scripts can be run inside the document. |
41 enum RunLocation { | 41 enum RunLocation { |
| 42 UNDEFINED, |
42 DOCUMENT_START, // After the documentElemnet is created, but before | 43 DOCUMENT_START, // After the documentElemnet is created, but before |
43 // anything else happens. | 44 // anything else happens. |
44 DOCUMENT_END, // After the entire document is parsed. Same as | 45 DOCUMENT_END, // After the entire document is parsed. Same as |
45 // DOMContentLoaded. | 46 // DOMContentLoaded. |
46 DOCUMENT_IDLE, // Sometime after DOMContentLoaded, as soon as the document | 47 DOCUMENT_IDLE, // Sometime after DOMContentLoaded, as soon as the document |
47 // is "idle". Currently this uses the simple heuristic of: | 48 // is "idle". Currently this uses the simple heuristic of: |
48 // min(DOM_CONTENT_LOADED + TIMEOUT, ONLOAD), but no | 49 // min(DOM_CONTENT_LOADED + TIMEOUT, ONLOAD), but no |
49 // particular injection point is guaranteed. | 50 // particular injection point is guaranteed. |
50 | |
51 RUN_LOCATION_LAST // Leave this as the last item. | 51 RUN_LOCATION_LAST // Leave this as the last item. |
52 }; | 52 }; |
53 | 53 |
54 // Holds actual script file info. | 54 // Holds actual script file info. |
55 class File { | 55 class File { |
56 public: | 56 public: |
57 File(const FilePath& extension_root, const FilePath& relative_path, | 57 File(const FilePath& extension_root, const FilePath& relative_path, |
58 const GURL& url); | 58 const GURL& url); |
59 File(); | 59 File(); |
60 ~File(); | 60 ~File(); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 // Defaults to false. | 251 // Defaults to false. |
252 bool match_all_frames_; | 252 bool match_all_frames_; |
253 | 253 |
254 // True if the script should be injected into an incognito tab. | 254 // True if the script should be injected into an incognito tab. |
255 bool incognito_enabled_; | 255 bool incognito_enabled_; |
256 }; | 256 }; |
257 | 257 |
258 typedef std::vector<UserScript> UserScriptList; | 258 typedef std::vector<UserScript> UserScriptList; |
259 | 259 |
260 #endif // CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_ | 260 #endif // CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_ |
OLD | NEW |