Use multiline attribute to check for IA2_STATE_MULTILINE.
[chromium-blink-merge.git] / content / browser / loader / stream_resource_handler.h
blob4ec226e21e1841cf62145af03273c940e1837426
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.
5 #ifndef CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/browser/loader/resource_handler.h"
11 #include "content/browser/loader/stream_writer.h"
13 namespace net {
14 class URLRequest;
15 } // namespace net
17 namespace content {
19 class StreamRegistry;
21 // Redirect this resource to a stream.
22 class StreamResourceHandler : public ResourceHandler {
23 public:
24 // |origin| will be used to construct the URL for the Stream. See
25 // WebCore::BlobURL and and WebCore::SecurityOrigin in Blink to understand
26 // how origin check is done on resource loading.
27 StreamResourceHandler(net::URLRequest* request,
28 StreamRegistry* registry,
29 const GURL& origin);
30 ~StreamResourceHandler() override;
32 void SetController(ResourceController* controller) override;
34 bool OnUploadProgress(uint64 position, uint64 size) override;
36 // Not needed, as this event handler ought to be the final resource.
37 bool OnRequestRedirected(const net::RedirectInfo& redirect_info,
38 ResourceResponse* resp,
39 bool* defer) override;
41 bool OnResponseStarted(ResourceResponse* resp, bool* defer) override;
43 bool OnWillStart(const GURL& url, bool* defer) override;
45 bool OnBeforeNetworkStart(const GURL& url, bool* defer) override;
47 // Create a new buffer to store received data.
48 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf,
49 int* buf_size,
50 int min_size) override;
52 // A read was completed, forward the data to the Stream.
53 bool OnReadCompleted(int bytes_read, bool* defer) override;
55 void OnResponseCompleted(const net::URLRequestStatus& status,
56 const std::string& sec_info,
57 bool* defer) override;
59 void OnDataDownloaded(int bytes_downloaded) override;
61 Stream* stream() { return writer_.stream(); }
63 private:
64 StreamWriter writer_;
66 DISALLOW_COPY_AND_ASSIGN(StreamResourceHandler);
69 } // namespace content
71 #endif // CONTENT_BROWSER_LOADER_STREAM_RESOURCE_HANDLER_H_