Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: net/url_request/url_request_simple_job.h

Issue 104513002: Fixed playing video in component extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_
6 #define NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "net/base/completion_callback.h" 11 #include "net/base/completion_callback.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 #include "net/http/http_byte_range.h"
13 #include "net/url_request/url_request_job.h" 14 #include "net/url_request/url_request_job.h"
14 15
15 namespace net { 16 namespace net {
16 17
17 class URLRequest; 18 class URLRequest;
18 19
19 class NET_EXPORT URLRequestSimpleJob : public URLRequestJob { 20 class NET_EXPORT URLRequestSimpleJob : public URLRequestJob {
20 public: 21 public:
21 URLRequestSimpleJob(URLRequest* request, NetworkDelegate* network_delegate); 22 URLRequestSimpleJob(URLRequest* request, NetworkDelegate* network_delegate);
22 23
23 virtual void Start() OVERRIDE; 24 virtual void Start() OVERRIDE;
24 virtual bool ReadRawData(IOBuffer* buf, 25 virtual bool ReadRawData(IOBuffer* buf,
25 int buf_size, 26 int buf_size,
26 int *bytes_read) OVERRIDE; 27 int *bytes_read) OVERRIDE;
27 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; 28 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE;
28 virtual bool GetCharset(std::string* charset) OVERRIDE; 29 virtual bool GetCharset(std::string* charset) OVERRIDE;
30 virtual void SetExtraRequestHeaders(
31 const HttpRequestHeaders& headers) OVERRIDE;
29 32
30 protected: 33 protected:
31 virtual ~URLRequestSimpleJob(); 34 virtual ~URLRequestSimpleJob();
32 35
33 // Subclasses must override the way response data is determined. 36 // Subclasses must override the way response data is determined.
34 // The return value should be: 37 // The return value should be:
35 // - OK if data is obtained; 38 // - OK if data is obtained;
36 // - ERR_IO_PENDING if async processing is needed to finish obtaining data. 39 // - ERR_IO_PENDING if async processing is needed to finish obtaining data.
37 // This is the only case when |callback| should be called after 40 // This is the only case when |callback| should be called after
38 // completion of the operation. In other situations |callback| should 41 // completion of the operation. In other situations |callback| should
39 // never be called; 42 // never be called;
40 // - any other ERR_* code to indicate an error. This code will be used 43 // - any other ERR_* code to indicate an error. This code will be used
41 // as the error code in the URLRequestStatus when the URLRequest 44 // as the error code in the URLRequestStatus when the URLRequest
42 // is finished. 45 // is finished.
43 virtual int GetData(std::string* mime_type, 46 virtual int GetData(std::string* mime_type,
44 std::string* charset, 47 std::string* charset,
45 std::string* data, 48 std::string* data,
46 const CompletionCallback& callback) const = 0; 49 const CompletionCallback& callback) const = 0;
47 50
48 protected: 51 protected:
49 void StartAsync(); 52 void StartAsync();
50 53
51 private: 54 private:
52 void OnGetDataCompleted(int result); 55 void OnGetDataCompleted(int result);
53 56
57 HttpByteRange byte_range_;
54 std::string mime_type_; 58 std::string mime_type_;
55 std::string charset_; 59 std::string charset_;
56 std::string data_; 60 std::string data_;
57 int data_offset_; 61 int data_offset_;
58 base::WeakPtrFactory<URLRequestSimpleJob> weak_factory_; 62 base::WeakPtrFactory<URLRequestSimpleJob> weak_factory_;
59 }; 63 };
60 64
61 } // namespace net 65 } // namespace net
62 66
63 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ 67 #endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_
OLDNEW
« no previous file with comments | « no previous file | net/url_request/url_request_simple_job.cc » ('j') | net/url_request/url_request_simple_job.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698