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

Side by Side Diff: chrome/common/extensions/manifest_handlers/content_scripts_handler.h

Issue 2227193002: Make UserScript non-copyable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: uplaod with base Created 4 years, 4 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_CONTENT_SCRIPTS_HANDLER_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_CONTENT_SCRIPTS_HANDLER_H_
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_CONTENT_SCRIPTS_HANDLER_H_ 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_CONTENT_SCRIPTS_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "extensions/common/extension.h" 11 #include "extensions/common/extension.h"
12 #include "extensions/common/manifest_handler.h" 12 #include "extensions/common/manifest_handler.h"
13 #include "extensions/common/user_script.h" 13 #include "extensions/common/user_script.h"
14 14
15 namespace extensions { 15 namespace extensions {
16 16
17 class URLPatternSet; 17 class URLPatternSet;
18 18
19 struct ContentScriptsInfo : public Extension::ManifestData { 19 struct ContentScriptsInfo : public Extension::ManifestData {
20 ContentScriptsInfo(); 20 ContentScriptsInfo();
21 ~ContentScriptsInfo() override; 21 ~ContentScriptsInfo() override;
22 22
23 // Paths to the content scripts the extension contains (possibly empty). 23 // Paths to the content scripts the extension contains (possibly empty).
24 UserScriptList content_scripts; 24 ScriptMetadataList content_scripts;
25 25
26 // Returns the content scripts for the extension (if the extension has 26 // Returns the content scripts for the extension (if the extension has
27 // no content scripts, this returns an empty list). 27 // no content scripts, this returns an empty list).
28 static const UserScriptList& GetContentScripts(const Extension* extension); 28 static const ScriptMetadataList& GetContentScripts(
29 const Extension* extension);
29 30
30 // Returns the list of hosts that this extension can run content scripts on. 31 // Returns the list of hosts that this extension can run content scripts on.
31 static URLPatternSet GetScriptableHosts(const Extension* extension); 32 static URLPatternSet GetScriptableHosts(const Extension* extension);
32 33
33 // Returns true if the extension has a content script declared at |url|. 34 // Returns true if the extension has a content script declared at |url|.
34 static bool ExtensionHasScriptAtURL(const Extension* extension, 35 static bool ExtensionHasScriptAtURL(const Extension* extension,
35 const GURL& url); 36 const GURL& url);
36 }; 37 };
37 38
38 // Parses the "content_scripts" manifest key. 39 // Parses the "content_scripts" manifest key.
39 class ContentScriptsHandler : public ManifestHandler { 40 class ContentScriptsHandler : public ManifestHandler {
40 public: 41 public:
41 ContentScriptsHandler(); 42 ContentScriptsHandler();
42 ~ContentScriptsHandler() override; 43 ~ContentScriptsHandler() override;
43 44
44 bool Parse(Extension* extension, base::string16* error) override; 45 bool Parse(Extension* extension, base::string16* error) override;
45 bool Validate(const Extension* extension, 46 bool Validate(const Extension* extension,
46 std::string* error, 47 std::string* error,
47 std::vector<InstallWarning>* warnings) const override; 48 std::vector<InstallWarning>* warnings) const override;
48 49
49 private: 50 private:
50 const std::vector<std::string> Keys() const override; 51 const std::vector<std::string> Keys() const override;
51 52
52 DISALLOW_COPY_AND_ASSIGN(ContentScriptsHandler); 53 DISALLOW_COPY_AND_ASSIGN(ContentScriptsHandler);
53 }; 54 };
54 55
55 } // namespace extensions 56 } // namespace extensions
56 57
57 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_CONTENT_SCRIPTS_HANDLER_H_ 58 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_CONTENT_SCRIPTS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698