From 3eb7a397449be2eda5f8ad5ad4436ad8377563c6 Mon Sep 17 00:00:00 2001 From: rob Date: Tue, 12 Jan 2016 12:48:40 -0800 Subject: WebRequest API cleanup Cleanup changes: - Moved the event dictionary generation logic to a new class (WebRequestEventDetails), to deduplicate logic and make it easier to manipulate the event details. - Remove some unused aliases, forward-declarations and includes. - Fixed a few typos. - Moved ExtraInfoSpec to web_request_api_helpers. - Remove ExtractRequestInfoDetails. - Solved TODOs from https://codereview.chromium.org/1413853005/ - Avoid unnecessary copying of event details (request body and headers, response headers). Previously these dictionaries were always copied and removed later, which is wasteful. Visible changes: - When a request has no response headers, the status code defaults to -1 (from URLRequestJob) instead of a dummy value of 200. This affects the webRequest.onResponseStarted and webRequest.onCompleted events for file: and ftp: requests. The new behavior is consistent with the webRequest.onBeforeRedirect event (which also reports -1 for unknown statuses). - requestBody is only included if set in extraInfoSpec (bug 542719). BUG=432875,542719 TEST=./browser_tests --gtest_filter=ExtensionWebRequestApiTest.* ./unit_tests --gtest_filter=ExtensionWebRequestTest.* Review URL: https://codereview.chromium.org/1577673002 Cr-Commit-Position: refs/heads/master@{#368979} --- extensions/extensions.gypi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'extensions/extensions.gypi') diff --git a/extensions/extensions.gypi b/extensions/extensions.gypi index b49e007..1900afd 100644 --- a/extensions/extensions.gypi +++ b/extensions/extensions.gypi @@ -498,6 +498,8 @@ 'browser/api/web_request/web_request_api_constants.h', 'browser/api/web_request/web_request_api_helpers.cc', 'browser/api/web_request/web_request_api_helpers.h', + 'browser/api/web_request/web_request_event_details.cc', + 'browser/api/web_request/web_request_event_details.h', 'browser/api/web_request/web_request_event_router_delegate.cc', 'browser/api/web_request/web_request_event_router_delegate.h', 'browser/api/web_request/web_request_permissions.cc', -- cgit v1.1