blob: 08827e19feb1b7aa58e099df1c181066f528578e [file] [log] [blame]
[email protected]646889822013-03-20 00:26:451// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "content/browser/loader/stream_resource_handler.h"
6
[email protected]646889822013-03-20 00:26:457#include "base/logging.h"
[email protected]646889822013-03-20 00:26:458
9namespace content {
10
[email protected]6a94bff2014-03-01 04:37:0911StreamResourceHandler::StreamResourceHandler(net::URLRequest* request,
12 StreamRegistry* registry,
13 const GURL& origin)
davidben61814fd2014-10-15 19:45:0714 : ResourceHandler(request) {
15 writer_.InitializeStream(registry, origin);
[email protected]646889822013-03-20 00:26:4516}
17
18StreamResourceHandler::~StreamResourceHandler() {
davidben61814fd2014-10-15 19:45:0719}
20
21void StreamResourceHandler::SetController(ResourceController* controller) {
22 writer_.set_controller(controller);
23 ResourceHandler::SetController(controller);
[email protected]646889822013-03-20 00:26:4524}
25
[email protected]d22e800e2014-05-28 21:55:5726bool StreamResourceHandler::OnUploadProgress(uint64 position,
[email protected]646889822013-03-20 00:26:4527 uint64 size) {
28 return true;
29}
30
[email protected]cba24642014-08-15 20:49:5931bool StreamResourceHandler::OnRequestRedirected(
32 const net::RedirectInfo& redirect_info,
33 ResourceResponse* resp,
34 bool* defer) {
[email protected]646889822013-03-20 00:26:4535 return true;
36}
37
[email protected]d22e800e2014-05-28 21:55:5738bool StreamResourceHandler::OnResponseStarted(ResourceResponse* resp,
[email protected]646889822013-03-20 00:26:4539 bool* defer) {
40 return true;
41}
42
[email protected]d22e800e2014-05-28 21:55:5743bool StreamResourceHandler::OnWillStart(const GURL& url, bool* defer) {
[email protected]646889822013-03-20 00:26:4544 return true;
45}
46
[email protected]d22e800e2014-05-28 21:55:5747bool StreamResourceHandler::OnBeforeNetworkStart(const GURL& url, bool* defer) {
[email protected]5584eab2014-01-09 22:16:1548 return true;
49}
50
[email protected]d22e800e2014-05-28 21:55:5751bool StreamResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
[email protected]646889822013-03-20 00:26:4552 int* buf_size,
53 int min_size) {
davidben61814fd2014-10-15 19:45:0754 writer_.OnWillRead(buf, buf_size, min_size);
[email protected]646889822013-03-20 00:26:4555 return true;
56}
57
[email protected]d22e800e2014-05-28 21:55:5758bool StreamResourceHandler::OnReadCompleted(int bytes_read, bool* defer) {
davidben61814fd2014-10-15 19:45:0759 writer_.OnReadCompleted(bytes_read, defer);
[email protected]646889822013-03-20 00:26:4560 return true;
61}
62
[email protected]3780874a2013-11-18 05:49:0363void StreamResourceHandler::OnResponseCompleted(
[email protected]646889822013-03-20 00:26:4564 const net::URLRequestStatus& status,
[email protected]3780874a2013-11-18 05:49:0365 const std::string& sec_info,
66 bool* defer) {
davidben61814fd2014-10-15 19:45:0767 writer_.Finalize();
[email protected]646889822013-03-20 00:26:4568}
69
[email protected]d22e800e2014-05-28 21:55:5770void StreamResourceHandler::OnDataDownloaded(int bytes_downloaded) {
[email protected]646889822013-03-20 00:26:4571 NOTREACHED();
72}
73
[email protected]646889822013-03-20 00:26:4574} // namespace content