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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 return false; | 132 return false; |
133 } | 133 } |
134 | 134 |
135 static std::unique_ptr<protocol::Network::Headers> buildObjectForHeaders( | 135 static std::unique_ptr<protocol::Network::Headers> buildObjectForHeaders( |
136 const HTTPHeaderMap& headers) { | 136 const HTTPHeaderMap& headers) { |
137 std::unique_ptr<protocol::DictionaryValue> headersObject = | 137 std::unique_ptr<protocol::DictionaryValue> headersObject = |
138 protocol::DictionaryValue::create(); | 138 protocol::DictionaryValue::create(); |
139 for (const auto& header : headers) | 139 for (const auto& header : headers) |
140 headersObject->setString(header.key.getString(), header.value); | 140 headersObject->setString(header.key.getString(), header.value); |
141 protocol::ErrorSupport errors; | 141 protocol::ErrorSupport errors; |
142 return protocol::Network::Headers::parse(headersObject.get(), &errors); | 142 return protocol::Network::Headers::fromValue(headersObject.get(), &errors); |
143 } | 143 } |
144 | 144 |
145 class InspectorFileReaderLoaderClient final : public FileReaderLoaderClient { | 145 class InspectorFileReaderLoaderClient final : public FileReaderLoaderClient { |
146 WTF_MAKE_NONCOPYABLE(InspectorFileReaderLoaderClient); | 146 WTF_MAKE_NONCOPYABLE(InspectorFileReaderLoaderClient); |
147 | 147 |
148 public: | 148 public: |
149 InspectorFileReaderLoaderClient( | 149 InspectorFileReaderLoaderClient( |
150 PassRefPtr<BlobDataHandle> blob, | 150 PassRefPtr<BlobDataHandle> blob, |
151 const String& mimeType, | 151 const String& mimeType, |
152 const String& textEncodingName, | 152 const String& textEncodingName, |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 userAgent.contains('\0')) { | 1187 userAgent.contains('\0')) { |
1188 return Response::Error("Invalid characters found in userAgent"); | 1188 return Response::Error("Invalid characters found in userAgent"); |
1189 } | 1189 } |
1190 m_state->setString(NetworkAgentState::userAgentOverride, userAgent); | 1190 m_state->setString(NetworkAgentState::userAgentOverride, userAgent); |
1191 return Response::OK(); | 1191 return Response::OK(); |
1192 } | 1192 } |
1193 | 1193 |
1194 Response InspectorNetworkAgent::setExtraHTTPHeaders( | 1194 Response InspectorNetworkAgent::setExtraHTTPHeaders( |
1195 const std::unique_ptr<protocol::Network::Headers> headers) { | 1195 const std::unique_ptr<protocol::Network::Headers> headers) { |
1196 m_state->setObject(NetworkAgentState::extraRequestHeaders, | 1196 m_state->setObject(NetworkAgentState::extraRequestHeaders, |
1197 headers->serialize()); | 1197 headers->toValue()); |
1198 return Response::OK(); | 1198 return Response::OK(); |
1199 } | 1199 } |
1200 | 1200 |
1201 bool InspectorNetworkAgent::canGetResponseBodyBlob(const String& requestId) { | 1201 bool InspectorNetworkAgent::canGetResponseBodyBlob(const String& requestId) { |
1202 NetworkResourcesData::ResourceData const* resourceData = | 1202 NetworkResourcesData::ResourceData const* resourceData = |
1203 m_resourcesData->data(requestId); | 1203 m_resourcesData->data(requestId); |
1204 BlobDataHandle* blob = | 1204 BlobDataHandle* blob = |
1205 resourceData ? resourceData->downloadedFileBlob() : nullptr; | 1205 resourceData ? resourceData->downloadedFileBlob() : nullptr; |
1206 if (!blob) | 1206 if (!blob) |
1207 return false; | 1207 return false; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 m_isRecalculatingStyle(false), | 1471 m_isRecalculatingStyle(false), |
1472 m_removeFinishedReplayXHRTimer( | 1472 m_removeFinishedReplayXHRTimer( |
1473 this, | 1473 this, |
1474 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {} | 1474 &InspectorNetworkAgent::removeFinishedReplayXHRFired) {} |
1475 | 1475 |
1476 bool InspectorNetworkAgent::shouldForceCORSPreflight() { | 1476 bool InspectorNetworkAgent::shouldForceCORSPreflight() { |
1477 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); | 1477 return m_state->booleanProperty(NetworkAgentState::cacheDisabled, false); |
1478 } | 1478 } |
1479 | 1479 |
1480 } // namespace blink | 1480 } // namespace blink |
OLD | NEW |