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

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

Issue 8892012: Define kValidUserScriptSchemes in the .h file so that it can be (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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>
11 11
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/string_piece.h" 13 #include "base/string_piece.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 #include "chrome/common/extensions/url_pattern.h" 15 #include "chrome/common/extensions/url_pattern.h"
16 #include "chrome/common/extensions/url_pattern_set.h" 16 #include "chrome/common/extensions/url_pattern_set.h"
17 17
18 class Pickle; 18 class Pickle;
19 class URLPattern;
20 19
21 // Represents a user script, either a standalone one, or one that is part of an 20 // Represents a user script, either a standalone one, or one that is part of an
22 // extension. 21 // extension.
23 class UserScript { 22 class UserScript {
24 public: 23 public:
25 // The file extension for standalone user scripts. 24 // The file extension for standalone user scripts.
26 static const char kFileExtension[]; 25 static const char kFileExtension[];
27 26
28 // The bitmask for valid user script injectable schemes used by URLPattern. 27 // The bitmask for valid user script injectable schemes used by URLPattern.
29 static const int kValidUserScriptSchemes; 28 enum {
29 kValidUserScriptSchemes = URLPattern::SCHEME_HTTP |
30 URLPattern::SCHEME_HTTPS |
31 URLPattern::SCHEME_FILE |
32 URLPattern::SCHEME_FTP
33 };
30 34
31 // Check if a URL should be treated as a user script and converted to an 35 // Check if a URL should be treated as a user script and converted to an
32 // extension. 36 // extension.
33 static bool IsURLUserScript(const GURL& url, const std::string& mime_type); 37 static bool IsURLUserScript(const GURL& url, const std::string& mime_type);
34 38
35 // Locations that user scripts can be run inside the document. 39 // Locations that user scripts can be run inside the document.
36 enum RunLocation { 40 enum RunLocation {
37 DOCUMENT_START, // After the documentElemnet is created, but before 41 DOCUMENT_START, // After the documentElemnet is created, but before
38 // anything else happens. 42 // anything else happens.
39 DOCUMENT_END, // After the entire document is parsed. Same as 43 DOCUMENT_END, // After the entire document is parsed. Same as
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // Defaults to false. 235 // Defaults to false.
232 bool match_all_frames_; 236 bool match_all_frames_;
233 237
234 // True if the script should be injected into an incognito tab. 238 // True if the script should be injected into an incognito tab.
235 bool incognito_enabled_; 239 bool incognito_enabled_;
236 }; 240 };
237 241
238 typedef std::vector<UserScript> UserScriptList; 242 typedef std::vector<UserScript> UserScriptList;
239 243
240 #endif // CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_ 244 #endif // CHROME_COMMON_EXTENSIONS_USER_SCRIPT_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/user_script.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698