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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp

Issue 2692653003: [Devtools] Added Enable/Disable for request blocking in network (Closed)
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/chromium/src into ADD_ENABLE_DISABLE_REQ… Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
index 2e19a96985c0f1f76e5d9bf5782c8ffa0d3f4b02..053130cf54544e5b845c97c05533782a5edb3f74 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
@@ -1334,24 +1334,13 @@ void InspectorNetworkAgent::getResponseBody(
Response::Error("No data found for resource with given identifier"));
}
-Response InspectorNetworkAgent::addBlockedURL(const String& url) {
- protocol::DictionaryValue* blockedURLs =
- m_state->getObject(NetworkAgentState::blockedURLs);
- if (!blockedURLs) {
- std::unique_ptr<protocol::DictionaryValue> newList =
- protocol::DictionaryValue::create();
- blockedURLs = newList.get();
- m_state->setObject(NetworkAgentState::blockedURLs, std::move(newList));
- }
- blockedURLs->setBoolean(url, true);
- return Response::OK();
-}
-
-Response InspectorNetworkAgent::removeBlockedURL(const String& url) {
- protocol::DictionaryValue* blockedURLs =
- m_state->getObject(NetworkAgentState::blockedURLs);
- if (blockedURLs)
- blockedURLs->remove(url);
+Response InspectorNetworkAgent::setBlockedURLs(
+ std::unique_ptr<protocol::Array<String>> urls) {
+ std::unique_ptr<protocol::DictionaryValue> newList =
+ protocol::DictionaryValue::create();
+ for (size_t i = 0; i < urls->length(); i++)
+ newList->setBoolean(urls->get(i), true);
+ m_state->setObject(NetworkAgentState::blockedURLs, std::move(newList));
return Response::OK();
}

Powered by Google App Engine
This is Rietveld 408576698