summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 18:59:27 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 18:59:27 +0000
commit948df0de734128e56dbe7db400ed2def60132ca6 (patch)
treec07db43b16d092333a8cde856f0a47a0b80590fb
parent6edd4c2cb32943c5685f0ad0f17ba58731782169 (diff)
downloadchromium_src-948df0de734128e56dbe7db400ed2def60132ca6.zip
chromium_src-948df0de734128e56dbe7db400ed2def60132ca6.tar.gz
chromium_src-948df0de734128e56dbe7db400ed2def60132ca6.tar.bz2
Remove some unused files.
BUG=b/1483703 Review URL: http://codereview.chromium.org/132046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18929 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/net.gyp2
-rw-r--r--net/url_request/mime_sniffer_proxy.cc74
-rw-r--r--net/url_request/mime_sniffer_proxy.h84
3 files changed, 0 insertions, 160 deletions
diff --git a/net/net.gyp b/net/net.gyp
index e368e5f..798f2ac 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -279,8 +279,6 @@
'proxy/proxy_server.h',
'proxy/proxy_service.cc',
'proxy/proxy_service.h',
- 'url_request/mime_sniffer_proxy.cc',
- 'url_request/mime_sniffer_proxy.h',
'url_request/url_request.cc',
'url_request/url_request.h',
'url_request/url_request_about_job.cc',
diff --git a/net/url_request/mime_sniffer_proxy.cc b/net/url_request/mime_sniffer_proxy.cc
deleted file mode 100644
index 0e1d0e0..0000000
--- a/net/url_request/mime_sniffer_proxy.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/url_request/mime_sniffer_proxy.h"
-
-#include "net/base/io_buffer.h"
-#include "net/base/mime_sniffer.h"
-
-static const int kBufferSize = 1024;
-
-MimeSnifferProxy::MimeSnifferProxy(URLRequest* request,
- URLRequest::Delegate* delegate)
- : request_(request), delegate_(delegate),
- sniff_content_(false), error_(false),
- buf_(new net::IOBuffer(kBufferSize)) {
- request->set_delegate(this);
-}
-
-void MimeSnifferProxy::OnResponseStarted(URLRequest* request) {
- if (request->status().is_success()) {
- request->GetMimeType(&mime_type_);
- if (net::ShouldSniffMimeType(request->url(), mime_type_)) {
- // We need to read content before we know the mime type,
- // so we don't call OnResponseStarted.
- sniff_content_ = true;
- if (request_->Read(buf_, kBufferSize, &bytes_read_) && bytes_read_) {
- OnReadCompleted(request, bytes_read_);
- } else if (!request_->status().is_io_pending()) {
- error_ = true;
- delegate_->OnResponseStarted(request);
- } // Otherwise, IO pending. Wait for OnReadCompleted.
- return;
- }
- }
- delegate_->OnResponseStarted(request);
-}
-
-bool MimeSnifferProxy::Read(net::IOBuffer* buf, int max_bytes,
- int *bytes_read) {
- if (sniff_content_) {
- // This is the first call to Read() after we've sniffed content.
- // Return our local buffer or the error we ran into.
- sniff_content_ = false; // We're done with sniffing for this request.
-
- if (error_) {
- *bytes_read = 0;
- return false;
- }
-
- memcpy(buf->data(), buf_->data(), bytes_read_);
- *bytes_read = bytes_read_;
- return true;
- }
- return request_->Read(buf, max_bytes, bytes_read);
-}
-
-void MimeSnifferProxy::OnReadCompleted(URLRequest* request, int bytes_read) {
- if (sniff_content_) {
- // Our initial content-sniffing Read() has completed.
- if (request->status().is_success() && bytes_read) {
- std::string type_hint;
- request_->GetMimeType(&type_hint);
- bytes_read_ = bytes_read;
- net::SniffMimeType(buf_->data(), bytes_read_, request_->url(),
- type_hint, &mime_type_);
- } else {
- error_ = true;
- }
- delegate_->OnResponseStarted(request_);
- return;
- }
- delegate_->OnReadCompleted(request, bytes_read);
-}
diff --git a/net/url_request/mime_sniffer_proxy.h b/net/url_request/mime_sniffer_proxy.h
deleted file mode 100644
index 7d2eba8..0000000
--- a/net/url_request/mime_sniffer_proxy.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// MimeSnifferProxy wraps an URLRequest to use mime_util's MIME
-// sniffer to better report the content's MIME type.
-// It only supports a subset of the URLRequest API, and must be used together
-// with an URLRequest. Their lifetimes should be the same.
-//
-// To use it, create a normal URLRequest and initialize it appropriately,
-// then insert a MimeSnifferProxy between your object and the URLRequest:
-// ms_.reset(new MimeSnifferProxy(url_request, this));
-// It then proxies URLRequest delegate callbacks (from URLRequest back into
-// your object) appropriately.
-//
-// For the other direction of calls (from your object to URLRequest), be sure
-// to use two MimeSniffed functions in place of the URLRequest functions:
-// 1) ms_->Read() -- just like URLRequest::Read()
-// 2) ms_->mime_type() -- returns the sniffed mime type of the data;
-// valid after OnResponseStarted() is called.
-
-#ifndef NET_URL_REQUEST_MIME_SNIFFER_PROXY_H_
-#define NET_URL_REQUEST_MIME_SNIFFER_PROXY_H_
-
-#include "net/url_request/url_request.h"
-
-namespace net {
-class IOBuffer;
-}
-
-class MimeSnifferProxy : public URLRequest::Delegate {
- public:
- // The constructor inserts this MimeSnifferProxy in between the URLRequest
- // and the URLRequest::Delegate, so that the URLRequest's delegate callbacks
- // first go through the MimeSnifferProxy.
- MimeSnifferProxy(URLRequest* request, URLRequest::Delegate* delegate);
-
- // URLRequest::Delegate implementation.
- // These first two functions are handled specially:
- virtual void OnResponseStarted(URLRequest* request);
- virtual void OnReadCompleted(URLRequest* request, int bytes_read);
- // The remaining three just proxy directly to the delegate:
- virtual void OnReceivedRedirect(URLRequest* request,
- const GURL& new_url) {
- delegate_->OnReceivedRedirect(request, new_url);
- }
- virtual void OnAuthRequired(URLRequest* request,
- net::AuthChallengeInfo* auth_info) {
- delegate_->OnAuthRequired(request, auth_info);
- }
- virtual void OnSSLCertificateError(URLRequest* request,
- int cert_error,
- net::X509Certificate* cert) {
- delegate_->OnSSLCertificateError(request, cert_error, cert);
- }
-
- // Wrapper around URLRequest::Read.
- bool Read(net::IOBuffer* buf, int max_bytes, int *bytes_read);
-
- // Return the sniffed mime type of the request. Valid after
- // OnResponseStarted() has been called on the delegate.
- const std::string& mime_type() const { return mime_type_; }
-
- private:
- // The request underneath us.
- URLRequest* request_;
- // The delegate above us, that we're proxying the request to.
- URLRequest::Delegate* delegate_;
-
- // The (sniffed, if necessary) request mime type.
- std::string mime_type_;
-
- // Whether we're sniffing this request.
- bool sniff_content_;
- // Whether we've encountered an error on our initial Read().
- bool error_;
-
- // A buffer for the first bit of the request.
- scoped_refptr<net::IOBuffer> buf_;
- // The number of bytes we've read into the buffer.
- int bytes_read_;
-};
-
-#endif // NET_URL_REQUEST_MIME_SNIFFER_PROXY_H_