| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 { | 334 { |
| 335 } | 335 } |
| 336 | 336 |
| 337 void InspectorPageAgent::restore() | 337 void InspectorPageAgent::restore() |
| 338 { | 338 { |
| 339 ErrorString error; | 339 ErrorString error; |
| 340 if (m_state->booleanProperty(PageAgentState::pageAgentEnabled, false)) | 340 if (m_state->booleanProperty(PageAgentState::pageAgentEnabled, false)) |
| 341 enable(&error); | 341 enable(&error); |
| 342 setBlockedEventsWarningThreshold(&error, m_state->doubleProperty(PageAgentSt
ate::blockedEventsWarningThreshold, 0.0)); | 342 setBlockedEventsWarningThreshold(&error, m_state->doubleProperty(PageAgentSt
ate::blockedEventsWarningThreshold, 0.0)); |
| 343 if (m_client) { | 343 if (m_client) { |
| 344 String16 overlayMessage; | 344 String overlayMessage; |
| 345 m_state->getString(PageAgentState::overlayMessage, &overlayMessage); | 345 m_state->getString(PageAgentState::overlayMessage, &overlayMessage); |
| 346 m_client->configureOverlay(m_state->booleanProperty(PageAgentState::over
laySuspended, false), overlayMessage.isEmpty() ? String() : String(overlayMessag
e)); | 346 m_client->configureOverlay(m_state->booleanProperty(PageAgentState::over
laySuspended, false), overlayMessage); |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 | 349 |
| 350 void InspectorPageAgent::enable(ErrorString*) | 350 void InspectorPageAgent::enable(ErrorString*) |
| 351 { | 351 { |
| 352 m_enabled = true; | 352 m_enabled = true; |
| 353 m_state->setBoolean(PageAgentState::pageAgentEnabled, true); | 353 m_state->setBoolean(PageAgentState::pageAgentEnabled, true); |
| 354 m_instrumentingAgents->addInspectorPageAgent(this); | 354 m_instrumentingAgents->addInspectorPageAgent(this); |
| 355 } | 355 } |
| 356 | 356 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 callback->sendFailure("No frame for given id found"); | 505 callback->sendFailure("No frame for given id found"); |
| 506 return; | 506 return; |
| 507 } | 507 } |
| 508 String content; | 508 String content; |
| 509 bool base64Encoded; | 509 bool base64Encoded; |
| 510 if (!InspectorPageAgent::cachedResourceContent(InspectorPageAgent::cachedRes
ource(frame, KURL(ParsedURLString, url)), &content, &base64Encoded)) { | 510 if (!InspectorPageAgent::cachedResourceContent(InspectorPageAgent::cachedRes
ource(frame, KURL(ParsedURLString, url)), &content, &base64Encoded)) { |
| 511 callback->sendFailure("No resource with given URL found"); | 511 callback->sendFailure("No resource with given URL found"); |
| 512 return; | 512 return; |
| 513 } | 513 } |
| 514 | 514 |
| 515 callback->sendSuccess(m_v8Session->searchInTextByLines(toV8InspectorStringVi
ew(content), toV8InspectorStringView(query), caseSensitive, isRegex)); | 515 auto matches = m_v8Session->searchInTextByLines(toV8InspectorStringView(cont
ent), toV8InspectorStringView(query), caseSensitive, isRegex); |
| 516 auto results = protocol::Array<v8_inspector::protocol::Debugger::API::Search
Match>::create(); |
| 517 for (size_t i = 0; i < matches.size(); ++i) |
| 518 results->addItem(std::move(matches[i])); |
| 519 callback->sendSuccess(std::move(results)); |
| 516 } | 520 } |
| 517 | 521 |
| 518 void InspectorPageAgent::searchInResource(const String& frameId, const String& u
rl, const String& query, const Maybe<bool>& optionalCaseSensitive, const Maybe<b
ool>& optionalIsRegex, std::unique_ptr<SearchInResourceCallback> callback) | 522 void InspectorPageAgent::searchInResource(const String& frameId, const String& u
rl, const String& query, const Maybe<bool>& optionalCaseSensitive, const Maybe<b
ool>& optionalIsRegex, std::unique_ptr<SearchInResourceCallback> callback) |
| 519 { | 523 { |
| 520 if (!m_enabled) { | 524 if (!m_enabled) { |
| 521 callback->sendFailure("Agent is not enabled."); | 525 callback->sendFailure("Agent is not enabled."); |
| 522 return; | 526 return; |
| 523 } | 527 } |
| 524 m_inspectorResourceContentLoader->ensureResourcesContentLoaded(m_resourceCon
tentLoaderClientId, WTF::bind(&InspectorPageAgent::searchContentAfterResourcesCo
ntentLoaded, wrapPersistent(this), frameId, url, query, optionalCaseSensitive.fr
omMaybe(false), optionalIsRegex.fromMaybe(false), passed(std::move(callback)))); | 528 m_inspectorResourceContentLoader->ensureResourcesContentLoaded(m_resourceCon
tentLoaderClientId, WTF::bind(&InspectorPageAgent::searchContentAfterResourcesCo
ntentLoaded, wrapPersistent(this), frameId, url, query, optionalCaseSensitive.fr
omMaybe(false), optionalIsRegex.fromMaybe(false), passed(std::move(callback)))); |
| 525 } | 529 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 542 | 546 |
| 543 void InspectorPageAgent::didClearDocumentOfWindowObject(LocalFrame* frame) | 547 void InspectorPageAgent::didClearDocumentOfWindowObject(LocalFrame* frame) |
| 544 { | 548 { |
| 545 if (!frontend()) | 549 if (!frontend()) |
| 546 return; | 550 return; |
| 547 | 551 |
| 548 protocol::DictionaryValue* scripts = m_state->getObject(PageAgentState::page
AgentScriptsToEvaluateOnLoad); | 552 protocol::DictionaryValue* scripts = m_state->getObject(PageAgentState::page
AgentScriptsToEvaluateOnLoad); |
| 549 if (scripts) { | 553 if (scripts) { |
| 550 for (size_t i = 0; i < scripts->size(); ++i) { | 554 for (size_t i = 0; i < scripts->size(); ++i) { |
| 551 auto script = scripts->at(i); | 555 auto script = scripts->at(i); |
| 552 String16 scriptText; | 556 String scriptText; |
| 553 if (script.second->asString(&scriptText)) | 557 if (script.second->asString(&scriptText)) |
| 554 frame->script().executeScriptInMainWorld(scriptText); | 558 frame->script().executeScriptInMainWorld(scriptText); |
| 555 } | 559 } |
| 556 } | 560 } |
| 557 if (!m_scriptToEvaluateOnLoadOnce.isEmpty()) | 561 if (!m_scriptToEvaluateOnLoadOnce.isEmpty()) |
| 558 frame->script().executeScriptInMainWorld(m_scriptToEvaluateOnLoadOnce); | 562 frame->script().executeScriptInMainWorld(m_scriptToEvaluateOnLoadOnce); |
| 559 } | 563 } |
| 560 | 564 |
| 561 void InspectorPageAgent::domContentLoadedEventFired(LocalFrame* frame) | 565 void InspectorPageAgent::domContentLoadedEventFired(LocalFrame* frame) |
| 562 { | 566 { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 } | 758 } |
| 755 | 759 |
| 756 DEFINE_TRACE(InspectorPageAgent) | 760 DEFINE_TRACE(InspectorPageAgent) |
| 757 { | 761 { |
| 758 visitor->trace(m_inspectedFrames); | 762 visitor->trace(m_inspectedFrames); |
| 759 visitor->trace(m_inspectorResourceContentLoader); | 763 visitor->trace(m_inspectorResourceContentLoader); |
| 760 InspectorBaseAgent::trace(visitor); | 764 InspectorBaseAgent::trace(visitor); |
| 761 } | 765 } |
| 762 | 766 |
| 763 } // namespace blink | 767 } // namespace blink |
| OLD | NEW |