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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 255 } |
256 | 256 |
257 return decodeBuffer(data, size, textEncodingName, result); | 257 return decodeBuffer(data, size, textEncodingName, result); |
258 } | 258 } |
259 | 259 |
260 PassOwnPtrWillBeRawPtr<InspectorPageAgent> InspectorPageAgent::create(LocalFrame
* inspectedFrame, InspectorOverlay* overlay, InspectorResourceContentLoader* res
ourceContentLoader) | 260 PassOwnPtrWillBeRawPtr<InspectorPageAgent> InspectorPageAgent::create(LocalFrame
* inspectedFrame, InspectorOverlay* overlay, InspectorResourceContentLoader* res
ourceContentLoader) |
261 { | 261 { |
262 return adoptPtrWillBeNoop(new InspectorPageAgent(inspectedFrame, overlay, re
sourceContentLoader)); | 262 return adoptPtrWillBeNoop(new InspectorPageAgent(inspectedFrame, overlay, re
sourceContentLoader)); |
263 } | 263 } |
264 | 264 |
265 void InspectorPageAgent::setDeferredAgents(InspectorDebuggerAgent* debuggerAgent
, InspectorCSSAgent* cssAgent) | 265 void InspectorPageAgent::setDebuggerAgent(InspectorDebuggerAgent* debuggerAgent) |
266 { | 266 { |
267 ASSERT(!m_debuggerAgent && !m_cssAgent); | 267 ASSERT(!m_debuggerAgent); |
268 m_debuggerAgent = debuggerAgent; | 268 m_debuggerAgent = debuggerAgent; |
269 m_cssAgent = cssAgent; | |
270 } | 269 } |
271 | 270 |
272 Resource* InspectorPageAgent::cachedResource(LocalFrame* frame, const KURL& url) | 271 Resource* InspectorPageAgent::cachedResource(LocalFrame* frame, const KURL& url) |
273 { | 272 { |
274 Document* document = frame->document(); | 273 Document* document = frame->document(); |
275 if (!document) | 274 if (!document) |
276 return nullptr; | 275 return nullptr; |
277 Resource* cachedResource = document->fetcher()->cachedResource(url); | 276 Resource* cachedResource = document->fetcher()->cachedResource(url); |
278 if (!cachedResource) { | 277 if (!cachedResource) { |
279 Vector<Document*> allImports = InspectorPageAgent::importsForFrame(frame
); | 278 Vector<Document*> allImports = InspectorPageAgent::importsForFrame(frame
); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 347 |
349 TypeBuilder::Page::ResourceType::Enum InspectorPageAgent::cachedResourceTypeJson
(const Resource& cachedResource) | 348 TypeBuilder::Page::ResourceType::Enum InspectorPageAgent::cachedResourceTypeJson
(const Resource& cachedResource) |
350 { | 349 { |
351 return resourceTypeJson(cachedResourceType(cachedResource)); | 350 return resourceTypeJson(cachedResourceType(cachedResource)); |
352 } | 351 } |
353 | 352 |
354 InspectorPageAgent::InspectorPageAgent(LocalFrame* inspectedFrame, InspectorOver
lay* overlay, InspectorResourceContentLoader* resourceContentLoader) | 353 InspectorPageAgent::InspectorPageAgent(LocalFrame* inspectedFrame, InspectorOver
lay* overlay, InspectorResourceContentLoader* resourceContentLoader) |
355 : InspectorBaseAgent<InspectorPageAgent, InspectorFrontend::Page>("Page") | 354 : InspectorBaseAgent<InspectorPageAgent, InspectorFrontend::Page>("Page") |
356 , m_inspectedFrame(inspectedFrame) | 355 , m_inspectedFrame(inspectedFrame) |
357 , m_debuggerAgent(nullptr) | 356 , m_debuggerAgent(nullptr) |
358 , m_cssAgent(nullptr) | |
359 , m_overlay(overlay) | 357 , m_overlay(overlay) |
360 , m_lastScriptIdentifier(0) | 358 , m_lastScriptIdentifier(0) |
361 , m_enabled(false) | 359 , m_enabled(false) |
362 , m_reloading(false) | 360 , m_reloading(false) |
363 , m_inspectorResourceContentLoader(resourceContentLoader) | 361 , m_inspectorResourceContentLoader(resourceContentLoader) |
364 { | 362 { |
365 } | 363 } |
366 | 364 |
367 void InspectorPageAgent::restore() | 365 void InspectorPageAgent::restore() |
368 { | 366 { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 resourceContent(&errorString, frame, KURL(ParsedURLString, url), &content, &
base64Encoded); | 523 resourceContent(&errorString, frame, KURL(ParsedURLString, url), &content, &
base64Encoded); |
526 if (!errorString.isEmpty()) { | 524 if (!errorString.isEmpty()) { |
527 callback->sendFailure(errorString); | 525 callback->sendFailure(errorString); |
528 return; | 526 return; |
529 } | 527 } |
530 callback->sendSuccess(content, base64Encoded); | 528 callback->sendSuccess(content, base64Encoded); |
531 } | 529 } |
532 | 530 |
533 void InspectorPageAgent::getResourceContent(ErrorString* errorString, const Stri
ng& frameId, const String& url, PassRefPtrWillBeRawPtr<GetResourceContentCallbac
k> callback) | 531 void InspectorPageAgent::getResourceContent(ErrorString* errorString, const Stri
ng& frameId, const String& url, PassRefPtrWillBeRawPtr<GetResourceContentCallbac
k> callback) |
534 { | 532 { |
535 String content; | |
536 if (m_debuggerAgent->getEditedScript(url, &content) || m_cssAgent->getEdited
StyleSheet(url, &content)) { | |
537 callback->sendSuccess(content, false); | |
538 return; | |
539 } | |
540 if (!m_enabled) { | 533 if (!m_enabled) { |
541 callback->sendFailure("Agent is not enabled."); | 534 callback->sendFailure("Agent is not enabled."); |
542 return; | 535 return; |
543 } | 536 } |
544 m_inspectorResourceContentLoader->ensureResourcesContentLoaded(bind(&Inspect
orPageAgent::getResourceContentAfterResourcesContentLoaded, this, frameId, url,
callback)); | 537 m_inspectorResourceContentLoader->ensureResourcesContentLoaded(bind(&Inspect
orPageAgent::getResourceContentAfterResourcesContentLoaded, this, frameId, url,
callback)); |
545 } | 538 } |
546 | 539 |
547 static bool textContentForResource(Resource* cachedResource, String* result) | 540 static bool textContentForResource(Resource* cachedResource, String* result) |
548 { | 541 { |
549 if (hasTextContent(cachedResource)) { | 542 if (hasTextContent(cachedResource)) { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 | 809 |
817 void InspectorPageAgent::setOverlayMessage(ErrorString*, const String* message) | 810 void InspectorPageAgent::setOverlayMessage(ErrorString*, const String* message) |
818 { | 811 { |
819 m_overlay->setPausedInDebuggerMessage(message); | 812 m_overlay->setPausedInDebuggerMessage(message); |
820 } | 813 } |
821 | 814 |
822 DEFINE_TRACE(InspectorPageAgent) | 815 DEFINE_TRACE(InspectorPageAgent) |
823 { | 816 { |
824 visitor->trace(m_inspectedFrame); | 817 visitor->trace(m_inspectedFrame); |
825 visitor->trace(m_debuggerAgent); | 818 visitor->trace(m_debuggerAgent); |
826 visitor->trace(m_cssAgent); | |
827 visitor->trace(m_overlay); | 819 visitor->trace(m_overlay); |
828 visitor->trace(m_inspectorResourceContentLoader); | 820 visitor->trace(m_inspectorResourceContentLoader); |
829 InspectorBaseAgent::trace(visitor); | 821 InspectorBaseAgent::trace(visitor); |
830 } | 822 } |
831 | 823 |
832 } // namespace blink | 824 } // namespace blink |
OLD | NEW |