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 #ifndef CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/browser/loader/resource_handler.h" | 10 #include "content/browser/loader/resource_handler.h" |
11 #include "content/browser/streams/stream_write_observer.h" | 11 #include "content/browser/streams/stream_write_observer.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 class URLRequest; | 15 class URLRequest; |
16 } // namespace net | 16 } // namespace net |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class StreamRegistry; | 20 class StreamRegistry; |
21 | 21 |
22 // Redirect this resource to a stream. | 22 // Redirect this resource to a stream. |
23 class StreamResourceHandler : public StreamWriteObserver, | 23 class StreamResourceHandler : public StreamWriteObserver, |
24 public ResourceHandler { | 24 public ResourceHandler { |
25 public: | 25 public: |
| 26 // |origin| will be used to construct the URL for the Stream. See |
| 27 // WebCore::BlobURL and and WebCore::SecurityOrigin in Blink to understand |
| 28 // how origin check is done on resource loading. |
26 StreamResourceHandler(net::URLRequest* request, | 29 StreamResourceHandler(net::URLRequest* request, |
27 StreamRegistry* registry, | 30 StreamRegistry* registry, |
28 const GURL& security_origin); | 31 const GURL& origin); |
29 virtual ~StreamResourceHandler(); | 32 virtual ~StreamResourceHandler(); |
30 | 33 |
31 virtual bool OnUploadProgress(int request_id, | 34 virtual bool OnUploadProgress(int request_id, |
32 uint64 position, | 35 uint64 position, |
33 uint64 size) OVERRIDE; | 36 uint64 size) OVERRIDE; |
34 | 37 |
35 // Not needed, as this event handler ought to be the final resource. | 38 // Not needed, as this event handler ought to be the final resource. |
36 virtual bool OnRequestRedirected(int request_id, | 39 virtual bool OnRequestRedirected(int request_id, |
37 const GURL& url, | 40 const GURL& url, |
38 ResourceResponse* resp, | 41 ResourceResponse* resp, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 74 |
72 net::URLRequest* request_; | 75 net::URLRequest* request_; |
73 scoped_refptr<Stream> stream_; | 76 scoped_refptr<Stream> stream_; |
74 scoped_refptr<net::IOBuffer> read_buffer_; | 77 scoped_refptr<net::IOBuffer> read_buffer_; |
75 DISALLOW_COPY_AND_ASSIGN(StreamResourceHandler); | 78 DISALLOW_COPY_AND_ASSIGN(StreamResourceHandler); |
76 }; | 79 }; |
77 | 80 |
78 } // namespace content | 81 } // namespace content |
79 | 82 |
80 #endif // CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_ | 83 #endif // CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_ |
81 | |
OLD | NEW |