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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 virtual base::Value* ToValue() const OVERRIDE { | 116 virtual base::Value* ToValue() const OVERRIDE { |
117 Value* parent = NetLogExtensionIdParameter::ToValue(); | 117 Value* parent = NetLogExtensionIdParameter::ToValue(); |
118 DCHECK(parent->IsType(Value::TYPE_DICTIONARY)); | 118 DCHECK(parent->IsType(Value::TYPE_DICTIONARY)); |
119 DictionaryValue* dict = static_cast<DictionaryValue*>(parent); | 119 DictionaryValue* dict = static_cast<DictionaryValue*>(parent); |
120 dict->Set("modified_headers", modified_headers_.DeepCopy()); | 120 dict->Set("modified_headers", modified_headers_.DeepCopy()); |
121 dict->Set("deleted_headers", deleted_headers_.DeepCopy()); | 121 dict->Set("deleted_headers", deleted_headers_.DeepCopy()); |
122 return dict; | 122 return dict; |
123 } | 123 } |
124 | 124 |
125 void DeletedHeader(const std::string& key) { | 125 void DeletedHeader(const std::string& key) { |
126 deleted_headers_.Append(Value::CreateStringValue(key)); | 126 deleted_headers_.Append(base::StringValue::New(key)); |
127 } | 127 } |
128 | 128 |
129 void ModifiedHeader(const std::string& key, const std::string& value) { | 129 void ModifiedHeader(const std::string& key, const std::string& value) { |
130 modified_headers_.Append(Value::CreateStringValue(key + ": " + value)); | 130 modified_headers_.Append(base::StringValue::New(key + ": " + value)); |
131 } | 131 } |
132 | 132 |
133 private: | 133 private: |
134 ListValue modified_headers_; | 134 ListValue modified_headers_; |
135 ListValue deleted_headers_; | 135 ListValue deleted_headers_; |
136 | 136 |
137 DISALLOW_COPY_AND_ASSIGN(NetLogModificationParameter); | 137 DISALLOW_COPY_AND_ASSIGN(NetLogModificationParameter); |
138 }; | 138 }; |
139 | 139 |
140 // Returns the frame ID as it will be passed to the extension: | 140 // Returns the frame ID as it will be passed to the extension: |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 header->SetString(keys::kHeaderNameKey, it.name()); | 230 header->SetString(keys::kHeaderNameKey, it.name()); |
231 header->SetString(keys::kHeaderValueKey, it.value()); | 231 header->SetString(keys::kHeaderValueKey, it.value()); |
232 headers_value->Append(header); | 232 headers_value->Append(header); |
233 } | 233 } |
234 return headers_value; | 234 return headers_value; |
235 } | 235 } |
236 | 236 |
237 // Creates a StringValue with the status line of |headers|. If |headers| is | 237 // Creates a StringValue with the status line of |headers|. If |headers| is |
238 // NULL, an empty string is returned. Ownership is passed to the caller. | 238 // NULL, an empty string is returned. Ownership is passed to the caller. |
239 StringValue* GetStatusLine(net::HttpResponseHeaders* headers) { | 239 StringValue* GetStatusLine(net::HttpResponseHeaders* headers) { |
240 return new StringValue(headers ? headers->GetStatusLine() : ""); | 240 return base::StringValue::New(headers ? headers->GetStatusLine() : ""); |
241 } | 241 } |
242 | 242 |
243 // Comparison operator that returns true if the extension that caused | 243 // Comparison operator that returns true if the extension that caused |
244 // |a| was installed after the extension that caused |b|. | 244 // |a| was installed after the extension that caused |b|. |
245 bool InDecreasingExtensionInstallationTimeOrder( | 245 bool InDecreasingExtensionInstallationTimeOrder( |
246 const linked_ptr<ExtensionWebRequestEventRouter::EventResponseDelta>& a, | 246 const linked_ptr<ExtensionWebRequestEventRouter::EventResponseDelta>& a, |
247 const linked_ptr<ExtensionWebRequestEventRouter::EventResponseDelta>& b) { | 247 const linked_ptr<ExtensionWebRequestEventRouter::EventResponseDelta>& b) { |
248 return a->extension_install_time > b->extension_install_time; | 248 return a->extension_install_time > b->extension_install_time; |
249 } | 249 } |
250 | 250 |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 } | 1461 } |
1462 } | 1462 } |
1463 } | 1463 } |
1464 | 1464 |
1465 ExtensionWebRequestEventRouter::GetInstance()->OnEventHandled( | 1465 ExtensionWebRequestEventRouter::GetInstance()->OnEventHandled( |
1466 profile(), extension_id(), event_name, sub_event_name, request_id, | 1466 profile(), extension_id(), event_name, sub_event_name, request_id, |
1467 response.release()); | 1467 response.release()); |
1468 | 1468 |
1469 return true; | 1469 return true; |
1470 } | 1470 } |
OLD | NEW |