| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ |
| 6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 WebKit::WebFrame* frame, | 32 WebKit::WebFrame* frame, |
| 33 const Extension* extension, | 33 const Extension* extension, |
| 34 extensions::Feature::Context context_type); | 34 extensions::Feature::Context context_type); |
| 35 ~ChromeV8Context(); | 35 ~ChromeV8Context(); |
| 36 | 36 |
| 37 v8::Handle<v8::Context> v8_context() const { | 37 v8::Handle<v8::Context> v8_context() const { |
| 38 return v8_context_; | 38 return v8_context_; |
| 39 } | 39 } |
| 40 | 40 |
| 41 const Extension* extension() const { | 41 const Extension* extension() const { |
| 42 return extension_; | 42 return extension_.get(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 WebKit::WebFrame* web_frame() const { | 45 WebKit::WebFrame* web_frame() const { |
| 46 return web_frame_; | 46 return web_frame_; |
| 47 } | 47 } |
| 48 void clear_web_frame() { | 48 void clear_web_frame() { |
| 49 web_frame_ = NULL; | 49 web_frame_ = NULL; |
| 50 } | 50 } |
| 51 | 51 |
| 52 extensions::Feature::Context context_type() const { | 52 extensions::Feature::Context context_type() const { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // since the DOM keeps the context alive, but it makes things simpler to not | 107 // since the DOM keeps the context alive, but it makes things simpler to not |
| 108 // distinguish the two cases. | 108 // distinguish the two cases. |
| 109 v8::Persistent<v8::Context> v8_context_; | 109 v8::Persistent<v8::Context> v8_context_; |
| 110 | 110 |
| 111 // The WebFrame associated with this context. This can be NULL because this | 111 // The WebFrame associated with this context. This can be NULL because this |
| 112 // object can outlive is destroyed asynchronously. | 112 // object can outlive is destroyed asynchronously. |
| 113 WebKit::WebFrame* web_frame_; | 113 WebKit::WebFrame* web_frame_; |
| 114 | 114 |
| 115 // The extension associated with this context, or NULL if there is none. This | 115 // The extension associated with this context, or NULL if there is none. This |
| 116 // might be a hosted app in the case that this context is hosting a web URL. | 116 // might be a hosted app in the case that this context is hosting a web URL. |
| 117 const Extension* extension_; | 117 scoped_refptr<const Extension> extension_; |
| 118 | 118 |
| 119 // The type of context. | 119 // The type of context. |
| 120 extensions::Feature::Context context_type_; | 120 extensions::Feature::Context context_type_; |
| 121 | 121 |
| 122 // Owns and structures the JS that is injected to set up extension bindings. | 122 // Owns and structures the JS that is injected to set up extension bindings. |
| 123 scoped_ptr<ModuleSystem> module_system_; | 123 scoped_ptr<ModuleSystem> module_system_; |
| 124 | 124 |
| 125 // The extension APIs available to this context. | 125 // The extension APIs available to this context. |
| 126 scoped_ptr<std::set<std::string> > available_extension_apis_; | 126 scoped_ptr<std::set<std::string> > available_extension_apis_; |
| 127 | 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); | 128 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ | 131 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ |
| OLD | NEW |