| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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/stream_resource_handler.h" | 5 #include "content/browser/loader/stream_resource_handler.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/browser/streams/stream.h" | 9 #include "content/browser/streams/stream.h" |
| 10 #include "content/browser/streams/stream_registry.h" | 10 #include "content/browser/streams/stream_registry.h" |
| 11 #include "content/public/browser/resource_controller.h" | 11 #include "content/public/browser/resource_controller.h" |
| 12 #include "content/public/common/url_constants.h" | 12 #include "content/public/common/url_constants.h" |
| 13 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 14 #include "net/url_request/url_request_status.h" | 14 #include "net/url_request/url_request_status.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 StreamResourceHandler::StreamResourceHandler( | 18 StreamResourceHandler::StreamResourceHandler( |
| 19 net::URLRequest* request, | 19 net::URLRequest* request, |
| 20 StreamRegistry* registry, | 20 StreamRegistry* registry, |
| 21 const GURL& security_origin) | 21 const GURL& origin) |
| 22 : request_(request), | 22 : request_(request), |
| 23 read_buffer_(NULL) { | 23 read_buffer_(NULL) { |
| 24 // TODO(zork): Find a way to share this with the blob URL creation in WebKit. | 24 // TODO(tyoshino): Find a way to share this with the blob URL creation in |
| 25 // WebKit. |
| 25 GURL url(std::string(chrome::kBlobScheme) + ":" + | 26 GURL url(std::string(chrome::kBlobScheme) + ":" + |
| 26 security_origin.spec() + base::GenerateGUID()); | 27 origin.spec() + base::GenerateGUID()); |
| 27 stream_ = new Stream(registry, this, security_origin, url); | 28 stream_ = new Stream(registry, this, url); |
| 28 } | 29 } |
| 29 | 30 |
| 30 StreamResourceHandler::~StreamResourceHandler() { | 31 StreamResourceHandler::~StreamResourceHandler() { |
| 31 stream_->RemoveWriteObserver(this); | 32 stream_->RemoveWriteObserver(this); |
| 32 } | 33 } |
| 33 | 34 |
| 34 bool StreamResourceHandler::OnUploadProgress(int request_id, | 35 bool StreamResourceHandler::OnUploadProgress(int request_id, |
| 35 uint64 position, | 36 uint64 position, |
| 36 uint64 size) { | 37 uint64 size) { |
| 37 return true; | 38 return true; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 109 |
| 109 void StreamResourceHandler::OnSpaceAvailable(Stream* stream) { | 110 void StreamResourceHandler::OnSpaceAvailable(Stream* stream) { |
| 110 controller()->Resume(); | 111 controller()->Resume(); |
| 111 } | 112 } |
| 112 | 113 |
| 113 void StreamResourceHandler::OnClose(Stream* stream) { | 114 void StreamResourceHandler::OnClose(Stream* stream) { |
| 114 controller()->Cancel(); | 115 controller()->Cancel(); |
| 115 } | 116 } |
| 116 | 117 |
| 117 } // namespace content | 118 } // namespace content |
| 118 | |
| OLD | NEW |