Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / content / browser / loader / stream_resource_handler.cc
1 // 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
7 #include "base/logging.h"
8
9 namespace content {
10
11 StreamResourceHandler::StreamResourceHandler(net::URLRequest* request,
12                                              StreamRegistry* registry,
13                                              const GURL& origin)
14     : ResourceHandler(request) {
15   writer_.InitializeStream(registry, origin);
16 }
17
18 StreamResourceHandler::~StreamResourceHandler() {
19 }
20
21 void StreamResourceHandler::SetController(ResourceController* controller) {
22   writer_.set_controller(controller);
23   ResourceHandler::SetController(controller);
24 }
25
26 bool StreamResourceHandler::OnUploadProgress(uint64 position,
27                                              uint64 size) {
28   return true;
29 }
30
31 bool StreamResourceHandler::OnRequestRedirected(
32     const net::RedirectInfo& redirect_info,
33     ResourceResponse* resp,
34     bool* defer) {
35   return true;
36 }
37
38 bool StreamResourceHandler::OnResponseStarted(ResourceResponse* resp,
39                                               bool* defer) {
40   return true;
41 }
42
43 bool StreamResourceHandler::OnWillStart(const GURL& url, bool* defer) {
44   return true;
45 }
46
47 bool StreamResourceHandler::OnBeforeNetworkStart(const GURL& url, bool* defer) {
48   return true;
49 }
50
51 bool StreamResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
52                                        int* buf_size,
53                                        int min_size) {
54   writer_.OnWillRead(buf, buf_size, min_size);
55   return true;
56 }
57
58 bool StreamResourceHandler::OnReadCompleted(int bytes_read, bool* defer) {
59   writer_.OnReadCompleted(bytes_read, defer);
60   return true;
61 }
62
63 void StreamResourceHandler::OnResponseCompleted(
64     const net::URLRequestStatus& status,
65     const std::string& sec_info,
66     bool* defer) {
67   writer_.Finalize();
68 }
69
70 void StreamResourceHandler::OnDataDownloaded(int bytes_downloaded) {
71   NOTREACHED();
72 }
73
74 }  // namespace content