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_SCRIPT_CONTEXT_SET_H_ | 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ |
6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ | 6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 // Adds the given |context| for testing purposes. | 113 // Adds the given |context| for testing purposes. |
114 void AddForTesting(std::unique_ptr<ScriptContext> context); | 114 void AddForTesting(std::unique_ptr<ScriptContext> context); |
115 | 115 |
116 private: | 116 private: |
117 // Finds the extension for the JavaScript context associated with the | 117 // Finds the extension for the JavaScript context associated with the |
118 // specified |frame| and isolated world. If |world_id| is zero, finds the | 118 // specified |frame| and isolated world. If |world_id| is zero, finds the |
119 // extension ID associated with the main world's JavaScript context. If the | 119 // extension ID associated with the main world's JavaScript context. If the |
120 // JavaScript context isn't from an extension, returns empty string. | 120 // JavaScript context isn't from an extension, returns empty string. |
121 const Extension* GetExtensionFromFrameAndWorld( | 121 const Extension* GetExtensionFromFrameAndWorld(blink::WebLocalFrame* frame, |
122 const blink::WebLocalFrame* frame, | 122 int world_id, |
123 int world_id, | 123 bool use_effective_url); |
124 bool use_effective_url); | |
125 | 124 |
126 // Returns the Feature::Context type of context for a JavaScript context. | 125 // Returns the Feature::Context type of context for a JavaScript context. |
127 Feature::Context ClassifyJavaScriptContext( | 126 Feature::Context ClassifyJavaScriptContext( |
128 const Extension* extension, | 127 const Extension* extension, |
129 int world_id, | 128 int world_id, |
130 const GURL& url, | 129 const GURL& url, |
131 const blink::WebSecurityOrigin& origin); | 130 const blink::WebSecurityOrigin& origin); |
132 | 131 |
133 // Weak reference to all installed Extensions that are also active in this | 132 // Weak reference to all installed Extensions that are also active in this |
134 // process. | 133 // process. |
135 ExtensionIdSet* active_extension_ids_; | 134 ExtensionIdSet* active_extension_ids_; |
136 | 135 |
137 // The set of all ScriptContexts we own. | 136 // The set of all ScriptContexts we own. |
138 std::set<ScriptContext*> contexts_; | 137 std::set<ScriptContext*> contexts_; |
139 | 138 |
140 // Whether the script context set is associated with the renderer active on | 139 // Whether the script context set is associated with the renderer active on |
141 // the Chrome OS lock screen. | 140 // the Chrome OS lock screen. |
142 bool is_lock_screen_context_ = false; | 141 bool is_lock_screen_context_ = false; |
143 | 142 |
144 DISALLOW_COPY_AND_ASSIGN(ScriptContextSet); | 143 DISALLOW_COPY_AND_ASSIGN(ScriptContextSet); |
145 }; | 144 }; |
146 | 145 |
147 } // namespace extensions | 146 } // namespace extensions |
148 | 147 |
149 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ | 148 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ |
OLD | NEW |