OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 class Frame; | 44 class Frame; |
45 class InjectedScriptManager; | 45 class InjectedScriptManager; |
46 class InspectorFrontend; | 46 class InspectorFrontend; |
47 class InspectorObject; | 47 class InspectorObject; |
48 class InstrumentingAgents; | 48 class InstrumentingAgents; |
49 class KURL; | 49 class KURL; |
50 class Page; | 50 class Page; |
51 | 51 |
52 typedef String ErrorString; | 52 typedef String ErrorString; |
53 | 53 |
54 class InspectorAgent : public InspectorBaseAgent<InspectorAgent>, public Inspect orBackendDispatcher::InspectorCommandHandler { | 54 class InspectorAgent : public InspectorBaseAgent, public InspectorBackendDispatc her::InspectorCommandHandler { |
55 WTF_MAKE_NONCOPYABLE(InspectorAgent); | 55 WTF_MAKE_NONCOPYABLE(InspectorAgent); |
56 public: | 56 public: |
57 static PassOwnPtr<InspectorAgent> create(Page* page, InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents, InspectorCompos iteState* state) | 57 static PassRefPtr<InspectorAgent> create(Page* page, InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents, InspectorState* state) |
pfeldman
2013/06/18 15:36:06
Make agents ref-counted in a separate patch?
Vladislav Kaznacheev
2013/06/19 12:58:43
Discussed, agreed this is not worth it.
On 2013/06
| |
58 { | 58 { |
59 return adoptPtr(new InspectorAgent(page, injectedScriptManager, instrume ntingAgents, state)); | 59 return adoptRef(new InspectorAgent(page, injectedScriptManager, instrume ntingAgents, state)); |
60 } | 60 } |
61 | 61 |
62 virtual ~InspectorAgent(); | 62 virtual ~InspectorAgent(); |
63 | 63 |
64 // Inspector front-end API. | 64 // Inspector front-end API. |
65 void enable(ErrorString*); | 65 void enable(ErrorString*); |
66 void disable(ErrorString*); | 66 void disable(ErrorString*); |
67 void reset(ErrorString*); | 67 void reset(ErrorString*); |
68 | 68 |
69 KURL inspectedURL() const; | 69 KURL inspectedURL() const; |
(...skipping 12 matching lines...) Expand all Loading... | |
82 bool hasFrontend() const { return m_frontend; } | 82 bool hasFrontend() const { return m_frontend; } |
83 | 83 |
84 // Generic code called from custom implementations. | 84 // Generic code called from custom implementations. |
85 void evaluateForTestInFrontend(long testCallId, const String& script); | 85 void evaluateForTestInFrontend(long testCallId, const String& script); |
86 | 86 |
87 void setInjectedScriptForOrigin(const String& origin, const String& source); | 87 void setInjectedScriptForOrigin(const String& origin, const String& source); |
88 | 88 |
89 void inspect(PassRefPtr<TypeBuilder::Runtime::RemoteObject> objectToInspect, PassRefPtr<InspectorObject> hints); | 89 void inspect(PassRefPtr<TypeBuilder::Runtime::RemoteObject> objectToInspect, PassRefPtr<InspectorObject> hints); |
90 | 90 |
91 private: | 91 private: |
92 InspectorAgent(Page*, InjectedScriptManager*, InstrumentingAgents*, Inspecto rCompositeState*); | 92 InspectorAgent(Page*, InjectedScriptManager*, InstrumentingAgents*, Inspecto rState*); |
93 | 93 |
94 void unbindAllResources(); | 94 void unbindAllResources(); |
95 | 95 |
96 void toggleRecordButton(bool); | 96 void toggleRecordButton(bool); |
97 | 97 |
98 bool isMainResourceLoader(DocumentLoader*, const KURL& requestUrl); | 98 bool isMainResourceLoader(DocumentLoader*, const KURL& requestUrl); |
99 | 99 |
100 Page* m_inspectedPage; | 100 Page* m_inspectedPage; |
101 InspectorFrontend* m_frontend; | 101 InspectorFrontend* m_frontend; |
102 InjectedScriptManager* m_injectedScriptManager; | 102 InjectedScriptManager* m_injectedScriptManager; |
103 | 103 |
104 Vector<pair<long, String> > m_pendingEvaluateTestCommands; | 104 Vector<pair<long, String> > m_pendingEvaluateTestCommands; |
105 pair<RefPtr<TypeBuilder::Runtime::RemoteObject>, RefPtr<InspectorObject> > m _pendingInspectData; | 105 pair<RefPtr<TypeBuilder::Runtime::RemoteObject>, RefPtr<InspectorObject> > m _pendingInspectData; |
106 typedef HashMap<String, String> InjectedScriptForOriginMap; | 106 typedef HashMap<String, String> InjectedScriptForOriginMap; |
107 InjectedScriptForOriginMap m_injectedScriptForOrigin; | 107 InjectedScriptForOriginMap m_injectedScriptForOrigin; |
108 }; | 108 }; |
109 | 109 |
110 class InspectorAgentController: public InspectorBaseController<InspectorAgentCon troller, InspectorAgent> { | |
pfeldman
2013/06/18 15:36:06
s/Controller/Factory/
Vladislav Kaznacheev
2013/06/19 12:58:43
Done.
| |
111 public: | |
112 | |
113 static PassOwnPtr<InspectorAgentController> create(Page* page, InjectedScrip tManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents, Inspe ctorCompositeState* compositeState) | |
114 { | |
115 return adoptPtr(new InspectorAgentController(page, injectedScriptManager , instrumentingAgents, compositeState)); | |
116 } | |
117 | |
118 protected: | |
119 InspectorAgentController(Page* page, InjectedScriptManager* injectedScriptMa nager, InstrumentingAgents* instrumentingAgents, InspectorCompositeState* compos iteState) | |
120 : InspectorBaseController<InspectorAgentController, InspectorAgent>("Ins pector", instrumentingAgents, compositeState) | |
121 { | |
122 setAgent(InspectorAgent::create(page, injectedScriptManager, m_instrumen tingAgents, m_state)); | |
123 } | |
124 }; | |
125 | |
110 } // namespace WebCore | 126 } // namespace WebCore |
111 | 127 |
112 #endif // !defined(InspectorAgent_h) | 128 #endif // !defined(InspectorAgent_h) |
OLD | NEW |