2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #ifndef InjectedScriptHost_h
31 #define InjectedScriptHost_h
33 #include "ConsoleTypes.h"
34 #include "InspectorAgent.h"
35 #include "ScriptState.h"
36 #include <wtf/RefCounted.h>
37 #include <wtf/Vector.h>
44 class InspectorConsoleAgent;
45 class InspectorDOMStorageAgent;
46 class InspectorDatabaseAgent;
47 class InspectorFrontend;
48 class InspectorObject;
55 class InjectedScriptHost : public RefCounted<InjectedScriptHost> {
57 static PassRefPtr<InjectedScriptHost> create();
58 ~InjectedScriptHost();
60 void init(InspectorAgent* inspectorAgent
61 , InspectorConsoleAgent* consoleAgent
62 #if ENABLE(SQL_DATABASE)
63 , InspectorDatabaseAgent* databaseAgent
65 , InspectorDOMStorageAgent* domStorageAgent
68 m_inspectorAgent = inspectorAgent;
69 m_consoleAgent = consoleAgent;
70 #if ENABLE(SQL_DATABASE)
71 m_databaseAgent = databaseAgent;
73 m_domStorageAgent = domStorageAgent;
76 static Node* scriptValueAsNode(ScriptValue);
77 static ScriptValue nodeAsScriptValue(ScriptState*, Node*);
81 void addInspectedNode(Node*);
82 void clearInspectedNodes();
84 void inspectImpl(PassRefPtr<InspectorValue> objectToInspect, PassRefPtr<InspectorValue> hints);
85 void clearConsoleMessages();
86 void copyText(const String& text);
87 Node* inspectedNode(unsigned int num);
88 #if ENABLE(SQL_DATABASE)
89 int databaseIdImpl(Database*);
91 int storageIdImpl(Storage*);
94 void didCreateWorker(long id, const String& url, bool isSharedWorker);
95 void didDestroyWorker(long id);
101 InspectorAgent* m_inspectorAgent;
102 InspectorConsoleAgent* m_consoleAgent;
103 #if ENABLE(SQL_DATABASE)
104 InspectorDatabaseAgent* m_databaseAgent;
106 InspectorDOMStorageAgent* m_domStorageAgent;
108 Vector<RefPtr<Node> > m_inspectedNodes;
111 } // namespace WebCore
113 #endif // !defined(InjectedScriptHost_h)