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) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 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 26 matching lines...) Expand all Loading... |
37 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
38 #include <v8.h> | 38 #include <v8.h> |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class InjectedScript; | 42 class InjectedScript; |
43 class InjectedScriptHost; | 43 class InjectedScriptHost; |
44 class InjectedScriptNative; | 44 class InjectedScriptNative; |
45 class RemoteObjectIdBase; | 45 class RemoteObjectIdBase; |
46 class ScriptValue; | 46 class ScriptValue; |
| 47 class V8DebuggerClient; |
47 | 48 |
48 class CORE_EXPORT InjectedScriptManager { | 49 class CORE_EXPORT InjectedScriptManager { |
49 WTF_MAKE_NONCOPYABLE(InjectedScriptManager); | 50 WTF_MAKE_NONCOPYABLE(InjectedScriptManager); |
50 USING_FAST_MALLOC(InjectedScriptManager); | 51 USING_FAST_MALLOC(InjectedScriptManager); |
51 public: | 52 public: |
52 static PassOwnPtr<InjectedScriptManager> createForPage(); | 53 static PassOwnPtr<InjectedScriptManager> create(V8DebuggerClient*); |
53 static PassOwnPtr<InjectedScriptManager> createForWorker(); | |
54 ~InjectedScriptManager(); | 54 ~InjectedScriptManager(); |
55 | 55 |
56 void disconnect(); | 56 void disconnect(); |
57 | 57 |
58 InjectedScriptHost* injectedScriptHost(); | 58 InjectedScriptHost* injectedScriptHost(); |
59 | 59 |
60 InjectedScript* injectedScriptFor(ScriptState*); | 60 InjectedScript* injectedScriptFor(ScriptState*); |
61 InjectedScript* findInjectedScript(int) const; | 61 InjectedScript* findInjectedScript(int) const; |
62 InjectedScript* findInjectedScript(RemoteObjectIdBase*) const; | 62 InjectedScript* findInjectedScript(RemoteObjectIdBase*) const; |
63 void discardInjectedScripts(); | 63 void discardInjectedScripts(); |
64 int discardInjectedScriptFor(ScriptState*); | 64 int discardInjectedScriptFor(ScriptState*); |
65 void releaseObjectGroup(const String& objectGroup); | 65 void releaseObjectGroup(const String& objectGroup); |
66 | 66 |
67 typedef bool (*InspectedStateAccessCheck)(ScriptState*); | 67 typedef bool (*InspectedStateAccessCheck)(ScriptState*); |
68 InspectedStateAccessCheck inspectedStateAccessCheck() const { return m_inspe
ctedStateAccessCheck; } | |
69 | 68 |
70 void setCustomObjectFormatterEnabled(bool); | 69 void setCustomObjectFormatterEnabled(bool); |
71 | 70 |
72 private: | 71 private: |
73 explicit InjectedScriptManager(InspectedStateAccessCheck); | 72 explicit InjectedScriptManager(V8DebuggerClient*); |
74 | 73 |
75 String injectedScriptSource(); | 74 String injectedScriptSource(); |
76 ScriptValue createInjectedScript(const String& source, ScriptState*, int id,
InjectedScriptNative*); | 75 ScriptValue createInjectedScript(const String& source, ScriptState*, int id,
InjectedScriptNative*); |
77 | 76 |
78 static bool canAccessInspectedWindow(ScriptState*); | |
79 static bool canAccessInspectedWorkerGlobalScope(ScriptState*); | |
80 | |
81 typedef HashMap<int, OwnPtr<InjectedScript>> IdToInjectedScriptMap; | 77 typedef HashMap<int, OwnPtr<InjectedScript>> IdToInjectedScriptMap; |
82 IdToInjectedScriptMap m_idToInjectedScript; | 78 IdToInjectedScriptMap m_idToInjectedScript; |
83 RefPtr<InjectedScriptHost> m_injectedScriptHost; | 79 RefPtr<InjectedScriptHost> m_injectedScriptHost; |
84 InspectedStateAccessCheck m_inspectedStateAccessCheck; | |
85 bool m_customObjectFormatterEnabled; | 80 bool m_customObjectFormatterEnabled; |
| 81 V8DebuggerClient* m_client; |
86 }; | 82 }; |
87 | 83 |
88 } // namespace blink | 84 } // namespace blink |
89 | 85 |
90 #endif // !defined(InjectedScriptManager_h) | 86 #endif // !defined(InjectedScriptManager_h) |
OLD | NEW |