Chromium Code Reviews| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 #include "core/html/VoidCallback.h" | 50 #include "core/html/VoidCallback.h" |
| 51 #include "core/html/imports/HTMLImportLoader.h" | 51 #include "core/html/imports/HTMLImportLoader.h" |
| 52 #include "core/html/imports/HTMLImportsController.h" | 52 #include "core/html/imports/HTMLImportsController.h" |
| 53 #include "core/html/parser/TextResourceDecoder.h" | 53 #include "core/html/parser/TextResourceDecoder.h" |
| 54 #include "core/inspector/DOMPatchSupport.h" | 54 #include "core/inspector/DOMPatchSupport.h" |
| 55 #include "core/inspector/IdentifiersFactory.h" | 55 #include "core/inspector/IdentifiersFactory.h" |
| 56 #include "core/inspector/InspectedFrames.h" | 56 #include "core/inspector/InspectedFrames.h" |
| 57 #include "core/inspector/InspectorCSSAgent.h" | 57 #include "core/inspector/InspectorCSSAgent.h" |
| 58 #include "core/inspector/InspectorInstrumentation.h" | 58 #include "core/inspector/InspectorInstrumentation.h" |
| 59 #include "core/inspector/InspectorResourceContentLoader.h" | 59 #include "core/inspector/InspectorResourceContentLoader.h" |
| 60 #include "core/inspector/V8InspectorStringConversion.h" | |
| 60 #include "core/loader/DocumentLoader.h" | 61 #include "core/loader/DocumentLoader.h" |
| 61 #include "core/loader/FrameLoader.h" | 62 #include "core/loader/FrameLoader.h" |
| 62 #include "platform/MIMETypeRegistry.h" | 63 #include "platform/MIMETypeRegistry.h" |
| 63 #include "platform/PlatformResourceLoader.h" | 64 #include "platform/PlatformResourceLoader.h" |
| 64 #include "platform/UserGestureIndicator.h" | 65 #include "platform/UserGestureIndicator.h" |
| 65 #include "platform/v8_inspector/public/V8InspectorSession.h" | 66 #include "platform/v8_inspector/public/V8InspectorSession.h" |
| 66 #include "platform/weborigin/SecurityOrigin.h" | 67 #include "platform/weborigin/SecurityOrigin.h" |
| 67 #include "wtf/CurrentTime.h" | 68 #include "wtf/CurrentTime.h" |
| 68 #include "wtf/ListHashSet.h" | 69 #include "wtf/ListHashSet.h" |
| 69 #include "wtf/Vector.h" | 70 #include "wtf/Vector.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 { | 345 { |
| 345 } | 346 } |
| 346 | 347 |
| 347 void InspectorPageAgent::restore() | 348 void InspectorPageAgent::restore() |
| 348 { | 349 { |
| 349 ErrorString error; | 350 ErrorString error; |
| 350 if (m_state->booleanProperty(PageAgentState::pageAgentEnabled, false)) | 351 if (m_state->booleanProperty(PageAgentState::pageAgentEnabled, false)) |
| 351 enable(&error); | 352 enable(&error); |
| 352 setBlockedEventsWarningThreshold(&error, m_state->doubleProperty(PageAgentSt ate::blockedEventsWarningThreshold, 0.0)); | 353 setBlockedEventsWarningThreshold(&error, m_state->doubleProperty(PageAgentSt ate::blockedEventsWarningThreshold, 0.0)); |
| 353 if (m_client) { | 354 if (m_client) { |
| 354 String16 overlayMessage; | 355 String overlayMessage; |
| 355 m_state->getString(PageAgentState::overlayMessage, &overlayMessage); | 356 m_state->getString(PageAgentState::overlayMessage, &overlayMessage); |
| 356 m_client->configureOverlay(m_state->booleanProperty(PageAgentState::over laySuspended, false), overlayMessage.isEmpty() ? String() : String(overlayMessag e)); | 357 m_client->configureOverlay(m_state->booleanProperty(PageAgentState::over laySuspended, false), overlayMessage.isEmpty() ? String() : overlayMessage); |
|
caseq
2016/08/19 02:50:36
remove ternary operator here.
| |
| 357 } | 358 } |
| 358 } | 359 } |
| 359 | 360 |
| 360 void InspectorPageAgent::enable(ErrorString*) | 361 void InspectorPageAgent::enable(ErrorString*) |
| 361 { | 362 { |
| 362 m_enabled = true; | 363 m_enabled = true; |
| 363 m_state->setBoolean(PageAgentState::pageAgentEnabled, true); | 364 m_state->setBoolean(PageAgentState::pageAgentEnabled, true); |
| 364 m_instrumentingAgents->addInspectorPageAgent(this); | 365 m_instrumentingAgents->addInspectorPageAgent(this); |
| 365 } | 366 } |
| 366 | 367 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 515 callback->sendFailure("No frame for given id found"); | 516 callback->sendFailure("No frame for given id found"); |
| 516 return; | 517 return; |
| 517 } | 518 } |
| 518 String content; | 519 String content; |
| 519 bool base64Encoded; | 520 bool base64Encoded; |
| 520 if (!InspectorPageAgent::cachedResourceContent(InspectorPageAgent::cachedRes ource(frame, KURL(ParsedURLString, url)), &content, &base64Encoded)) { | 521 if (!InspectorPageAgent::cachedResourceContent(InspectorPageAgent::cachedRes ource(frame, KURL(ParsedURLString, url)), &content, &base64Encoded)) { |
| 521 callback->sendFailure("No resource with given URL found"); | 522 callback->sendFailure("No resource with given URL found"); |
| 522 return; | 523 return; |
| 523 } | 524 } |
| 524 | 525 |
| 525 callback->sendSuccess(m_v8Session->searchInTextByLines(content, query, caseS ensitive, isRegex)); | 526 std::vector<std::unique_ptr<v8_inspector::protocol::Debugger::API::SearchMat ch>> matches = m_v8Session->searchInTextByLines(toV8InspectorString(content), to V8InspectorString(query), caseSensitive, isRegex); |
| 527 std::unique_ptr<protocol::Array<v8_inspector::protocol::Debugger::API::Searc hMatch>> results = protocol::Array<v8_inspector::protocol::Debugger::API::Search Match>::create(); | |
|
caseq
2016/08/19 02:50:36
auto results = ....::create()?
| |
| 528 for (size_t i = 0; i < matches.size(); ++i) | |
| 529 results->addItem(std::move(matches[i])); | |
| 530 callback->sendSuccess(std::move(results)); | |
| 526 } | 531 } |
| 527 | 532 |
| 528 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) | 533 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) |
| 529 { | 534 { |
| 530 if (!m_enabled) { | 535 if (!m_enabled) { |
| 531 callback->sendFailure("Agent is not enabled."); | 536 callback->sendFailure("Agent is not enabled."); |
| 532 return; | 537 return; |
| 533 } | 538 } |
| 534 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)))); | 539 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)))); |
| 535 } | 540 } |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 552 | 557 |
| 553 void InspectorPageAgent::didClearDocumentOfWindowObject(LocalFrame* frame) | 558 void InspectorPageAgent::didClearDocumentOfWindowObject(LocalFrame* frame) |
| 554 { | 559 { |
| 555 if (!frontend()) | 560 if (!frontend()) |
| 556 return; | 561 return; |
| 557 | 562 |
| 558 protocol::DictionaryValue* scripts = m_state->getObject(PageAgentState::page AgentScriptsToEvaluateOnLoad); | 563 protocol::DictionaryValue* scripts = m_state->getObject(PageAgentState::page AgentScriptsToEvaluateOnLoad); |
| 559 if (scripts) { | 564 if (scripts) { |
| 560 for (size_t i = 0; i < scripts->size(); ++i) { | 565 for (size_t i = 0; i < scripts->size(); ++i) { |
| 561 auto script = scripts->at(i); | 566 auto script = scripts->at(i); |
| 562 String16 scriptText; | 567 String scriptText; |
| 563 if (script.second->asString(&scriptText)) | 568 if (script.second->asString(&scriptText)) |
| 564 frame->script().executeScriptInMainWorld(scriptText); | 569 frame->script().executeScriptInMainWorld(scriptText); |
| 565 } | 570 } |
| 566 } | 571 } |
| 567 if (!m_scriptToEvaluateOnLoadOnce.isEmpty()) | 572 if (!m_scriptToEvaluateOnLoadOnce.isEmpty()) |
| 568 frame->script().executeScriptInMainWorld(m_scriptToEvaluateOnLoadOnce); | 573 frame->script().executeScriptInMainWorld(m_scriptToEvaluateOnLoadOnce); |
| 569 } | 574 } |
| 570 | 575 |
| 571 void InspectorPageAgent::domContentLoadedEventFired(LocalFrame* frame) | 576 void InspectorPageAgent::domContentLoadedEventFired(LocalFrame* frame) |
| 572 { | 577 { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 764 } | 769 } |
| 765 | 770 |
| 766 DEFINE_TRACE(InspectorPageAgent) | 771 DEFINE_TRACE(InspectorPageAgent) |
| 767 { | 772 { |
| 768 visitor->trace(m_inspectedFrames); | 773 visitor->trace(m_inspectedFrames); |
| 769 visitor->trace(m_inspectorResourceContentLoader); | 774 visitor->trace(m_inspectorResourceContentLoader); |
| 770 InspectorBaseAgent::trace(visitor); | 775 InspectorBaseAgent::trace(visitor); |
| 771 } | 776 } |
| 772 | 777 |
| 773 } // namespace blink | 778 } // namespace blink |
| OLD | NEW |