| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/url_request/url_request_netlog_params.h" | 5 #include "net/url_request/url_request_netlog_params.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "net/log/net_log_capture_mode.h" | 11 #include "net/log/net_log_capture_mode.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 std::unique_ptr<base::Value> NetLogURLRequestConstructorCallback( |
| 17 const GURL* url, |
| 18 RequestPriority priority, |
| 19 NetLogCaptureMode /* capture_mode */) { |
| 20 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 21 dict->SetString("url", url->possibly_invalid_spec()); |
| 22 dict->SetString("priority", RequestPriorityToString(priority)); |
| 23 return std::move(dict); |
| 24 } |
| 25 |
| 16 std::unique_ptr<base::Value> NetLogURLRequestStartCallback( | 26 std::unique_ptr<base::Value> NetLogURLRequestStartCallback( |
| 17 const GURL* url, | 27 const GURL* url, |
| 18 const std::string* method, | 28 const std::string* method, |
| 19 int load_flags, | 29 int load_flags, |
| 20 RequestPriority priority, | |
| 21 int64_t upload_id, | 30 int64_t upload_id, |
| 22 NetLogCaptureMode /* capture_mode */) { | 31 NetLogCaptureMode /* capture_mode */) { |
| 23 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 32 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 24 dict->SetString("url", url->possibly_invalid_spec()); | 33 dict->SetString("url", url->possibly_invalid_spec()); |
| 25 dict->SetString("method", *method); | 34 dict->SetString("method", *method); |
| 26 dict->SetInteger("load_flags", load_flags); | 35 dict->SetInteger("load_flags", load_flags); |
| 27 dict->SetString("priority", RequestPriorityToString(priority)); | |
| 28 if (upload_id > -1) | 36 if (upload_id > -1) |
| 29 dict->SetString("upload_id", base::Int64ToString(upload_id)); | 37 dict->SetString("upload_id", base::Int64ToString(upload_id)); |
| 30 return std::move(dict); | 38 return std::move(dict); |
| 31 } | 39 } |
| 32 | 40 |
| 33 } // namespace net | 41 } // namespace net |
| OLD | NEW |