| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 static const char resourceAgentEnabled[] = "resourceAgentEnabled"; | 75 static const char resourceAgentEnabled[] = "resourceAgentEnabled"; |
| 76 static const char extraRequestHeaders[] = "extraRequestHeaders"; | 76 static const char extraRequestHeaders[] = "extraRequestHeaders"; |
| 77 static const char cacheDisabled[] = "cacheDisabled"; | 77 static const char cacheDisabled[] = "cacheDisabled"; |
| 78 static const char userAgentOverride[] = "userAgentOverride"; | 78 static const char userAgentOverride[] = "userAgentOverride"; |
| 79 } | 79 } |
| 80 | 80 |
| 81 namespace { | 81 namespace { |
| 82 | 82 |
| 83 // Keep in sync with kDevToolsRequestInitiator defined in devtools_network_contr
oller.cc | 83 // Keep in sync with kDevToolsRequestInitiator defined in devtools_network_contr
oller.cc |
| 84 const char kDevToolsRequestInitiator[] = "X-DevTools-Request-Initiator"; | 84 const char kDevToolsRequestInitiator[] = "X-DevTools-Request-Initiator"; |
| 85 const char kDevToolsEmulateNetworkConditionsClientId[] = "X-DevTools-Emulate-Net
work-Conditions-Client-Id"; |
| 85 | 86 |
| 86 static PassRefPtr<JSONObject> buildObjectForHeaders(const HTTPHeaderMap& headers
) | 87 static PassRefPtr<JSONObject> buildObjectForHeaders(const HTTPHeaderMap& headers
) |
| 87 { | 88 { |
| 88 RefPtr<JSONObject> headersObject = JSONObject::create(); | 89 RefPtr<JSONObject> headersObject = JSONObject::create(); |
| 89 HTTPHeaderMap::const_iterator end = headers.end(); | 90 HTTPHeaderMap::const_iterator end = headers.end(); |
| 90 for (HTTPHeaderMap::const_iterator it = headers.begin(); it != end; ++it) | 91 for (HTTPHeaderMap::const_iterator it = headers.begin(); it != end; ++it) |
| 91 headersObject->setString(it->key.string(), it->value); | 92 headersObject->setString(it->key.string(), it->value); |
| 92 return headersObject; | 93 return headersObject; |
| 93 } | 94 } |
| 94 | 95 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 disable(&error); | 292 disable(&error); |
| 292 } | 293 } |
| 293 ASSERT(!m_instrumentingAgents->inspectorResourceAgent()); | 294 ASSERT(!m_instrumentingAgents->inspectorResourceAgent()); |
| 294 } | 295 } |
| 295 | 296 |
| 296 void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentL
oader* loader, ResourceRequest& request, const ResourceResponse& redirectRespons
e, const FetchInitiatorInfo& initiatorInfo) | 297 void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentL
oader* loader, ResourceRequest& request, const ResourceResponse& redirectRespons
e, const FetchInitiatorInfo& initiatorInfo) |
| 297 { | 298 { |
| 298 // Ignore the request initiated internally. | 299 // Ignore the request initiated internally. |
| 299 if (initiatorInfo.name == FetchInitiatorTypeNames::internal) | 300 if (initiatorInfo.name == FetchInitiatorTypeNames::internal) |
| 300 return; | 301 return; |
| 302 |
| 303 if (!m_hostId.isEmpty()) |
| 304 request.addHTTPHeaderField(kDevToolsEmulateNetworkConditionsClientId, At
omicString(m_hostId)); |
| 305 |
| 301 String requestId = IdentifiersFactory::requestId(identifier); | 306 String requestId = IdentifiersFactory::requestId(identifier); |
| 302 m_resourcesData->resourceCreated(requestId, m_pageAgent->loaderId(loader)); | 307 m_resourcesData->resourceCreated(requestId, m_pageAgent->loaderId(loader)); |
| 303 | 308 |
| 304 RefPtr<JSONObject> headers = m_state->getObject(ResourceAgentState::extraReq
uestHeaders); | 309 RefPtr<JSONObject> headers = m_state->getObject(ResourceAgentState::extraReq
uestHeaders); |
| 305 | 310 |
| 306 if (headers) { | 311 if (headers) { |
| 307 JSONObject::const_iterator end = headers->end(); | 312 JSONObject::const_iterator end = headers->end(); |
| 308 for (JSONObject::const_iterator it = headers->begin(); it != end; ++it)
{ | 313 for (JSONObject::const_iterator it = headers->begin(); it != end; ++it)
{ |
| 309 String value; | 314 String value; |
| 310 if (it->value->asString(&value)) | 315 if (it->value->asString(&value)) |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent) | 827 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent) |
| 823 : InspectorBaseAgent<InspectorResourceAgent>("Network") | 828 : InspectorBaseAgent<InspectorResourceAgent>("Network") |
| 824 , m_pageAgent(pageAgent) | 829 , m_pageAgent(pageAgent) |
| 825 , m_frontend(0) | 830 , m_frontend(0) |
| 826 , m_resourcesData(adoptPtr(new NetworkResourcesData())) | 831 , m_resourcesData(adoptPtr(new NetworkResourcesData())) |
| 827 , m_isRecalculatingStyle(false) | 832 , m_isRecalculatingStyle(false) |
| 828 { | 833 { |
| 829 } | 834 } |
| 830 | 835 |
| 831 } // namespace WebCore | 836 } // namespace WebCore |
| OLD | NEW |