OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_USER_SCRIPT_SET_H_ | 5 #ifndef EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ |
6 #define EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ | 6 #define EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // Appends the ids of the extensions that have user scripts to |ids|. | 49 // Appends the ids of the extensions that have user scripts to |ids|. |
50 void GetActiveExtensionIds(std::set<std::string>* ids) const; | 50 void GetActiveExtensionIds(std::set<std::string>* ids) const; |
51 | 51 |
52 // Append any ScriptInjections that should run on the given |web_frame| and | 52 // Append any ScriptInjections that should run on the given |web_frame| and |
53 // |tab_id|, at the given |run_location|, to |injections|. | 53 // |tab_id|, at the given |run_location|, to |injections|. |
54 // |extensions| is passed in to verify the corresponding extension is still | 54 // |extensions| is passed in to verify the corresponding extension is still |
55 // valid. | 55 // valid. |
56 void GetInjections(ScopedVector<ScriptInjection>* injections, | 56 void GetInjections(ScopedVector<ScriptInjection>* injections, |
57 blink::WebFrame* web_frame, | 57 blink::WebFrame* web_frame, |
58 int tab_id, | 58 int tab_id, |
59 UserScript::RunLocation run_location); | 59 UserScript::RunLocation run_location, |
| 60 bool has_guest_content_script); |
60 | 61 |
61 scoped_ptr<ScriptInjection> GetDeclarativeScriptInjection( | 62 scoped_ptr<ScriptInjection> GetDeclarativeScriptInjection( |
62 int script_id, | 63 int script_id, |
63 blink::WebFrame* web_frame, | 64 blink::WebFrame* web_frame, |
64 int tab_id, | 65 int tab_id, |
65 UserScript::RunLocation run_location, | 66 UserScript::RunLocation run_location, |
66 const GURL& document_url); | 67 const GURL& document_url); |
67 | 68 |
68 // Updates scripts given the shared memory region containing user scripts. | 69 // Updates scripts given the shared memory region containing user scripts. |
69 // Returns true if the scripts were successfully updated. | 70 // Returns true if the scripts were successfully updated. |
70 bool UpdateUserScripts(base::SharedMemoryHandle shared_memory, | 71 bool UpdateUserScripts(base::SharedMemoryHandle shared_memory, |
71 const std::set<HostID>& changed_hosts); | 72 const std::set<HostID>& changed_hosts); |
72 | 73 |
73 const std::vector<UserScript*>& scripts() const { return scripts_.get(); } | 74 const std::vector<UserScript*>& scripts() const { return scripts_.get(); } |
74 | 75 |
75 private: | 76 private: |
76 // Returns a new ScriptInjection for the given |script| to execute in the | 77 // Returns a new ScriptInjection for the given |script| to execute in the |
77 // |web_frame|, or NULL if the script should not execute. | 78 // |web_frame|, or NULL if the script should not execute. |
78 scoped_ptr<ScriptInjection> GetInjectionForScript( | 79 scoped_ptr<ScriptInjection> GetInjectionForScript( |
79 UserScript* script, | 80 UserScript* script, |
80 blink::WebFrame* web_frame, | 81 blink::WebFrame* web_frame, |
81 int tab_id, | 82 int tab_id, |
82 UserScript::RunLocation run_location, | 83 UserScript::RunLocation run_location, |
83 const GURL& document_url, | 84 const GURL& document_url, |
84 bool is_declarative); | 85 bool is_declarative, |
| 86 bool has_guest_content_script); |
85 | 87 |
86 // Shared memory containing raw script data. | 88 // Shared memory containing raw script data. |
87 scoped_ptr<base::SharedMemory> shared_memory_; | 89 scoped_ptr<base::SharedMemory> shared_memory_; |
88 | 90 |
89 // The set of all known extensions. Owned by the Dispatcher. | 91 // The set of all known extensions. Owned by the Dispatcher. |
90 const ExtensionSet* extensions_; | 92 const ExtensionSet* extensions_; |
91 | 93 |
92 // The UserScripts this injector manages. | 94 // The UserScripts this injector manages. |
93 ScopedVector<UserScript> scripts_; | 95 ScopedVector<UserScript> scripts_; |
94 | 96 |
95 // The associated observers. | 97 // The associated observers. |
96 ObserverList<Observer> observers_; | 98 ObserverList<Observer> observers_; |
97 | 99 |
98 DISALLOW_COPY_AND_ASSIGN(UserScriptSet); | 100 DISALLOW_COPY_AND_ASSIGN(UserScriptSet); |
99 }; | 101 }; |
100 | 102 |
101 } // namespace extensions | 103 } // namespace extensions |
102 | 104 |
103 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ | 105 #endif // EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_ |
OLD | NEW |