| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "chrome/renderer/module_system.h" | |
| 13 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
| 14 | 13 |
| 15 namespace WebKit { | 14 namespace WebKit { |
| 16 class WebFrame; | 15 class WebFrame; |
| 17 } | 16 } |
| 18 | 17 |
| 19 namespace content { | 18 namespace content { |
| 20 class RenderView; | 19 class RenderView; |
| 21 } | 20 } |
| 22 | 21 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 return web_frame_; | 53 return web_frame_; |
| 55 } | 54 } |
| 56 void clear_web_frame() { | 55 void clear_web_frame() { |
| 57 web_frame_ = NULL; | 56 web_frame_ = NULL; |
| 58 } | 57 } |
| 59 | 58 |
| 60 ContextType context_type() const { | 59 ContextType context_type() const { |
| 61 return context_type_; | 60 return context_type_; |
| 62 } | 61 } |
| 63 | 62 |
| 64 void set_module_system(scoped_ptr<ModuleSystem> module_system) { | |
| 65 module_system_ = module_system.Pass(); | |
| 66 } | |
| 67 | |
| 68 // Returns a special Chrome-specific hidden object that is associated with a | 63 // Returns a special Chrome-specific hidden object that is associated with a |
| 69 // context, but not reachable from the JavaScript in that context. This is | 64 // context, but not reachable from the JavaScript in that context. This is |
| 70 // used by our v8::Extension implementations as a way to share code and as a | 65 // used by our v8::Extension implementations as a way to share code and as a |
| 71 // bridge between C++ and JavaScript. | 66 // bridge between C++ and JavaScript. |
| 72 static v8::Handle<v8::Value> GetOrCreateChromeHidden( | 67 static v8::Handle<v8::Value> GetOrCreateChromeHidden( |
| 73 v8::Handle<v8::Context> context); | 68 v8::Handle<v8::Context> context); |
| 74 | 69 |
| 75 // Return the chromeHidden object associated with this context, or an empty | 70 // Return the chromeHidden object associated with this context, or an empty |
| 76 // handle if no chrome hidden has been created (by GetOrCreateChromeHidden) | 71 // handle if no chrome hidden has been created (by GetOrCreateChromeHidden) |
| 77 // yet for this context. | 72 // yet for this context. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // The WebFrame associated with this context. This can be NULL because this | 106 // The WebFrame associated with this context. This can be NULL because this |
| 112 // object can outlive is destroyed asynchronously. | 107 // object can outlive is destroyed asynchronously. |
| 113 WebKit::WebFrame* web_frame_; | 108 WebKit::WebFrame* web_frame_; |
| 114 | 109 |
| 115 // The extension ID this context is associated with. | 110 // The extension ID this context is associated with. |
| 116 std::string extension_id_; | 111 std::string extension_id_; |
| 117 | 112 |
| 118 // The type of context. | 113 // The type of context. |
| 119 ContextType context_type_; | 114 ContextType context_type_; |
| 120 | 115 |
| 121 // Owns and structures the JS that is injected to set up extension bindings. | |
| 122 scoped_ptr<ModuleSystem> module_system_; | |
| 123 | |
| 124 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); | 116 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); |
| 125 }; | 117 }; |
| 126 | 118 |
| 127 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ | 119 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ |
| OLD | NEW |