OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 28 matching lines...) Expand all Loading... |
39 return extension_id_; | 39 return extension_id_; |
40 } | 40 } |
41 | 41 |
42 WebKit::WebFrame* web_frame() const { | 42 WebKit::WebFrame* web_frame() const { |
43 return web_frame_; | 43 return web_frame_; |
44 } | 44 } |
45 void clear_web_frame() { | 45 void clear_web_frame() { |
46 web_frame_ = NULL; | 46 web_frame_ = NULL; |
47 } | 47 } |
48 | 48 |
| 49 // Returns a special Chrome-specific hidden object that is associated with a |
| 50 // context, but not reachable from the JavaScript in that context. This is |
| 51 // used by our v8::Extension implementations as a way to share code and as a |
| 52 // bridge between C++ and JavaScript. |
| 53 static v8::Handle<v8::Value> GetOrCreateChromeHidden( |
| 54 v8::Handle<v8::Context> context); |
| 55 |
| 56 // Return the chromeHidden object associated with this context, or an empty |
| 57 // handle if no chrome hidden has been created (by GetOrCreateChromeHidden) |
| 58 // yet for this context. |
| 59 v8::Handle<v8::Value> GetChromeHidden() const; |
| 60 |
49 // Returns the RenderView associated with this context. Can return NULL if the | 61 // Returns the RenderView associated with this context. Can return NULL if the |
50 // context is in the process of being destroyed. | 62 // context is in the process of being destroyed. |
51 content::RenderView* GetRenderView() const; | 63 content::RenderView* GetRenderView() const; |
52 | 64 |
53 // Fires the onload and onunload events on the chromeHidden object. | 65 // Fires the onload and onunload events on the chromeHidden object. |
54 // TODO(aa): Move this to EventBindings. | 66 // TODO(aa): Move this to EventBindings. |
55 void DispatchOnLoadEvent(bool is_extension_process, | 67 void DispatchOnLoadEvent(bool is_extension_process, |
56 bool is_incognito_process) const; | 68 bool is_incognito_process) const; |
57 void DispatchOnUnloadEvent() const; | 69 void DispatchOnUnloadEvent() const; |
58 | 70 |
(...skipping 21 matching lines...) Expand all Loading... |
80 // object can outlive is destroyed asynchronously. | 92 // object can outlive is destroyed asynchronously. |
81 WebKit::WebFrame* web_frame_; | 93 WebKit::WebFrame* web_frame_; |
82 | 94 |
83 // The extension ID this context is associated with. | 95 // The extension ID this context is associated with. |
84 std::string extension_id_; | 96 std::string extension_id_; |
85 | 97 |
86 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); | 98 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); |
87 }; | 99 }; |
88 | 100 |
89 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ | 101 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ |
OLD | NEW |