| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_EVENT_DETAILS_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_EVENT_DETAILS_H_ |
| 6 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_EVENT_DETAILS_H_ | 6 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_EVENT_DETAILS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/gtest_prod_util.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "extensions/browser/extension_api_frame_id_map.h" | 15 #include "extensions/browser/extension_api_frame_id_map.h" |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 class AuthChallengeInfo; | 18 class AuthChallengeInfo; |
| 18 class HttpRequestHeaders; | 19 class HttpRequestHeaders; |
| 19 class HttpResponseHeaders; | 20 class HttpResponseHeaders; |
| 20 class URLRequest; | 21 class URLRequest; |
| 21 } | 22 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // Create an event dictionary that contains all required keys, and also the | 120 // Create an event dictionary that contains all required keys, and also the |
| 120 // extra keys as specified by the |extra_info_spec| filter. | 121 // extra keys as specified by the |extra_info_spec| filter. |
| 121 // This can be called from any thread. | 122 // This can be called from any thread. |
| 122 std::unique_ptr<base::DictionaryValue> GetFilteredDict( | 123 std::unique_ptr<base::DictionaryValue> GetFilteredDict( |
| 123 int extra_info_spec) const; | 124 int extra_info_spec) const; |
| 124 | 125 |
| 125 // Get the internal dictionary, unfiltered. After this call, the internal | 126 // Get the internal dictionary, unfiltered. After this call, the internal |
| 126 // dictionary is empty. | 127 // dictionary is empty. |
| 127 std::unique_ptr<base::DictionaryValue> GetAndClearDict(); | 128 std::unique_ptr<base::DictionaryValue> GetAndClearDict(); |
| 128 | 129 |
| 130 // Filters the data, leaving only whitelisted data for Public Session. |
| 131 void FilterForPublicSession(); |
| 132 |
| 129 private: | 133 private: |
| 134 FRIEND_TEST_ALL_PREFIXES( |
| 135 WebRequestEventDetailsTest, WhitelistedCopyForPublicSession); |
| 136 |
| 137 // Empty constructor used in unittests. |
| 138 WebRequestEventDetails(); |
| 139 |
| 130 void OnDeterminedFrameData( | 140 void OnDeterminedFrameData( |
| 131 std::unique_ptr<WebRequestEventDetails> self, | 141 std::unique_ptr<WebRequestEventDetails> self, |
| 132 const DeterminedFrameDataCallback& callback, | 142 const DeterminedFrameDataCallback& callback, |
| 133 const ExtensionApiFrameIdMap::FrameData& frame_data); | 143 const ExtensionApiFrameIdMap::FrameData& frame_data); |
| 134 | 144 |
| 135 // The details that are always included in a webRequest event object. | 145 // The details that are always included in a webRequest event object. |
| 136 base::DictionaryValue dict_; | 146 base::DictionaryValue dict_; |
| 137 | 147 |
| 138 // Extra event details: Only included when |extra_info_spec_| matches. | 148 // Extra event details: Only included when |extra_info_spec_| matches. |
| 139 std::unique_ptr<base::DictionaryValue> request_body_; | 149 std::unique_ptr<base::DictionaryValue> request_body_; |
| 140 std::unique_ptr<base::ListValue> request_headers_; | 150 std::unique_ptr<base::ListValue> request_headers_; |
| 141 std::unique_ptr<base::ListValue> response_headers_; | 151 std::unique_ptr<base::ListValue> response_headers_; |
| 142 | 152 |
| 143 int extra_info_spec_; | 153 int extra_info_spec_; |
| 144 | 154 |
| 145 // Used to determine the tabId, frameId and parentFrameId. | 155 // Used to determine the tabId, frameId and parentFrameId. |
| 146 int render_process_id_; | 156 int render_process_id_; |
| 147 int render_frame_id_; | 157 int render_frame_id_; |
| 148 | 158 |
| 149 DISALLOW_COPY_AND_ASSIGN(WebRequestEventDetails); | 159 DISALLOW_COPY_AND_ASSIGN(WebRequestEventDetails); |
| 150 }; | 160 }; |
| 151 | 161 |
| 152 } // namespace extensions | 162 } // namespace extensions |
| 153 | 163 |
| 154 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_EVENT_DETAILS_H_ | 164 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_EVENT_DETAILS_H_ |
| OLD | NEW |