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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 { | 781 { |
782 RefPtr<TypeBuilder::Network::Initiator> initiator = buildInitiatorObject(fra
me->document(), FetchInitiatorInfo()); | 782 RefPtr<TypeBuilder::Network::Initiator> initiator = buildInitiatorObject(fra
me->document(), FetchInitiatorInfo()); |
783 m_frameNavigationInitiatorMap.set(m_pageAgent->frameId(frame), initiator); | 783 m_frameNavigationInitiatorMap.set(m_pageAgent->frameId(frame), initiator); |
784 } | 784 } |
785 | 785 |
786 void InspectorResourceAgent::frameClearedScheduledNavigation(LocalFrame* frame) | 786 void InspectorResourceAgent::frameClearedScheduledNavigation(LocalFrame* frame) |
787 { | 787 { |
788 m_frameNavigationInitiatorMap.remove(m_pageAgent->frameId(frame)); | 788 m_frameNavigationInitiatorMap.remove(m_pageAgent->frameId(frame)); |
789 } | 789 } |
790 | 790 |
791 bool InspectorResourceAgent::fetchResourceContent(LocalFrame* frame, const KURL&
url, String* content, bool* base64Encoded) | |
792 { | |
793 // First try to fetch content from the cached resource. | |
794 Resource* cachedResource = frame->document()->fetcher()->cachedResource(url)
; | |
795 if (!cachedResource) | |
796 cachedResource = memoryCache()->resourceForURL(url); | |
797 if (cachedResource && InspectorPageAgent::cachedResourceContent(cachedResour
ce, content, base64Encoded)) | |
798 return true; | |
799 | |
800 // Then fall back to resource data. | |
801 Vector<NetworkResourcesData::ResourceData*> resources = m_resourcesData->res
ources(); | |
802 for (Vector<NetworkResourcesData::ResourceData*>::iterator it = resources.be
gin(); it != resources.end(); ++it) { | |
803 if ((*it)->url() == url) { | |
804 *content = (*it)->content(); | |
805 *base64Encoded = (*it)->base64Encoded(); | |
806 return true; | |
807 } | |
808 } | |
809 return false; | |
810 } | |
811 | |
812 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent) | 791 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent) |
813 : InspectorBaseAgent<InspectorResourceAgent>("Network") | 792 : InspectorBaseAgent<InspectorResourceAgent>("Network") |
814 , m_pageAgent(pageAgent) | 793 , m_pageAgent(pageAgent) |
815 , m_frontend(0) | 794 , m_frontend(0) |
816 , m_resourcesData(adoptPtr(new NetworkResourcesData())) | 795 , m_resourcesData(adoptPtr(new NetworkResourcesData())) |
817 , m_isRecalculatingStyle(false) | 796 , m_isRecalculatingStyle(false) |
818 { | 797 { |
819 } | 798 } |
820 | 799 |
821 } // namespace WebCore | 800 } // namespace WebCore |
OLD | NEW |