| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 Feature::Context context_type); | 36 Feature::Context context_type); |
| 37 virtual ~ChromeV8Context(); | 37 virtual ~ChromeV8Context(); |
| 38 | 38 |
| 39 // Clears the WebFrame for this contexts and invalidates the associated | 39 // Clears the WebFrame for this contexts and invalidates the associated |
| 40 // ModuleSystem. | 40 // ModuleSystem. |
| 41 void Invalidate(); | 41 void Invalidate(); |
| 42 | 42 |
| 43 // Returns true if this context is still valid, false if it isn't. | 43 // Returns true if this context is still valid, false if it isn't. |
| 44 // A context becomes invalid via Invalidate(). | 44 // A context becomes invalid via Invalidate(). |
| 45 bool is_valid() const { | 45 bool is_valid() const { |
| 46 return !v8_context_.get().IsEmpty(); | 46 return !v8_context_.IsEmpty(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 v8::Handle<v8::Context> v8_context() const { | 49 v8::Handle<v8::Context> v8_context() const { |
| 50 return v8_context_.get(); | 50 return v8_context_.NewHandle(v8::Isolate::GetCurrent()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 const Extension* extension() const { | 53 const Extension* extension() const { |
| 54 return extension_.get(); | 54 return extension_.get(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 WebKit::WebFrame* web_frame() const { | 57 WebKit::WebFrame* web_frame() const { |
| 58 return web_frame_; | 58 return web_frame_; |
| 59 } | 59 } |
| 60 | 60 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 SafeBuiltins safe_builtins_; | 142 SafeBuiltins safe_builtins_; |
| 143 | 143 |
| 144 v8::Isolate* isolate_; | 144 v8::Isolate* isolate_; |
| 145 | 145 |
| 146 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); | 146 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 } // namespace extensions | 149 } // namespace extensions |
| 150 | 150 |
| 151 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ | 151 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ |
| OLD | NEW |