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_H_ | 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ |
6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ | 6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 class WebFrame; | 24 class WebFrame; |
25 class WebLocalFrame; | 25 class WebLocalFrame; |
26 } | 26 } |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 class RenderFrame; | 29 class RenderFrame; |
30 } | 30 } |
31 | 31 |
32 namespace extensions { | 32 namespace extensions { |
33 class Extension; | 33 class Extension; |
34 class ExtensionSet; | |
35 | 34 |
36 // Extensions wrapper for a v8 context. | 35 // Extensions wrapper for a v8 context. |
37 class ScriptContext : public RequestSender::Source { | 36 class ScriptContext : public RequestSender::Source { |
38 public: | 37 public: |
39 ScriptContext(const v8::Local<v8::Context>& context, | 38 ScriptContext(const v8::Local<v8::Context>& context, |
40 blink::WebLocalFrame* frame, | 39 blink::WebLocalFrame* frame, |
41 const Extension* extension, | 40 const Extension* extension, |
42 Feature::Context context_type, | 41 Feature::Context context_type, |
43 const Extension* effective_extension, | 42 const Extension* effective_extension, |
44 Feature::Context effective_context_type); | 43 Feature::Context effective_context_type); |
45 ~ScriptContext() override; | 44 ~ScriptContext() override; |
46 | 45 |
47 // Returns whether |url| from any Extension in |extension_set| is sandboxed, | 46 // Returns whether |url| from any Extension in |extension_set| is sandboxed, |
48 // as declared in each Extension's manifest. | 47 // as declared in each Extension's manifest. |
49 // TODO(kalman): Delete this when crbug.com/466373 is fixed. | 48 // TODO(kalman): Delete this when crbug.com/466373 is fixed. |
50 // See comment in HasAccessOrThrowError. | 49 // See comment in HasAccessOrThrowError. |
51 static bool IsSandboxedPage(const ExtensionSet& extension_set, | 50 static bool IsSandboxedPage(const GURL& url); |
52 const GURL& url); | |
53 | 51 |
54 // Clears the WebFrame for this contexts and invalidates the associated | 52 // Clears the WebFrame for this contexts and invalidates the associated |
55 // ModuleSystem. | 53 // ModuleSystem. |
56 void Invalidate(); | 54 void Invalidate(); |
57 | 55 |
58 // Registers |observer| to be run when this context is invalidated. Closures | 56 // Registers |observer| to be run when this context is invalidated. Closures |
59 // are run immediately when Invalidate() is called, not in a message loop. | 57 // are run immediately when Invalidate() is called, not in a message loop. |
60 void AddInvalidationObserver(const base::Closure& observer); | 58 void AddInvalidationObserver(const base::Closure& observer); |
61 | 59 |
62 // Returns true if this context is still valid, false if it isn't. | 60 // Returns true if this context is still valid, false if it isn't. |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 GURL url_; | 225 GURL url_; |
228 | 226 |
229 scoped_ptr<Runner> runner_; | 227 scoped_ptr<Runner> runner_; |
230 | 228 |
231 DISALLOW_COPY_AND_ASSIGN(ScriptContext); | 229 DISALLOW_COPY_AND_ASSIGN(ScriptContext); |
232 }; | 230 }; |
233 | 231 |
234 } // namespace extensions | 232 } // namespace extensions |
235 | 233 |
236 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ | 234 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ |
OLD | NEW |