OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 InspectorDOMAgent::InspectorDOMAgent(InspectorPageAgent* pageAgent, InjectedScri
ptManager* injectedScriptManager, InspectorOverlay* overlay) | 228 InspectorDOMAgent::InspectorDOMAgent(InspectorPageAgent* pageAgent, InjectedScri
ptManager* injectedScriptManager, InspectorOverlay* overlay) |
229 : InspectorBaseAgent<InspectorDOMAgent>("DOM") | 229 : InspectorBaseAgent<InspectorDOMAgent>("DOM") |
230 , m_pageAgent(pageAgent) | 230 , m_pageAgent(pageAgent) |
231 , m_injectedScriptManager(injectedScriptManager) | 231 , m_injectedScriptManager(injectedScriptManager) |
232 , m_overlay(overlay) | 232 , m_overlay(overlay) |
233 , m_frontend(0) | 233 , m_frontend(0) |
234 , m_domListener(0) | 234 , m_domListener(0) |
235 , m_lastNodeId(1) | 235 , m_lastNodeId(1) |
236 , m_searchingForNode(NotSearching) | 236 , m_searchingForNode(NotSearching) |
237 , m_suppressAttributeModifiedEvent(false) | 237 , m_suppressAttributeModifiedEvent(false) |
| 238 , m_listener(0) |
238 { | 239 { |
239 } | 240 } |
240 | 241 |
241 InspectorDOMAgent::~InspectorDOMAgent() | 242 InspectorDOMAgent::~InspectorDOMAgent() |
242 { | 243 { |
243 reset(); | 244 reset(); |
244 ASSERT(m_searchingForNode == NotSearching); | 245 ASSERT(m_searchingForNode == NotSearching); |
245 } | 246 } |
246 | 247 |
247 void InspectorDOMAgent::setFrontend(InspectorFrontend* frontend) | 248 void InspectorDOMAgent::setFrontend(InspectorFrontend* frontend) |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 } | 480 } |
480 | 481 |
481 return element; | 482 return element; |
482 } | 483 } |
483 | 484 |
484 void InspectorDOMAgent::enable(ErrorString*) | 485 void InspectorDOMAgent::enable(ErrorString*) |
485 { | 486 { |
486 if (enabled()) | 487 if (enabled()) |
487 return; | 488 return; |
488 m_state->setBoolean(DOMAgentState::domAgentEnabled, true); | 489 m_state->setBoolean(DOMAgentState::domAgentEnabled, true); |
| 490 if (m_listener) |
| 491 m_listener->domAgentWasEnabled(); |
489 } | 492 } |
490 | 493 |
491 bool InspectorDOMAgent::enabled() const | 494 bool InspectorDOMAgent::enabled() const |
492 { | 495 { |
493 return m_state->getBoolean(DOMAgentState::domAgentEnabled); | 496 return m_state->getBoolean(DOMAgentState::domAgentEnabled); |
494 } | 497 } |
495 | 498 |
496 void InspectorDOMAgent::disable(ErrorString*) | 499 void InspectorDOMAgent::disable(ErrorString*) |
497 { | 500 { |
498 if (!enabled()) | 501 if (!enabled()) |
499 return; | 502 return; |
500 m_state->setBoolean(DOMAgentState::domAgentEnabled, false); | 503 m_state->setBoolean(DOMAgentState::domAgentEnabled, false); |
501 reset(); | 504 reset(); |
| 505 if (m_listener) |
| 506 m_listener->domAgentWasDisabled(); |
502 } | 507 } |
503 | 508 |
504 void InspectorDOMAgent::getDocument(ErrorString* errorString, RefPtr<TypeBuilder
::DOM::Node>& root) | 509 void InspectorDOMAgent::getDocument(ErrorString* errorString, RefPtr<TypeBuilder
::DOM::Node>& root) |
505 { | 510 { |
506 // Backward compatibility. Mark agent as enabled when it requests document. | 511 // Backward compatibility. Mark agent as enabled when it requests document. |
507 enable(errorString); | 512 enable(errorString); |
508 | 513 |
509 if (!m_document) { | 514 if (!m_document) { |
510 *errorString = "Document is not available"; | 515 *errorString = "Document is not available"; |
511 return; | 516 return; |
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 if (!m_documentNodeToIdMap.contains(m_document)) { | 2089 if (!m_documentNodeToIdMap.contains(m_document)) { |
2085 RefPtr<TypeBuilder::DOM::Node> root; | 2090 RefPtr<TypeBuilder::DOM::Node> root; |
2086 getDocument(errorString, root); | 2091 getDocument(errorString, root); |
2087 return errorString->isEmpty(); | 2092 return errorString->isEmpty(); |
2088 } | 2093 } |
2089 return true; | 2094 return true; |
2090 } | 2095 } |
2091 | 2096 |
2092 } // namespace WebCore | 2097 } // namespace WebCore |
2093 | 2098 |
OLD | NEW |