| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // SECURITY NOTE: Although the InjectedScriptHost is intended for use solely by
the inspector, | 49 // 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 | 50 // 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 | 51 // 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). | 52 // page already has itself (e.g. origin restriction bypasses). |
| 53 | 53 |
| 54 class InjectedScriptHost { | 54 class InjectedScriptHost { |
| 55 public: | 55 public: |
| 56 static PassOwnPtr<InjectedScriptHost> create(V8DebuggerImpl*, V8InspectorSes
sionImpl*); | 56 static PassOwnPtr<InjectedScriptHost> create(V8DebuggerImpl*, V8InspectorSes
sionImpl*); |
| 57 ~InjectedScriptHost(); | 57 ~InjectedScriptHost(); |
| 58 | 58 |
| 59 void disconnect(); | |
| 60 | |
| 61 void addInspectedObject(PassOwnPtr<V8RuntimeAgent::Inspectable>); | 59 void addInspectedObject(PassOwnPtr<V8RuntimeAgent::Inspectable>); |
| 62 void clearInspectedObjects(); | 60 void clearInspectedObjects(); |
| 63 V8RuntimeAgent::Inspectable* inspectedObject(unsigned num); | 61 V8RuntimeAgent::Inspectable* inspectedObject(unsigned num); |
| 64 | 62 |
| 65 void inspectImpl(PassOwnPtr<protocol::Value> objectToInspect, PassOwnPtr<pro
tocol::Value> hints); | 63 void inspectImpl(PassOwnPtr<protocol::Value> objectToInspect, PassOwnPtr<pro
tocol::Value> hints); |
| 66 | 64 |
| 67 void clearConsoleMessages(); | 65 void clearConsoleMessages(); |
| 68 void debugFunction(const String16& scriptId, int lineNumber, int columnNumbe
r); | 66 void debugFunction(const String16& scriptId, int lineNumber, int columnNumbe
r); |
| 69 void undebugFunction(const String16& scriptId, int lineNumber, int columnNum
ber); | 67 void undebugFunction(const String16& scriptId, int lineNumber, int columnNum
ber); |
| 70 void monitorFunction(const String16& scriptId, int lineNumber, int columnNum
ber, const String16& functionName); | 68 void monitorFunction(const String16& scriptId, int lineNumber, int columnNum
ber, const String16& functionName); |
| 71 void unmonitorFunction(const String16& scriptId, int lineNumber, int columnN
umber); | 69 void unmonitorFunction(const String16& scriptId, int lineNumber, int columnN
umber); |
| 72 | 70 |
| 73 V8DebuggerImpl* debugger() { return m_debugger; } | 71 V8DebuggerImpl* debugger() { return m_debugger; } |
| 74 | 72 |
| 75 // FIXME: store this template in per isolate data | 73 // FIXME: store this template in per isolate data |
| 76 void setWrapperTemplate(v8::Local<v8::FunctionTemplate> wrapperTemplate, v8:
:Isolate* isolate) { m_wrapperTemplate.Reset(isolate, wrapperTemplate); } | 74 void setWrapperTemplate(v8::Local<v8::FunctionTemplate> wrapperTemplate, v8:
:Isolate* isolate) { m_wrapperTemplate.Reset(isolate, wrapperTemplate); } |
| 77 v8::Local<v8::FunctionTemplate> wrapperTemplate(v8::Isolate* isolate) { retu
rn v8::Local<v8::FunctionTemplate>::New(isolate, m_wrapperTemplate); } | 75 v8::Local<v8::FunctionTemplate> wrapperTemplate(v8::Isolate* isolate) { retu
rn v8::Local<v8::FunctionTemplate>::New(isolate, m_wrapperTemplate); } |
| 78 | 76 |
| 79 private: | 77 private: |
| 80 InjectedScriptHost(V8DebuggerImpl*, V8InspectorSessionImpl*); | 78 InjectedScriptHost(V8DebuggerImpl*, V8InspectorSessionImpl*); |
| 81 | 79 |
| 82 V8DebuggerImpl* m_debugger; | 80 V8DebuggerImpl* m_debugger; |
| 83 V8InspectorSessionImpl* m_session; | 81 V8InspectorSessionImpl* m_session; |
| 84 OwnPtr<V8RuntimeAgent::InspectCallback> m_inspectCallback; | |
| 85 OwnPtr<V8RuntimeAgent::ClearConsoleCallback> m_clearConsoleCallback; | |
| 86 protocol::Vector<OwnPtr<V8RuntimeAgent::Inspectable>> m_inspectedObjects; | 82 protocol::Vector<OwnPtr<V8RuntimeAgent::Inspectable>> m_inspectedObjects; |
| 87 v8::Global<v8::FunctionTemplate> m_wrapperTemplate; | 83 v8::Global<v8::FunctionTemplate> m_wrapperTemplate; |
| 88 }; | 84 }; |
| 89 | 85 |
| 90 } // namespace blink | 86 } // namespace blink |
| 91 | 87 |
| 92 #endif // InjectedScriptHost_h | 88 #endif // InjectedScriptHost_h |
| OLD | NEW |