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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp

Issue 1738073002: DevTools: introduce protocol::Value, baseline for hierarchical data in remote debugging protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "core/inspector/DOMPatchSupport.h" 52 #include "core/inspector/DOMPatchSupport.h"
53 #include "core/inspector/IdentifiersFactory.h" 53 #include "core/inspector/IdentifiersFactory.h"
54 #include "core/inspector/InspectedFrames.h" 54 #include "core/inspector/InspectedFrames.h"
55 #include "core/inspector/InspectorCSSAgent.h" 55 #include "core/inspector/InspectorCSSAgent.h"
56 #include "core/inspector/InspectorDebuggerAgent.h" 56 #include "core/inspector/InspectorDebuggerAgent.h"
57 #include "core/inspector/InspectorInstrumentation.h" 57 #include "core/inspector/InspectorInstrumentation.h"
58 #include "core/inspector/InspectorResourceContentLoader.h" 58 #include "core/inspector/InspectorResourceContentLoader.h"
59 #include "core/inspector/InstrumentingAgents.h" 59 #include "core/inspector/InstrumentingAgents.h"
60 #include "core/loader/DocumentLoader.h" 60 #include "core/loader/DocumentLoader.h"
61 #include "core/loader/FrameLoader.h" 61 #include "core/loader/FrameLoader.h"
62 #include "platform/JSONValues.h"
63 #include "platform/MIMETypeRegistry.h" 62 #include "platform/MIMETypeRegistry.h"
64 #include "platform/PlatformResourceLoader.h" 63 #include "platform/PlatformResourceLoader.h"
65 #include "platform/UserGestureIndicator.h" 64 #include "platform/UserGestureIndicator.h"
65 #include "platform/inspector_protocol/Values.h"
66 #include "platform/v8_inspector/public/V8ContentSearchUtil.h" 66 #include "platform/v8_inspector/public/V8ContentSearchUtil.h"
67 #include "platform/weborigin/SecurityOrigin.h" 67 #include "platform/weborigin/SecurityOrigin.h"
68 #include "wtf/CurrentTime.h" 68 #include "wtf/CurrentTime.h"
69 #include "wtf/ListHashSet.h" 69 #include "wtf/ListHashSet.h"
70 #include "wtf/Vector.h" 70 #include "wtf/Vector.h"
71 #include "wtf/text/Base64.h" 71 #include "wtf/text/Base64.h"
72 #include "wtf/text/TextEncoding.h" 72 #include "wtf/text/TextEncoding.h"
73 73
74 namespace blink { 74 namespace blink {
75 75
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 m_pendingScriptToEvaluateOnLoadOnce = String(); 381 m_pendingScriptToEvaluateOnLoadOnce = String();
382 m_instrumentingAgents->setInspectorPageAgent(0); 382 m_instrumentingAgents->setInspectorPageAgent(0);
383 383
384 stopScreencast(0); 384 stopScreencast(0);
385 385
386 finishReload(); 386 finishReload();
387 } 387 }
388 388
389 void InspectorPageAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& s ource, String* identifier) 389 void InspectorPageAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& s ource, String* identifier)
390 { 390 {
391 RefPtr<JSONObject> scripts = m_state->getObject(PageAgentState::pageAgentScr iptsToEvaluateOnLoad); 391 RefPtr<protocol::DictionaryValue> scripts = m_state->getObject(PageAgentStat e::pageAgentScriptsToEvaluateOnLoad);
392 if (!scripts) { 392 if (!scripts) {
393 scripts = JSONObject::create(); 393 scripts = protocol::DictionaryValue::create();
394 m_state->setObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad, scr ipts); 394 m_state->setObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad, scr ipts);
395 } 395 }
396 // Assure we don't override existing ids -- m_lastScriptIdentifier could get out of sync WRT actual 396 // Assure we don't override existing ids -- m_lastScriptIdentifier could get out of sync WRT actual
397 // scripts once we restored the scripts from the cookie during navigation. 397 // scripts once we restored the scripts from the cookie during navigation.
398 do { 398 do {
399 *identifier = String::number(++m_lastScriptIdentifier); 399 *identifier = String::number(++m_lastScriptIdentifier);
400 } while (scripts->find(*identifier) != scripts->end()); 400 } while (scripts->find(*identifier) != scripts->end());
401 scripts->setString(*identifier, source); 401 scripts->setString(*identifier, source);
402 } 402 }
403 403
404 void InspectorPageAgent::removeScriptToEvaluateOnLoad(ErrorString* error, const String& identifier) 404 void InspectorPageAgent::removeScriptToEvaluateOnLoad(ErrorString* error, const String& identifier)
405 { 405 {
406 RefPtr<JSONObject> scripts = m_state->getObject(PageAgentState::pageAgentScr iptsToEvaluateOnLoad); 406 RefPtr<protocol::DictionaryValue> scripts = m_state->getObject(PageAgentStat e::pageAgentScriptsToEvaluateOnLoad);
407 if (!scripts || scripts->find(identifier) == scripts->end()) { 407 if (!scripts || scripts->find(identifier) == scripts->end()) {
408 *error = "Script not found"; 408 *error = "Script not found";
409 return; 409 return;
410 } 410 }
411 scripts->remove(identifier); 411 scripts->remove(identifier);
412 } 412 }
413 413
414 void InspectorPageAgent::setAutoAttachToCreatedPages(ErrorString*, bool autoAtta ch) 414 void InspectorPageAgent::setAutoAttachToCreatedPages(ErrorString*, bool autoAtta ch)
415 { 415 {
416 m_state->setBoolean(PageAgentState::autoAttachToCreatedPages, autoAttach); 416 m_state->setBoolean(PageAgentState::autoAttachToCreatedPages, autoAttach);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 return; 582 return;
583 } 583 }
584 DOMPatchSupport::patchDocument(*document, html); 584 DOMPatchSupport::patchDocument(*document, html);
585 } 585 }
586 586
587 void InspectorPageAgent::didClearDocumentOfWindowObject(LocalFrame* frame) 587 void InspectorPageAgent::didClearDocumentOfWindowObject(LocalFrame* frame)
588 { 588 {
589 if (!frontend()) 589 if (!frontend())
590 return; 590 return;
591 591
592 RefPtr<JSONObject> scripts = m_state->getObject(PageAgentState::pageAgentScr iptsToEvaluateOnLoad); 592 RefPtr<protocol::DictionaryValue> scripts = m_state->getObject(PageAgentStat e::pageAgentScriptsToEvaluateOnLoad);
593 if (scripts) { 593 if (scripts) {
594 for (const auto& script : *scripts) { 594 for (const auto& script : *scripts) {
595 String scriptText; 595 String scriptText;
596 if (script.value->asString(&scriptText)) 596 if (script.value->asString(&scriptText))
597 frame->script().executeScriptInMainWorld(scriptText); 597 frame->script().executeScriptInMainWorld(scriptText);
598 } 598 }
599 } 599 }
600 if (!m_scriptToEvaluateOnLoadOnce.isEmpty()) 600 if (!m_scriptToEvaluateOnLoadOnce.isEmpty())
601 frame->script().executeScriptInMainWorld(m_scriptToEvaluateOnLoadOnce); 601 frame->script().executeScriptInMainWorld(m_scriptToEvaluateOnLoadOnce);
602 } 602 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 785
786 DEFINE_TRACE(InspectorPageAgent) 786 DEFINE_TRACE(InspectorPageAgent)
787 { 787 {
788 visitor->trace(m_inspectedFrames); 788 visitor->trace(m_inspectedFrames);
789 visitor->trace(m_debuggerAgent); 789 visitor->trace(m_debuggerAgent);
790 visitor->trace(m_inspectorResourceContentLoader); 790 visitor->trace(m_inspectorResourceContentLoader);
791 InspectorBaseAgent::trace(visitor); 791 InspectorBaseAgent::trace(visitor);
792 } 792 }
793 793
794 } // namespace blink 794 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698