| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/loader/navigation_resource_handler.h" | 5 #include "content/browser/loader/navigation_resource_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/devtools/devtools_netlog_observer.h" | 8 #include "content/browser/devtools/devtools_netlog_observer.h" |
| 9 #include "content/browser/loader/navigation_url_loader_impl_core.h" | 9 #include "content/browser/loader/navigation_url_loader_impl_core.h" |
| 10 #include "content/browser/loader/resource_request_info_impl.h" | 10 #include "content/browser/loader/resource_request_info_impl.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response, | 66 bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response, |
| 67 bool* defer) { | 67 bool* defer) { |
| 68 DCHECK(core_); | 68 DCHECK(core_); |
| 69 | 69 |
| 70 ResourceRequestInfoImpl* info = GetRequestInfo(); | 70 ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 71 | 71 |
| 72 // If the MimeTypeResourceHandler intercepted this request and converted it | 72 // If the MimeTypeResourceHandler intercepted this request and converted it |
| 73 // into a download, it will still call OnResponseStarted and immediately | 73 // into a download, it will still call OnResponseStarted and immediately |
| 74 // cancel. Ignore the call; OnReadCompleted will happen shortly. | 74 // cancel. Ignore the call; OnResponseCompleted will happen shortly. |
| 75 // | 75 // |
| 76 // TODO(davidben): Move the dispatch out of MimeTypeResourceHandler. Perhaps | 76 // TODO(davidben): Move the dispatch out of MimeTypeResourceHandler. Perhaps |
| 77 // all the way to the UI thread. Downloads, user certificates, etc., should be | 77 // all the way to the UI thread. Downloads, user certificates, etc., should be |
| 78 // dispatched at the navigation layer. | 78 // dispatched at the navigation layer. |
| 79 if (info->IsDownload() || info->is_stream()) | 79 if (info->IsDownload() || info->is_stream()) |
| 80 return true; | 80 return true; |
| 81 | 81 |
| 82 StreamContext* stream_context = | 82 StreamContext* stream_context = |
| 83 GetStreamContextForResourceContext(info->GetContext()); | 83 GetStreamContextForResourceContext(info->GetContext()); |
| 84 writer_.InitializeStream(stream_context->registry(), | 84 writer_.InitializeStream(stream_context->registry(), |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 NOTREACHED(); | 138 NOTREACHED(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void NavigationResourceHandler::DetachFromCore() { | 141 void NavigationResourceHandler::DetachFromCore() { |
| 142 DCHECK(core_); | 142 DCHECK(core_); |
| 143 core_->set_resource_handler(nullptr); | 143 core_->set_resource_handler(nullptr); |
| 144 core_ = nullptr; | 144 core_ = nullptr; |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace content | 147 } // namespace content |
| OLD | NEW |