Use multiline attribute to check for IA2_STATE_MULTILINE.
[chromium-blink-merge.git] / content / browser / streams / stream_url_request_job.h
blob05c95515c16f267f63564db53892328da0c47db6
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_STREAMS_STREAM_URL_REQUEST_JOB_H_
6 #define CONTENT_BROWSER_STREAMS_STREAM_URL_REQUEST_JOB_H_
8 #include "net/http/http_status_code.h"
9 #include "net/url_request/url_request_job.h"
10 #include "content/browser/streams/stream_read_observer.h"
11 #include "content/common/content_export.h"
13 namespace content {
15 class Stream;
17 // A request job that handles reading stream URLs.
18 class CONTENT_EXPORT StreamURLRequestJob
19 : public net::URLRequestJob,
20 public StreamReadObserver {
21 public:
22 StreamURLRequestJob(net::URLRequest* request,
23 net::NetworkDelegate* network_delegate,
24 scoped_refptr<Stream> stream);
26 // StreamObserver methods.
27 void OnDataAvailable(Stream* stream) override;
29 // net::URLRequestJob methods.
30 void Start() override;
31 void Kill() override;
32 bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
33 bool GetMimeType(std::string* mime_type) const override;
34 void GetResponseInfo(net::HttpResponseInfo* info) override;
35 int GetResponseCode() const override;
36 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
38 protected:
39 ~StreamURLRequestJob() override;
41 private:
42 void DidStart();
43 void NotifyFailure(int);
44 void HeadersCompleted(net::HttpStatusCode status_code);
45 void ClearStream();
47 scoped_refptr<content::Stream> stream_;
48 bool headers_set_;
49 scoped_refptr<net::IOBuffer> pending_buffer_;
50 int pending_buffer_size_;
51 scoped_ptr<net::HttpResponseInfo> response_info_;
53 int total_bytes_read_;
54 int max_range_;
55 bool request_failed_;
57 base::WeakPtrFactory<StreamURLRequestJob> weak_factory_;
59 DISALLOW_COPY_AND_ASSIGN(StreamURLRequestJob);
62 } // namespace content
64 #endif // CONTENT_BROWSER_STREAMS_STREAM_URL_REQUEST_JOB_H_