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

Side by Side Diff: Source/core/inspector/InspectorResourceAgent.cpp

Issue 251183005: [4/4] Process clearBrowserCahce/cookies commands in browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « Source/core/inspector/InspectorResourceAgent.h ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 25 matching lines...) Expand all
36 #include "bindings/v8/ScriptCallStackFactory.h" 36 #include "bindings/v8/ScriptCallStackFactory.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/dom/ScriptableDocumentParser.h" 38 #include "core/dom/ScriptableDocumentParser.h"
39 #include "core/fetch/FetchInitiatorInfo.h" 39 #include "core/fetch/FetchInitiatorInfo.h"
40 #include "core/fetch/MemoryCache.h" 40 #include "core/fetch/MemoryCache.h"
41 #include "core/fetch/Resource.h" 41 #include "core/fetch/Resource.h"
42 #include "core/fetch/ResourceFetcher.h" 42 #include "core/fetch/ResourceFetcher.h"
43 #include "core/fetch/ResourceLoader.h" 43 #include "core/fetch/ResourceLoader.h"
44 #include "core/frame/LocalFrame.h" 44 #include "core/frame/LocalFrame.h"
45 #include "core/inspector/IdentifiersFactory.h" 45 #include "core/inspector/IdentifiersFactory.h"
46 #include "core/inspector/InspectorClient.h"
47 #include "core/inspector/InspectorOverlay.h" 46 #include "core/inspector/InspectorOverlay.h"
48 #include "core/inspector/InspectorPageAgent.h" 47 #include "core/inspector/InspectorPageAgent.h"
49 #include "core/inspector/InspectorState.h" 48 #include "core/inspector/InspectorState.h"
50 #include "core/inspector/InstrumentingAgents.h" 49 #include "core/inspector/InstrumentingAgents.h"
51 #include "core/inspector/NetworkResourcesData.h" 50 #include "core/inspector/NetworkResourcesData.h"
52 #include "core/inspector/ScriptCallStack.h" 51 #include "core/inspector/ScriptCallStack.h"
53 #include "core/loader/DocumentLoader.h" 52 #include "core/loader/DocumentLoader.h"
54 #include "core/loader/DocumentThreadableLoader.h" 53 #include "core/loader/DocumentThreadableLoader.h"
55 #include "core/loader/FrameLoader.h" 54 #include "core/loader/FrameLoader.h"
56 #include "core/loader/ThreadableLoader.h" 55 #include "core/loader/ThreadableLoader.h"
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 for (HTTPHeaderMap::const_iterator it = xhrReplayData->headers().begin(); it != end; ++it) 701 for (HTTPHeaderMap::const_iterator it = xhrReplayData->headers().begin(); it != end; ++it)
703 xhr->setRequestHeader(it->key, it->value, IGNORE_EXCEPTION); 702 xhr->setRequestHeader(it->key, it->value, IGNORE_EXCEPTION);
704 xhr->sendForInspectorXHRReplay(xhrReplayData->formData(), IGNORE_EXCEPTION); 703 xhr->sendForInspectorXHRReplay(xhrReplayData->formData(), IGNORE_EXCEPTION);
705 } 704 }
706 705
707 void InspectorResourceAgent::canClearBrowserCache(ErrorString*, bool* result) 706 void InspectorResourceAgent::canClearBrowserCache(ErrorString*, bool* result)
708 { 707 {
709 *result = true; 708 *result = true;
710 } 709 }
711 710
712 void InspectorResourceAgent::clearBrowserCache(ErrorString*)
713 {
714 m_client->clearBrowserCache();
715 }
716
717 void InspectorResourceAgent::canClearBrowserCookies(ErrorString*, bool* result) 711 void InspectorResourceAgent::canClearBrowserCookies(ErrorString*, bool* result)
718 { 712 {
719 *result = true; 713 *result = true;
720 } 714 }
721 715
722 void InspectorResourceAgent::clearBrowserCookies(ErrorString*)
723 {
724 m_client->clearBrowserCookies();
725 }
726
727 void InspectorResourceAgent::setCacheDisabled(ErrorString*, bool cacheDisabled) 716 void InspectorResourceAgent::setCacheDisabled(ErrorString*, bool cacheDisabled)
728 { 717 {
729 m_state->setBoolean(ResourceAgentState::cacheDisabled, cacheDisabled); 718 m_state->setBoolean(ResourceAgentState::cacheDisabled, cacheDisabled);
730 if (cacheDisabled) 719 if (cacheDisabled)
731 memoryCache()->evictResources(); 720 memoryCache()->evictResources();
732 for (LocalFrame* frame = m_pageAgent->mainFrame(); frame; frame = frame->tre e().traverseNext()) 721 for (LocalFrame* frame = m_pageAgent->mainFrame(); frame; frame = frame->tre e().traverseNext())
733 frame->document()->fetcher()->garbageCollectDocumentResources(); 722 frame->document()->fetcher()->garbageCollectDocumentResources();
734 } 723 }
735 724
736 void InspectorResourceAgent::loadResourceForFrontend(ErrorString* errorString, c onst String& frameId, const String& url, const RefPtr<JSONObject>* requestHeader s, PassRefPtr<LoadResourceForFrontendCallback> prpCallback) 725 void InspectorResourceAgent::loadResourceForFrontend(ErrorString* errorString, c onst String& frameId, const String& url, const RefPtr<JSONObject>* requestHeader s, PassRefPtr<LoadResourceForFrontendCallback> prpCallback)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 for (Vector<NetworkResourcesData::ResourceData*>::iterator it = resources.be gin(); it != resources.end(); ++it) { 802 for (Vector<NetworkResourcesData::ResourceData*>::iterator it = resources.be gin(); it != resources.end(); ++it) {
814 if ((*it)->url() == url) { 803 if ((*it)->url() == url) {
815 *content = (*it)->content(); 804 *content = (*it)->content();
816 *base64Encoded = (*it)->base64Encoded(); 805 *base64Encoded = (*it)->base64Encoded();
817 return true; 806 return true;
818 } 807 }
819 } 808 }
820 return false; 809 return false;
821 } 810 }
822 811
823 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent, In spectorClient* client) 812 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent)
824 : InspectorBaseAgent<InspectorResourceAgent>("Network") 813 : InspectorBaseAgent<InspectorResourceAgent>("Network")
825 , m_pageAgent(pageAgent) 814 , m_pageAgent(pageAgent)
826 , m_client(client)
827 , m_frontend(0) 815 , m_frontend(0)
828 , m_resourcesData(adoptPtr(new NetworkResourcesData())) 816 , m_resourcesData(adoptPtr(new NetworkResourcesData()))
829 , m_isRecalculatingStyle(false) 817 , m_isRecalculatingStyle(false)
830 { 818 {
831 } 819 }
832 820
833 } // namespace WebCore 821 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorResourceAgent.h ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698