OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/extensions/extension_webrequest_api.h" | 5 #include "chrome/browser/extensions/extension_webrequest_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 154 } |
155 return headers_value; | 155 return headers_value; |
156 } | 156 } |
157 | 157 |
158 ListValue* GetRequestHeadersList(const net::HttpRequestHeaders* headers) { | 158 ListValue* GetRequestHeadersList(const net::HttpRequestHeaders* headers) { |
159 ListValue* headers_value = new ListValue(); | 159 ListValue* headers_value = new ListValue(); |
160 if (headers) { | 160 if (headers) { |
161 for (net::HttpRequestHeaders::Iterator it(*headers); it.GetNext(); ) { | 161 for (net::HttpRequestHeaders::Iterator it(*headers); it.GetNext(); ) { |
162 DictionaryValue* header = new DictionaryValue(); | 162 DictionaryValue* header = new DictionaryValue(); |
163 header->SetString(keys::kHeaderNameKey, it.name()); | 163 header->SetString(keys::kHeaderNameKey, it.name()); |
164 header->SetString(keys::kHeaderValueKey, it.name()); | 164 header->SetString(keys::kHeaderValueKey, it.value()); |
165 headers_value->Append(header); | 165 headers_value->Append(header); |
166 } | 166 } |
167 } | 167 } |
168 return headers_value; | 168 return headers_value; |
169 } | 169 } |
170 | 170 |
171 // Creates a StringValue with the status line of |headers|. If |headers| is | 171 // Creates a StringValue with the status line of |headers|. If |headers| is |
172 // NULL, an empty string is returned. Ownership is passed to the caller. | 172 // NULL, an empty string is returned. Ownership is passed to the caller. |
173 StringValue* GetStatusLine(net::HttpResponseHeaders* headers) { | 173 StringValue* GetStatusLine(net::HttpResponseHeaders* headers) { |
174 return new StringValue(headers ? headers->GetStatusLine() : ""); | 174 return new StringValue(headers ? headers->GetStatusLine() : ""); |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 | 1038 |
1039 BrowserThread::PostTask( | 1039 BrowserThread::PostTask( |
1040 BrowserThread::IO, FROM_HERE, | 1040 BrowserThread::IO, FROM_HERE, |
1041 NewRunnableFunction( | 1041 NewRunnableFunction( |
1042 &EventHandledOnIOThread, | 1042 &EventHandledOnIOThread, |
1043 profile()->GetRuntimeId(), extension_id(), | 1043 profile()->GetRuntimeId(), extension_id(), |
1044 event_name, sub_event_name, request_id, response.release())); | 1044 event_name, sub_event_name, request_id, response.release())); |
1045 | 1045 |
1046 return true; | 1046 return true; |
1047 } | 1047 } |
OLD | NEW |