| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #ifndef InjectedScriptHost_h | 30 #ifndef InjectedScriptHost_h |
| 31 #define InjectedScriptHost_h | 31 #define InjectedScriptHost_h |
| 32 | 32 |
| 33 #include "platform/inspector_protocol/Collections.h" | 33 #include "platform/inspector_protocol/Collections.h" |
| 34 #include "platform/inspector_protocol/String16.h" | |
| 35 #include "platform/v8_inspector/public/V8RuntimeAgent.h" | |
| 36 #include "wtf/PassOwnPtr.h" | 34 #include "wtf/PassOwnPtr.h" |
| 37 #include <v8.h> | 35 #include <v8.h> |
| 38 | 36 |
| 39 namespace blink { | 37 namespace blink { |
| 40 | 38 |
| 41 class V8InspectorSessionImpl; | 39 class V8InspectorSessionImpl; |
| 42 class V8EventListenerInfo; | |
| 43 class V8DebuggerImpl; | 40 class V8DebuggerImpl; |
| 44 | 41 |
| 45 namespace protocol { | 42 namespace protocol { |
| 46 class DictionaryValue; | 43 class Value; |
| 47 } | 44 } |
| 48 | 45 |
| 49 // SECURITY NOTE: Although the InjectedScriptHost is intended for use solely by
the inspector, | 46 // SECURITY NOTE: Although the InjectedScriptHost is intended for use solely by
the inspector, |
| 50 // a reference to the InjectedScriptHost may be leaked to the page being inspect
ed. Thus, the | 47 // a reference to the InjectedScriptHost may be leaked to the page being inspect
ed. Thus, the |
| 51 // InjectedScriptHost must never implemment methods that have more power over th
e page than the | 48 // InjectedScriptHost must never implemment methods that have more power over th
e page than the |
| 52 // page already has itself (e.g. origin restriction bypasses). | 49 // page already has itself (e.g. origin restriction bypasses). |
| 53 | 50 |
| 54 class InjectedScriptHost { | 51 class InjectedScriptHost { |
| 55 public: | 52 public: |
| 56 static PassOwnPtr<InjectedScriptHost> create(V8DebuggerImpl*, V8InspectorSes
sionImpl*); | 53 static PassOwnPtr<InjectedScriptHost> create(V8DebuggerImpl*, V8InspectorSes
sionImpl*); |
| 57 ~InjectedScriptHost(); | 54 ~InjectedScriptHost(); |
| 58 | 55 |
| 59 void addInspectedObject(PassOwnPtr<V8RuntimeAgent::Inspectable>); | |
| 60 void clearInspectedObjects(); | |
| 61 V8RuntimeAgent::Inspectable* inspectedObject(unsigned num); | |
| 62 | |
| 63 void inspectImpl(PassOwnPtr<protocol::Value> objectToInspect, PassOwnPtr<pro
tocol::Value> hints); | 56 void inspectImpl(PassOwnPtr<protocol::Value> objectToInspect, PassOwnPtr<pro
tocol::Value> hints); |
| 64 | 57 |
| 65 V8DebuggerImpl* debugger() { return m_debugger; } | 58 V8DebuggerImpl* debugger() { return m_debugger; } |
| 66 | 59 |
| 67 // FIXME: store this template in per isolate data | 60 // FIXME: store this template in per isolate data |
| 68 void setWrapperTemplate(v8::Local<v8::FunctionTemplate> wrapperTemplate, v8:
:Isolate* isolate) { m_wrapperTemplate.Reset(isolate, wrapperTemplate); } | 61 void setWrapperTemplate(v8::Local<v8::FunctionTemplate> wrapperTemplate, v8:
:Isolate* isolate) { m_wrapperTemplate.Reset(isolate, wrapperTemplate); } |
| 69 v8::Local<v8::FunctionTemplate> wrapperTemplate(v8::Isolate* isolate) { retu
rn v8::Local<v8::FunctionTemplate>::New(isolate, m_wrapperTemplate); } | 62 v8::Local<v8::FunctionTemplate> wrapperTemplate(v8::Isolate* isolate) { retu
rn v8::Local<v8::FunctionTemplate>::New(isolate, m_wrapperTemplate); } |
| 70 | 63 |
| 71 private: | 64 private: |
| 72 InjectedScriptHost(V8DebuggerImpl*, V8InspectorSessionImpl*); | 65 InjectedScriptHost(V8DebuggerImpl*, V8InspectorSessionImpl*); |
| 73 | 66 |
| 74 V8DebuggerImpl* m_debugger; | 67 V8DebuggerImpl* m_debugger; |
| 75 V8InspectorSessionImpl* m_session; | 68 V8InspectorSessionImpl* m_session; |
| 76 protocol::Vector<OwnPtr<V8RuntimeAgent::Inspectable>> m_inspectedObjects; | |
| 77 v8::Global<v8::FunctionTemplate> m_wrapperTemplate; | 69 v8::Global<v8::FunctionTemplate> m_wrapperTemplate; |
| 78 }; | 70 }; |
| 79 | 71 |
| 80 } // namespace blink | 72 } // namespace blink |
| 81 | 73 |
| 82 #endif // InjectedScriptHost_h | 74 #endif // InjectedScriptHost_h |
| OLD | NEW |