Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 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" | |
| 34 #include "wtf/PassOwnPtr.h" | 33 #include "wtf/PassOwnPtr.h" |
| 35 #include <v8.h> | 34 #include <v8.h> |
| 36 | 35 |
| 37 namespace blink { | 36 namespace blink { |
| 38 | 37 |
| 39 class V8InspectorSessionImpl; | |
| 40 class V8DebuggerImpl; | 38 class V8DebuggerImpl; |
| 41 | 39 |
| 42 namespace protocol { | 40 namespace protocol { |
| 43 class Value; | 41 class Value; |
| 44 } | 42 } |
| 45 | 43 |
| 46 // SECURITY NOTE: Although the InjectedScriptHost is intended for use solely by the inspector, | 44 // SECURITY NOTE: Although the InjectedScriptHost is intended for use solely by the inspector, |
| 47 // a reference to the InjectedScriptHost may be leaked to the page being inspect ed. Thus, the | 45 // a reference to the InjectedScriptHost may be leaked to the page being inspect ed. Thus, the |
| 48 // InjectedScriptHost must never implemment methods that have more power over th e page than the | 46 // InjectedScriptHost must never implemment methods that have more power over th e page than the |
| 49 // page already has itself (e.g. origin restriction bypasses). | 47 // page already has itself (e.g. origin restriction bypasses). |
| 50 | 48 |
| 51 class InjectedScriptHost { | 49 class InjectedScriptHost { |
| 52 public: | 50 public: |
| 53 static PassOwnPtr<InjectedScriptHost> create(V8DebuggerImpl*, V8InspectorSes sionImpl*); | 51 static PassOwnPtr<InjectedScriptHost> create(V8DebuggerImpl*); |
| 54 ~InjectedScriptHost(); | 52 ~InjectedScriptHost(); |
| 55 | 53 |
| 56 void inspectImpl(PassOwnPtr<protocol::Value> objectToInspect, PassOwnPtr<pro tocol::Value> hints); | |
| 57 | |
| 58 V8DebuggerImpl* debugger() { return m_debugger; } | 54 V8DebuggerImpl* debugger() { return m_debugger; } |
| 59 | 55 |
| 60 // FIXME: store this template in per isolate data | 56 // FIXME: store this template in per isolate data |
| 61 void setWrapperTemplate(v8::Local<v8::FunctionTemplate> wrapperTemplate, v8: :Isolate* isolate) { m_wrapperTemplate.Reset(isolate, wrapperTemplate); } | 57 void setWrapperTemplate(v8::Local<v8::FunctionTemplate> wrapperTemplate, v8: :Isolate* isolate) { m_wrapperTemplate.Reset(isolate, wrapperTemplate); } |
| 62 v8::Local<v8::FunctionTemplate> wrapperTemplate(v8::Isolate* isolate) { retu rn v8::Local<v8::FunctionTemplate>::New(isolate, m_wrapperTemplate); } | 58 v8::Local<v8::FunctionTemplate> wrapperTemplate(v8::Isolate* isolate) { retu rn v8::Local<v8::FunctionTemplate>::New(isolate, m_wrapperTemplate); } |
| 63 | 59 |
| 64 private: | 60 private: |
| 65 InjectedScriptHost(V8DebuggerImpl*, V8InspectorSessionImpl*); | 61 InjectedScriptHost(V8DebuggerImpl*); |
|
dgozman
2016/04/27 00:25:50
style: explicit
kozy
2016/04/27 01:22:00
Done.
| |
| 66 | 62 |
| 67 V8DebuggerImpl* m_debugger; | 63 V8DebuggerImpl* m_debugger; |
| 68 V8InspectorSessionImpl* m_session; | |
| 69 v8::Global<v8::FunctionTemplate> m_wrapperTemplate; | 64 v8::Global<v8::FunctionTemplate> m_wrapperTemplate; |
| 70 }; | 65 }; |
| 71 | 66 |
| 72 } // namespace blink | 67 } // namespace blink |
| 73 | 68 |
| 74 #endif // InjectedScriptHost_h | 69 #endif // InjectedScriptHost_h |
| OLD | NEW |