summaryrefslogtreecommitdiffstats
path: root/content/browser/loader/stream_resource_handler.cc
blob: 08827e19feb1b7aa58e099df1c181066f528578e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/loader/stream_resource_handler.h"

#include "base/logging.h"

namespace content {

StreamResourceHandler::StreamResourceHandler(net::URLRequest* request,
                                             StreamRegistry* registry,
                                             const GURL& origin)
    : ResourceHandler(request) {
  writer_.InitializeStream(registry, origin);
}

StreamResourceHandler::~StreamResourceHandler() {
}

void StreamResourceHandler::SetController(ResourceController* controller) {
  writer_.set_controller(controller);
  ResourceHandler::SetController(controller);
}

bool StreamResourceHandler::OnUploadProgress(uint64 position,
                                             uint64 size) {
  return true;
}

bool StreamResourceHandler::OnRequestRedirected(
    const net::RedirectInfo& redirect_info,
    ResourceResponse* resp,
    bool* defer) {
  return true;
}

bool StreamResourceHandler::OnResponseStarted(ResourceResponse* resp,
                                              bool* defer) {
  return true;
}

bool StreamResourceHandler::OnWillStart(const GURL& url, bool* defer) {
  return true;
}

bool StreamResourceHandler::OnBeforeNetworkStart(const GURL& url, bool* defer) {
  return true;
}

bool StreamResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
                                       int* buf_size,
                                       int min_size) {
  writer_.OnWillRead(buf, buf_size, min_size);
  return true;
}

bool StreamResourceHandler::OnReadCompleted(int bytes_read, bool* defer) {
  writer_.OnReadCompleted(bytes_read, defer);
  return true;
}

void StreamResourceHandler::OnResponseCompleted(
    const net::URLRequestStatus& status,
    const std::string& sec_info,
    bool* defer) {
  writer_.Finalize();
}

void StreamResourceHandler::OnDataDownloaded(int bytes_downloaded) {
  NOTREACHED();
}

}  // namespace content