Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: Source/core/inspector/InspectorInspectorAgent.cpp

Issue 476153002: DevTools: Make the way inspectorFrontend is referenced in agents consistent in all of them. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 frame->script().executeScriptInMainWorld(scriptSource.toString()); 93 frame->script().executeScriptInMainWorld(scriptSource.toString());
94 } 94 }
95 95
96 void InspectorInspectorAgent::init() 96 void InspectorInspectorAgent::init()
97 { 97 {
98 m_instrumentingAgents->setInspectorInspectorAgent(this); 98 m_instrumentingAgents->setInspectorInspectorAgent(this);
99 } 99 }
100 100
101 void InspectorInspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend) 101 void InspectorInspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend)
102 { 102 {
103 m_frontend = inspectorFrontend; 103 m_frontend = inspectorFrontend->inspector();
104 } 104 }
105 105
106 void InspectorInspectorAgent::clearFrontend() 106 void InspectorInspectorAgent::clearFrontend()
107 { 107 {
108 m_pendingEvaluateTestCommands.clear(); 108 m_pendingEvaluateTestCommands.clear();
109 m_frontend = 0; 109 m_frontend = 0;
110 m_injectedScriptManager->discardInjectedScripts(); 110 m_injectedScriptManager->discardInjectedScripts();
111 ErrorString error; 111 ErrorString error;
112 disable(&error); 112 disable(&error);
113 } 113 }
114 114
115 void InspectorInspectorAgent::enable(ErrorString*) 115 void InspectorInspectorAgent::enable(ErrorString*)
116 { 116 {
117 m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, true); 117 m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, true);
118 118
119 if (m_pendingInspectData.first) 119 if (m_pendingInspectData.first)
120 inspect(m_pendingInspectData.first, m_pendingInspectData.second); 120 inspect(m_pendingInspectData.first, m_pendingInspectData.second);
121 121
122 for (Vector<pair<long, String> >::iterator it = m_pendingEvaluateTestCommand s.begin(); m_frontend && it != m_pendingEvaluateTestCommands.end(); ++it) 122 for (Vector<pair<long, String> >::iterator it = m_pendingEvaluateTestCommand s.begin(); m_frontend && it != m_pendingEvaluateTestCommands.end(); ++it)
123 m_frontend->inspector()->evaluateForTestInFrontend(static_cast<int>((*it ).first), (*it).second); 123 m_frontend->evaluateForTestInFrontend(static_cast<int>((*it).first), (*i t).second);
124 m_pendingEvaluateTestCommands.clear(); 124 m_pendingEvaluateTestCommands.clear();
125 } 125 }
126 126
127 void InspectorInspectorAgent::disable(ErrorString*) 127 void InspectorInspectorAgent::disable(ErrorString*)
128 { 128 {
129 m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, false); 129 m_state->setBoolean(InspectorAgentState::inspectorAgentEnabled, false);
130 } 130 }
131 131
132 void InspectorInspectorAgent::reset(ErrorString*) 132 void InspectorInspectorAgent::reset(ErrorString*)
133 { 133 {
134 m_inspectedPage->inspectorController().reconnectFrontend(); 134 m_inspectedPage->inspectorController().reconnectFrontend();
135 } 135 }
136 136
137 void InspectorInspectorAgent::domContentLoadedEventFired(LocalFrame* frame) 137 void InspectorInspectorAgent::domContentLoadedEventFired(LocalFrame* frame)
138 { 138 {
139 if (frame->page()->mainFrame() != frame) 139 if (frame->page()->mainFrame() != frame)
140 return; 140 return;
141 141
142 m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects(); 142 m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects();
143 } 143 }
144 144
145 void InspectorInspectorAgent::evaluateForTestInFrontend(long callId, const Strin g& script) 145 void InspectorInspectorAgent::evaluateForTestInFrontend(long callId, const Strin g& script)
146 { 146 {
147 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) { 147 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled)) {
148 m_frontend->inspector()->evaluateForTestInFrontend(static_cast<int>(call Id), script); 148 m_frontend->evaluateForTestInFrontend(static_cast<int>(callId), script);
149 m_frontend->inspector()->flush(); 149 m_frontend->flush();
150 } else { 150 } else {
151 m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script)) ; 151 m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script)) ;
152 } 152 }
153 } 153 }
154 154
155 void InspectorInspectorAgent::setInjectedScriptForOrigin(const String& origin, c onst String& source) 155 void InspectorInspectorAgent::setInjectedScriptForOrigin(const String& origin, c onst String& source)
156 { 156 {
157 m_injectedScriptForOrigin.set(origin, source); 157 m_injectedScriptForOrigin.set(origin, source);
158 } 158 }
159 159
160 void InspectorInspectorAgent::inspect(PassRefPtr<TypeBuilder::Runtime::RemoteObj ect> objectToInspect, PassRefPtr<JSONObject> hints) 160 void InspectorInspectorAgent::inspect(PassRefPtr<TypeBuilder::Runtime::RemoteObj ect> objectToInspect, PassRefPtr<JSONObject> hints)
161 { 161 {
162 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled) && m_fro ntend) { 162 if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled) && m_fro ntend) {
163 m_frontend->inspector()->inspect(objectToInspect, hints); 163 m_frontend->inspect(objectToInspect, hints);
164 m_pendingInspectData.first = nullptr; 164 m_pendingInspectData.first = nullptr;
165 m_pendingInspectData.second = nullptr; 165 m_pendingInspectData.second = nullptr;
166 return; 166 return;
167 } 167 }
168 m_pendingInspectData.first = objectToInspect; 168 m_pendingInspectData.first = objectToInspect;
169 m_pendingInspectData.second = hints; 169 m_pendingInspectData.second = hints;
170 } 170 }
171 171
172 } // namespace blink 172 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorInspectorAgent.h ('k') | Source/core/inspector/InspectorWorkerAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698