| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 void NavigationResourceHandler::OnWillStart( | 150 void NavigationResourceHandler::OnWillStart( |
| 151 const GURL& url, | 151 const GURL& url, |
| 152 std::unique_ptr<ResourceController> controller) { | 152 std::unique_ptr<ResourceController> controller) { |
| 153 DCHECK(!has_controller()); | 153 DCHECK(!has_controller()); |
| 154 controller->Resume(); | 154 controller->Resume(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool NavigationResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 157 void NavigationResourceHandler::OnWillRead( |
| 158 int* buf_size) { | 158 scoped_refptr<net::IOBuffer>* buf, |
| 159 int* buf_size, |
| 160 std::unique_ptr<ResourceController> controller) { |
| 159 DCHECK(!has_controller()); | 161 DCHECK(!has_controller()); |
| 160 writer_.OnWillRead(buf, buf_size, -1); | 162 writer_.OnWillRead(buf, buf_size, -1); |
| 161 return true; | 163 controller->Resume(); |
| 162 } | 164 } |
| 163 | 165 |
| 164 void NavigationResourceHandler::OnReadCompleted( | 166 void NavigationResourceHandler::OnReadCompleted( |
| 165 int bytes_read, | 167 int bytes_read, |
| 166 std::unique_ptr<ResourceController> controller) { | 168 std::unique_ptr<ResourceController> controller) { |
| 167 DCHECK(!has_controller()); | 169 DCHECK(!has_controller()); |
| 168 writer_.OnReadCompleted(bytes_read, | 170 writer_.OnReadCompleted(bytes_read, |
| 169 base::Bind(&ResourceController::Resume, | 171 base::Bind(&ResourceController::Resume, |
| 170 base::Passed(std::move(controller)))); | 172 base::Passed(std::move(controller)))); |
| 171 } | 173 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 193 NOTREACHED(); | 195 NOTREACHED(); |
| 194 } | 196 } |
| 195 | 197 |
| 196 void NavigationResourceHandler::DetachFromCore() { | 198 void NavigationResourceHandler::DetachFromCore() { |
| 197 DCHECK(core_); | 199 DCHECK(core_); |
| 198 core_->set_resource_handler(nullptr); | 200 core_->set_resource_handler(nullptr); |
| 199 core_ = nullptr; | 201 core_ = nullptr; |
| 200 } | 202 } |
| 201 | 203 |
| 202 } // namespace content | 204 } // namespace content |
| OLD | NEW |