| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "InjectedScriptHost.h" | 32 #include "InjectedScriptHost.h" |
| 33 | 33 |
| 34 #include "Database.h" |
| 34 #include "Element.h" | 35 #include "Element.h" |
| 35 #include "Frame.h" | 36 #include "Frame.h" |
| 36 #include "FrameLoader.h" | 37 #include "FrameLoader.h" |
| 37 #include "HTMLFrameOwnerElement.h" | 38 #include "HTMLFrameOwnerElement.h" |
| 38 #include "InjectedScript.h" | 39 #include "InjectedScript.h" |
| 39 #include "InspectorAgent.h" | 40 #include "InspectorAgent.h" |
| 40 #include "InspectorClient.h" | 41 #include "InspectorClient.h" |
| 41 #include "InspectorConsoleAgent.h" | 42 #include "InspectorConsoleAgent.h" |
| 42 #include "InspectorDOMAgent.h" | 43 #include "InspectorDOMAgent.h" |
| 43 #include "InspectorDOMStorageAgent.h" | 44 #include "InspectorDOMStorageAgent.h" |
| 44 #include "InspectorDatabaseAgent.h" | 45 #include "InspectorDatabaseAgent.h" |
| 45 #include "InspectorDebuggerAgent.h" | 46 #include "InspectorDebuggerAgent.h" |
| 46 #include "InspectorFrontend.h" | 47 #include "InspectorFrontend.h" |
| 47 #include "InspectorValues.h" | 48 #include "InspectorValues.h" |
| 48 #include "Pasteboard.h" | 49 #include "Pasteboard.h" |
| 49 #include "Storage.h" | 50 #include "Storage.h" |
| 50 | 51 |
| 51 #if ENABLE(SQL_DATABASE) | |
| 52 #include "Database.h" | |
| 53 #endif | |
| 54 | 52 |
| 55 #include "markup.h" | 53 #include "markup.h" |
| 56 | 54 |
| 57 #include <wtf/RefPtr.h> | 55 #include <wtf/RefPtr.h> |
| 58 #include <wtf/StdLibExtras.h> | 56 #include <wtf/StdLibExtras.h> |
| 59 | 57 |
| 60 using namespace std; | 58 using namespace std; |
| 61 | 59 |
| 62 namespace WebCore { | 60 namespace WebCore { |
| 63 | 61 |
| 64 PassRefPtr<InjectedScriptHost> InjectedScriptHost::create() | 62 PassRefPtr<InjectedScriptHost> InjectedScriptHost::create() |
| 65 { | 63 { |
| 66 return adoptRef(new InjectedScriptHost()); | 64 return adoptRef(new InjectedScriptHost()); |
| 67 } | 65 } |
| 68 | 66 |
| 69 InjectedScriptHost::InjectedScriptHost() | 67 InjectedScriptHost::InjectedScriptHost() |
| 70 : m_inspectorAgent(0) | 68 : m_inspectorAgent(0) |
| 71 , m_consoleAgent(0) | 69 , m_consoleAgent(0) |
| 72 #if ENABLE(SQL_DATABASE) | |
| 73 , m_databaseAgent(0) | 70 , m_databaseAgent(0) |
| 74 #endif | |
| 75 , m_domStorageAgent(0) | 71 , m_domStorageAgent(0) |
| 76 , m_domAgent(0) | 72 , m_domAgent(0) |
| 77 { | 73 { |
| 78 m_defaultInspectableObject = adoptPtr(new InspectableObject()); | 74 m_defaultInspectableObject = adoptPtr(new InspectableObject()); |
| 79 } | 75 } |
| 80 | 76 |
| 81 InjectedScriptHost::~InjectedScriptHost() | 77 InjectedScriptHost::~InjectedScriptHost() |
| 82 { | 78 { |
| 83 } | 79 } |
| 84 | 80 |
| 85 void InjectedScriptHost::disconnect() | 81 void InjectedScriptHost::disconnect() |
| 86 { | 82 { |
| 87 m_inspectorAgent = 0; | 83 m_inspectorAgent = 0; |
| 88 m_consoleAgent = 0; | 84 m_consoleAgent = 0; |
| 89 #if ENABLE(SQL_DATABASE) | |
| 90 m_databaseAgent = 0; | 85 m_databaseAgent = 0; |
| 91 #endif | |
| 92 m_domStorageAgent = 0; | 86 m_domStorageAgent = 0; |
| 93 m_domAgent = 0; | 87 m_domAgent = 0; |
| 94 } | 88 } |
| 95 | 89 |
| 96 void InjectedScriptHost::inspectImpl(PassRefPtr<InspectorValue> object, PassRefP
tr<InspectorValue> hints) | 90 void InjectedScriptHost::inspectImpl(PassRefPtr<InspectorValue> object, PassRefP
tr<InspectorValue> hints) |
| 97 { | 91 { |
| 98 if (m_inspectorAgent) { | 92 if (m_inspectorAgent) { |
| 99 RefPtr<TypeBuilder::Runtime::RemoteObject> remoteObject = TypeBuilder::R
untime::RemoteObject::runtimeCast(object); | 93 RefPtr<TypeBuilder::Runtime::RemoteObject> remoteObject = TypeBuilder::R
untime::RemoteObject::runtimeCast(object); |
| 100 m_inspectorAgent->inspect(remoteObject, hints->asObject()); | 94 m_inspectorAgent->inspect(remoteObject, hints->asObject()); |
| 101 } | 95 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 m_inspectedObjects.clear(); | 131 m_inspectedObjects.clear(); |
| 138 } | 132 } |
| 139 | 133 |
| 140 InjectedScriptHost::InspectableObject* InjectedScriptHost::inspectedObject(unsig
ned int num) | 134 InjectedScriptHost::InspectableObject* InjectedScriptHost::inspectedObject(unsig
ned int num) |
| 141 { | 135 { |
| 142 if (num >= m_inspectedObjects.size()) | 136 if (num >= m_inspectedObjects.size()) |
| 143 return m_defaultInspectableObject.get(); | 137 return m_defaultInspectableObject.get(); |
| 144 return m_inspectedObjects[num].get(); | 138 return m_inspectedObjects[num].get(); |
| 145 } | 139 } |
| 146 | 140 |
| 147 #if ENABLE(SQL_DATABASE) | |
| 148 String InjectedScriptHost::databaseIdImpl(Database* database) | 141 String InjectedScriptHost::databaseIdImpl(Database* database) |
| 149 { | 142 { |
| 150 if (m_databaseAgent) | 143 if (m_databaseAgent) |
| 151 return m_databaseAgent->databaseId(database); | 144 return m_databaseAgent->databaseId(database); |
| 152 return String(); | 145 return String(); |
| 153 } | 146 } |
| 154 #endif | |
| 155 | 147 |
| 156 String InjectedScriptHost::storageIdImpl(Storage* storage) | 148 String InjectedScriptHost::storageIdImpl(Storage* storage) |
| 157 { | 149 { |
| 158 if (m_domStorageAgent) | 150 if (m_domStorageAgent) |
| 159 return m_domStorageAgent->storageId(storage); | 151 return m_domStorageAgent->storageId(storage); |
| 160 return String(); | 152 return String(); |
| 161 } | 153 } |
| 162 | 154 |
| 163 ScriptDebugServer& InjectedScriptHost::scriptDebugServer() | 155 ScriptDebugServer& InjectedScriptHost::scriptDebugServer() |
| 164 { | 156 { |
| 165 return m_debuggerAgent->scriptDebugServer(); | 157 return m_debuggerAgent->scriptDebugServer(); |
| 166 } | 158 } |
| 167 | 159 |
| 168 | 160 |
| 169 } // namespace WebCore | 161 } // namespace WebCore |
| 170 | 162 |
| OLD | NEW |