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

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

Issue 20378: Reduce the amount of included header files. Vast change like in "Oh God! This... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // MimeSnifferProxy wraps an URLRequest to use mime_util's MIME 5 // MimeSnifferProxy wraps an URLRequest to use mime_util's MIME
6 // sniffer to better report the content's MIME type. 6 // sniffer to better report the content's MIME type.
7 // It only supports a subset of the URLRequest API, and must be used together 7 // It only supports a subset of the URLRequest API, and must be used together
8 // with an URLRequest. Their lifetimes should be the same. 8 // with an URLRequest. Their lifetimes should be the same.
9 // 9 //
10 // To use it, create a normal URLRequest and initialize it appropriately, 10 // To use it, create a normal URLRequest and initialize it appropriately,
11 // then insert a MimeSnifferProxy between your object and the URLRequest: 11 // then insert a MimeSnifferProxy between your object and the URLRequest:
12 // ms_.reset(new MimeSnifferProxy(url_request, this)); 12 // ms_.reset(new MimeSnifferProxy(url_request, this));
13 // It then proxies URLRequest delegate callbacks (from URLRequest back into 13 // It then proxies URLRequest delegate callbacks (from URLRequest back into
14 // your object) appropriately. 14 // your object) appropriately.
15 // 15 //
16 // For the other direction of calls (from your object to URLRequest), be sure 16 // For the other direction of calls (from your object to URLRequest), be sure
17 // to use two MimeSniffed functions in place of the URLRequest functions: 17 // to use two MimeSniffed functions in place of the URLRequest functions:
18 // 1) ms_->Read() -- just like URLRequest::Read() 18 // 1) ms_->Read() -- just like URLRequest::Read()
19 // 2) ms_->mime_type() -- returns the sniffed mime type of the data; 19 // 2) ms_->mime_type() -- returns the sniffed mime type of the data;
20 // valid after OnResponseStarted() is called. 20 // valid after OnResponseStarted() is called.
21 21
22 #ifndef NET_URL_REQUEST_MIME_SNIFFER_PROXY_H_ 22 #ifndef NET_URL_REQUEST_MIME_SNIFFER_PROXY_H_
23 #define NET_URL_REQUEST_MIME_SNIFFER_PROXY_H_ 23 #define NET_URL_REQUEST_MIME_SNIFFER_PROXY_H_
24 24
25 #include "net/base/io_buffer.h"
26 #include "net/url_request/url_request.h" 25 #include "net/url_request/url_request.h"
27 26
27 namespace net {
28 class IOBuffer;
29 }
30
28 class MimeSnifferProxy : public URLRequest::Delegate { 31 class MimeSnifferProxy : public URLRequest::Delegate {
29 public: 32 public:
30 // The constructor inserts this MimeSnifferProxy in between the URLRequest 33 // The constructor inserts this MimeSnifferProxy in between the URLRequest
31 // and the URLRequest::Delegate, so that the URLRequest's delegate callbacks 34 // and the URLRequest::Delegate, so that the URLRequest's delegate callbacks
32 // first go through the MimeSnifferProxy. 35 // first go through the MimeSnifferProxy.
33 MimeSnifferProxy(URLRequest* request, URLRequest::Delegate* delegate); 36 MimeSnifferProxy(URLRequest* request, URLRequest::Delegate* delegate);
34 37
35 // URLRequest::Delegate implementation. 38 // URLRequest::Delegate implementation.
36 // These first two functions are handled specially: 39 // These first two functions are handled specially:
37 virtual void OnResponseStarted(URLRequest* request); 40 virtual void OnResponseStarted(URLRequest* request);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // Whether we've encountered an error on our initial Read(). 75 // Whether we've encountered an error on our initial Read().
73 bool error_; 76 bool error_;
74 77
75 // A buffer for the first bit of the request. 78 // A buffer for the first bit of the request.
76 scoped_refptr<net::IOBuffer> buf_; 79 scoped_refptr<net::IOBuffer> buf_;
77 // The number of bytes we've read into the buffer. 80 // The number of bytes we've read into the buffer.
78 int bytes_read_; 81 int bytes_read_;
79 }; 82 };
80 83
81 #endif // NET_URL_REQUEST_MIME_SNIFFER_PROXY_H_ 84 #endif // NET_URL_REQUEST_MIME_SNIFFER_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698