| 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_job.h" | 5 #include "net/url_request/url_request_job.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 9 #include "base/location.h" | 11 #include "base/location.h" |
| 10 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 11 #include "base/power_monitor/power_monitor.h" | 13 #include "base/power_monitor/power_monitor.h" |
| 12 #include "base/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" |
| 13 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 14 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 16 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 namespace net { | 32 namespace net { |
| 31 | 33 |
| 32 namespace { | 34 namespace { |
| 33 | 35 |
| 34 // Callback for TYPE_URL_REQUEST_FILTERS_SET net-internals event. | 36 // Callback for TYPE_URL_REQUEST_FILTERS_SET net-internals event. |
| 35 scoped_ptr<base::Value> FiltersSetCallback( | 37 scoped_ptr<base::Value> FiltersSetCallback( |
| 36 Filter* filter, | 38 Filter* filter, |
| 37 NetLogCaptureMode /* capture_mode */) { | 39 NetLogCaptureMode /* capture_mode */) { |
| 38 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); | 40 scoped_ptr<base::DictionaryValue> event_params(new base::DictionaryValue()); |
| 39 event_params->SetString("filters", filter->OrderedFilterList()); | 41 event_params->SetString("filters", filter->OrderedFilterList()); |
| 40 return event_params.Pass(); | 42 return std::move(event_params); |
| 41 } | 43 } |
| 42 | 44 |
| 43 std::string ComputeMethodForRedirect(const std::string& method, | 45 std::string ComputeMethodForRedirect(const std::string& method, |
| 44 int http_status_code) { | 46 int http_status_code) { |
| 45 // For 303 redirects, all request methods except HEAD are converted to GET, | 47 // For 303 redirects, all request methods except HEAD are converted to GET, |
| 46 // as per the latest httpbis draft. The draft also allows POST requests to | 48 // as per the latest httpbis draft. The draft also allows POST requests to |
| 47 // be converted to GETs when following 301/302 redirects, for historical | 49 // be converted to GETs when following 301/302 redirects, for historical |
| 48 // reasons. Most major browsers do this and so shall we. Both RFC 2616 and | 50 // reasons. Most major browsers do this and so shall we. Both RFC 2616 and |
| 49 // the httpbis draft say to prompt the user to confirm the generation of new | 51 // the httpbis draft say to prompt the user to confirm the generation of new |
| 50 // requests, other than GET and HEAD requests, but IE omits these prompts and | 52 // requests, other than GET and HEAD requests, but IE omits these prompts and |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 int64_t total_sent_bytes = GetTotalSentBytes(); | 961 int64_t total_sent_bytes = GetTotalSentBytes(); |
| 960 DCHECK_GE(total_sent_bytes, last_notified_total_sent_bytes_); | 962 DCHECK_GE(total_sent_bytes, last_notified_total_sent_bytes_); |
| 961 if (total_sent_bytes > last_notified_total_sent_bytes_) { | 963 if (total_sent_bytes > last_notified_total_sent_bytes_) { |
| 962 network_delegate_->NotifyNetworkBytesSent( | 964 network_delegate_->NotifyNetworkBytesSent( |
| 963 request_, total_sent_bytes - last_notified_total_sent_bytes_); | 965 request_, total_sent_bytes - last_notified_total_sent_bytes_); |
| 964 } | 966 } |
| 965 last_notified_total_sent_bytes_ = total_sent_bytes; | 967 last_notified_total_sent_bytes_ = total_sent_bytes; |
| 966 } | 968 } |
| 967 | 969 |
| 968 } // namespace net | 970 } // namespace net |
| OLD | NEW |