[net] Remove logic for fixing up Gzip encoding type for downloads.

Some servers incorrectly send 'Content-Encoding: gzip' for responses
that should be downloaded as gzipped files. UMA indicates that the
number of servers that exhibit this incorrect behavior is vanishingly
small. Hence the network stack  will no longer perform this encoding
fixup.

What an embedder of the network stack does with a response often depends
on the response headers and the capabilities of the embedder. The
current implementation was based on an inaccurate prediction of the
inteded disposition of the response. In addition to the inaccuracy, the
implementation was also becoming a maintenance burden.

With this change, resources downloaded with the incorrect
Content-Encoding will be saved uncompressed.

BUG=318217

Review URL: https://codereview.chromium.org/1008873006

Cr-Commit-Position: refs/heads/master@{#321890}
diff --git a/net/base/filename_util_internal.h b/net/base/filename_util_internal.h
index 0e60334..d2e5dad 100644
--- a/net/base/filename_util_internal.h
+++ b/net/base/filename_util_internal.h
@@ -2,8 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// Functions used internally by filename_util, filename_util_icu and
-// filename_util_unsafe.
+// Functions used internally by filename_util, and filename_util_icu.
 
 #ifndef NET_BASE_FILENAME_UTIL_INTERNAL_H_
 #define NET_BASE_FILENAME_UTIL_INTERNAL_H_
diff --git a/net/base/filename_util_unsafe.cc b/net/base/filename_util_unsafe.cc
deleted file mode 100644
index 12e80dc..0000000
--- a/net/base/filename_util_unsafe.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2014 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/base/filename_util_unsafe.h"
-
-#include "base/bind.h"
-#include "base/strings/string_util.h"
-#include "net/base/filename_util_internal.h"
-
-namespace {
-
-// Local ICU-independent implementation of filename sanitizing functions defined
-// in base/i18n/file_util_icu.h. Does not require ICU because on POSIX systems
-// all international characters are considered legal, so only control and
-// special characters have to be replaced.
-const base::FilePath::CharType illegal_characters[] =
-    FILE_PATH_LITERAL("\"*/:<>?\\\\|\001\002\003\004\005\006\007\010\011\012")
-    FILE_PATH_LITERAL("\013\014\015\016\017\020\021\022\023\024\025\025\027");
-
-void ReplaceIllegalCharactersInPath(base::FilePath::StringType* file_name,
-                                    char replace_char) {
-  base::ReplaceChars(*file_name,
-                     illegal_characters,
-                     base::FilePath::StringType(1, replace_char),
-                     file_name);
-}
-
-}  // namespace
-
-namespace net {
-
-base::FilePath::StringType GenerateFileExtensionUnsafe(
-    const GURL& url,
-    const std::string& content_disposition,
-    const std::string& referrer_charset,
-    const std::string& suggested_name,
-    const std::string& mime_type,
-    const std::string& default_file_name) {
-  base::FilePath filepath =
-      GenerateFileNameImpl(url,
-                           content_disposition,
-                           referrer_charset,
-                           suggested_name,
-                           mime_type,
-                           default_file_name,
-                           base::Bind(&ReplaceIllegalCharactersInPath));
-  return filepath.Extension();
-}
-
-}  // namespace net
diff --git a/net/base/filename_util_unsafe.h b/net/base/filename_util_unsafe.h
deleted file mode 100644
index 5ca7d7b..0000000
--- a/net/base/filename_util_unsafe.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2014 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.
-
-#ifndef NET_BASE_FILENAME_UTIL_UNSAFE_H_
-#define NET_BASE_FILENAME_UTIL_UNSAFE_H_
-
-#include <string>
-
-#include "base/files/file_path.h"
-#include "base/strings/string16.h"
-#include "net/base/net_export.h"
-
-class GURL;
-
-namespace net {
-
-// Extract extension from FilePath generated by GenerateFileName(), but without
-// replacing illegal characters. Does not depend on ICU.
-NET_EXPORT base::FilePath::StringType GenerateFileExtensionUnsafe(
-    const GURL& url,
-    const std::string& content_disposition,
-    const std::string& referrer_charset,
-    const std::string& suggested_name,
-    const std::string& mime_type,
-    const std::string& default_name);
-
-}  // namespace net
-
-#endif  // NET_BASE_FILENAME_UTIL_UNSAFE_H_
diff --git a/net/filter/filter.cc b/net/filter/filter.cc
index af4e551..719737d 100644
--- a/net/filter/filter.cc
+++ b/net/filter/filter.cc
@@ -24,11 +24,8 @@
 #include "net/filter/filter.h"
 
 #include "base/files/file_path.h"
-#include "base/metrics/histogram_macros.h"
 #include "base/strings/string_util.h"
-#include "net/base/filename_util_unsafe.h"
 #include "net/base/io_buffer.h"
-#include "net/base/mime_util.h"
 #include "net/base/sdch_net_log_params.h"
 #include "net/filter/gzip_filter.h"
 #include "net/filter/sdch_filter.h"
@@ -49,9 +46,6 @@
 // more information, see Firefox's nsHttpChannel::ProcessNormal.
 
 // Mime types:
-const char kApplicationXGzip[]     = "application/x-gzip";
-const char kApplicationGzip[]      = "application/gzip";
-const char kApplicationXGunzip[]   = "application/x-gunzip";
 const char kTextHtml[]             = "text/html";
 
 // Buffer size allocated when de-compressing data.
@@ -204,32 +198,6 @@
   return type_id;
 }
 
-namespace {
-
-// Result of running FixupEncodingTypes with a Content-Encoding of gzip. This
-// enum is used for UMA and is available in histograms.xml as
-// GzipEncodingFixupResult.
-enum GzipEncodingFixupResult {
-  GZIP_ENCODING_LEFT_AS_IS = 0,
-
-  // Cleared because a resource with a GZIP MIME type was being transferred with
-  // a Content-Encoding of gzip.
-  GZIP_ENCODING_CLEARED_DUE_TO_GZIP_MIME_TYPE = 1,
-
-  // Cleared because the resource is known to be a download and the resulting
-  // file had a filename that indicating that the contents are GZIP.
-  GZIP_ENCODING_CLEARED_DUE_TO_DOWNLOAD_OF_GZIP_FILE = 2,
-
-  // Cleared because the resource is not a handled MIME type (and hence will be
-  // downloaded), and the predicted filename is one that indicates the contents
-  // to be GZIP.
-  GZIP_ENCODING_CLEARED_DUE_TO_UNHANDLED_GZIP_NAME = 3,
-
-  GZIP_ENCODING_FIXUP_RESULT_MAX_ENTRIES
-};
-
-}  // namespace
-
 // static
 void Filter::FixupEncodingTypes(
     const FilterContext& filter_context,
@@ -238,60 +206,6 @@
   bool success = filter_context.GetMimeType(&mime_type);
   DCHECK(success || mime_type.empty());
 
-  if ((1 == encoding_types->size()) &&
-      (FILTER_TYPE_GZIP == encoding_types->front())) {
-    GzipEncodingFixupResult fixup_result = GZIP_ENCODING_LEFT_AS_IS;
-    if (LowerCaseEqualsASCII(mime_type, kApplicationXGzip) ||
-        LowerCaseEqualsASCII(mime_type, kApplicationGzip) ||
-        LowerCaseEqualsASCII(mime_type, kApplicationXGunzip)) {
-      // The server has told us that it sent us gziped content with a gzip
-      // content encoding. Sadly, Apache mistakenly sets these headers for all
-      // .gz files. We match Firefox's nsHttpChannel::ProcessNormal and ignore
-      // the Content-Encoding here.
-      encoding_types->clear();
-      fixup_result = GZIP_ENCODING_CLEARED_DUE_TO_GZIP_MIME_TYPE;
-    }
-
-    GURL url;
-    std::string disposition;
-    success = filter_context.GetURL(&url);
-    DCHECK(success);
-    filter_context.GetContentDisposition(&disposition);
-    // Don't supply a MIME type here, since that may cause disk IO.
-    base::FilePath::StringType extension =
-        GenerateFileExtensionUnsafe(url, disposition, "UTF-8", "", "", "");
-
-    if (filter_context.IsDownload()) {
-      // We don't want to decompress gzipped files when the user explicitly
-      // asks to download them.
-      // For the case of svgz files, we use the extension to distinguish
-      // between svgz files and svg files compressed with gzip by the server.
-      // When viewing a .svgz file, we need to uncompress it, but we don't
-      // want to do that when downloading.
-      // See Firefox's nonDecodableExtensions in nsExternalHelperAppService.cpp
-      if (EndsWith(extension, FILE_PATH_LITERAL(".gz"), false) ||
-          LowerCaseEqualsASCII(extension, ".tgz") ||
-          LowerCaseEqualsASCII(extension, ".svgz")) {
-        encoding_types->clear();
-        fixup_result = GZIP_ENCODING_CLEARED_DUE_TO_DOWNLOAD_OF_GZIP_FILE;
-      }
-    } else {
-      // When the user does not explicitly ask to download a file, if we get a
-      // supported mime type, then we attempt to decompress in order to view it.
-      // However, if it's not a supported mime type, then we will attempt to
-      // download it, and in that case, don't decompress .gz/.tgz files.
-      if ((EndsWith(extension, FILE_PATH_LITERAL(".gz"), false) ||
-           LowerCaseEqualsASCII(extension, ".tgz")) &&
-          !IsSupportedMimeType(mime_type)) {
-        encoding_types->clear();
-        fixup_result = GZIP_ENCODING_CLEARED_DUE_TO_UNHANDLED_GZIP_NAME;
-      }
-    }
-
-    UMA_HISTOGRAM_ENUMERATION("Net.GzipEncodingFixupResult", fixup_result,
-                              GZIP_ENCODING_FIXUP_RESULT_MAX_ENTRIES);
-  }
-
   // If the request was for SDCH content, then we might need additional fixups.
   if (!filter_context.SdchDictionariesAdvertised()) {
     // It was not an SDCH request, so we'll just record stats.
diff --git a/net/filter/filter.h b/net/filter/filter.h
index 428dc8c..1904a8cd 100644
--- a/net/filter/filter.h
+++ b/net/filter/filter.h
@@ -102,19 +102,12 @@
   // Return false if gurl is not present.
   virtual bool GetURL(GURL* gurl) const = 0;
 
-  // What Content-Disposition header came with this data?
-  // Return false if no header was present.
-  virtual bool GetContentDisposition(std::string* disposition) const = 0;
-
   // When was this data requested from a server?
   virtual base::Time GetRequestTime() const = 0;
 
   // Is data supplied from cache, or fresh across the net?
   virtual bool IsCachedContent() const = 0;
 
-  // Is this a download?
-  virtual bool IsDownload() const = 0;
-
   // Was this data flagged as a response to a request with an SDCH dictionary?
   virtual SdchManager::DictionarySet* SdchDictionariesAdvertised() const = 0;
 
diff --git a/net/filter/filter_unittest.cc b/net/filter/filter_unittest.cc
index fcedeaf..d0441fab 100644
--- a/net/filter/filter_unittest.cc
+++ b/net/filter/filter_unittest.cc
@@ -48,70 +48,6 @@
             Filter::ConvertEncodingToType("strange"));
 }
 
-// Check various fixups that modify content encoding lists.
-TEST(FilterTest, ApacheGzip) {
-  MockFilterContext filter_context;
-  filter_context.SetSdchResponse(NULL);
-
-  // Check that redundant gzip mime type removes only solo gzip encoding.
-  const std::string kGzipMime1("application/x-gzip");
-  const std::string kGzipMime2("application/gzip");
-  const std::string kGzipMime3("application/x-gunzip");
-  std::vector<Filter::FilterType> encoding_types;
-
-  // First show it removes the gzip, given any gzip style mime type.
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetMimeType(kGzipMime1);
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  EXPECT_TRUE(encoding_types.empty());
-
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetMimeType(kGzipMime2);
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  EXPECT_TRUE(encoding_types.empty());
-
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetMimeType(kGzipMime3);
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  EXPECT_TRUE(encoding_types.empty());
-
-  // Check to be sure it doesn't remove everything when it has such a type.
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_SDCH);
-  filter_context.SetMimeType(kGzipMime1);
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(1U, encoding_types.size());
-  EXPECT_EQ(Filter::FILTER_TYPE_SDCH, encoding_types.front());
-
-  // Check to be sure that gzip can survive with other mime types.
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetMimeType("other/mime");
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(1U, encoding_types.size());
-  EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
-}
-
-TEST(FilterTest, GzipContentDispositionFilename) {
-  MockFilterContext filter_context;
-  filter_context.SetSdchResponse(NULL);
-
-  const std::string kGzipMime("application/x-tar");
-  const std::string kContentDisposition("attachment; filename=\"foo.tgz\"");
-  const std::string kURL("http://foo.com/getfoo.php");
-  std::vector<Filter::FilterType> encoding_types;
-
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetMimeType(kGzipMime);
-  filter_context.SetURL(GURL(kURL));
-  filter_context.SetContentDisposition(kContentDisposition);
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(0U, encoding_types.size());
-}
-
 TEST(FilterTest, SdchEncoding) {
   // Handle content encodings including SDCH.
   const std::string kTextHtmlMime("text/html");
@@ -189,195 +125,21 @@
   EXPECT_EQ(Filter::FILTER_TYPE_GZIP_HELPING_SDCH, encoding_types[1]);
 }
 
-TEST(FilterTest, Svgz) {
-  MockFilterContext filter_context;
-
-  // Check that svgz files are only decompressed when not downloading.
-  const std::string kSvgzMime("image/svg+xml");
-  const std::string kSvgzUrl("http://ignore.com/foo.svgz");
-  const std::string kSvgUrl("http://ignore.com/foo.svg");
-  std::vector<Filter::FilterType> encoding_types;
-
-  // Test svgz extension
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(false);
-  filter_context.SetMimeType(kSvgzMime);
-  filter_context.SetURL(GURL(kSvgzUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(1U, encoding_types.size());
-  EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
-
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(true);
-  filter_context.SetMimeType(kSvgzMime);
-  filter_context.SetURL(GURL(kSvgzUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  EXPECT_TRUE(encoding_types.empty());
-
-  // Test svg extension
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(false);
-  filter_context.SetMimeType(kSvgzMime);
-  filter_context.SetURL(GURL(kSvgUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(1U, encoding_types.size());
-  EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
-
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(true);
-  filter_context.SetMimeType(kSvgzMime);
-  filter_context.SetURL(GURL(kSvgUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(1U, encoding_types.size());
-  EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
-}
-
-TEST(FilterTest, UnsupportedMimeGzip) {
-  // From issue 8170 - handling files with Content-Encoding: x-gzip
+// FixupEncodingTypes() should leave gzip encoding intact.
+TEST(FilterTest, Gzip) {
+  const std::string kUrl("http://example.com/foo");
   MockFilterContext filter_context;
   std::vector<Filter::FilterType> encoding_types;
-  const std::string kTarMime("application/x-tar");
-  const std::string kCpioMime("application/x-cpio");
-  const std::string kTarUrl("http://ignore.com/foo.tar");
-  const std::string kTargzUrl("http://ignore.com/foo.tar.gz");
-  const std::string kTgzUrl("http://ignore.com/foo.tgz");
-  const std::string kBadTgzUrl("http://ignore.com/foo.targz");
-  const std::string kUrl("http://ignore.com/foo");
-
-  // Firefox 3 does not decompress when we have unsupported mime types for
-  // certain filenames.
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(false);
-  filter_context.SetMimeType(kTarMime);
-  filter_context.SetURL(GURL(kTargzUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  EXPECT_TRUE(encoding_types.empty());
-
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(false);
-  filter_context.SetMimeType(kTarMime);
-  filter_context.SetURL(GURL(kTgzUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  EXPECT_TRUE(encoding_types.empty());
-
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(false);
-  filter_context.SetMimeType(kCpioMime);
-  filter_context.SetURL(GURL(kTgzUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  EXPECT_TRUE(encoding_types.empty());
-
-  // Same behavior for downloads.
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(true);
-  filter_context.SetMimeType(kCpioMime);
-  filter_context.SetURL(GURL(kTgzUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  EXPECT_TRUE(encoding_types.empty());
-
-  // Unsupported mime type with wrong file name, decompressed.
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(false);
-  filter_context.SetMimeType(kTarMime);
   filter_context.SetURL(GURL(kUrl));
+
   Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(1U, encoding_types.size());
-  EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
+  EXPECT_EQ(0U, encoding_types.size());
 
   encoding_types.clear();
   encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(false);
-  filter_context.SetMimeType(kTarMime);
-  filter_context.SetURL(GURL(kTarUrl));
   Filter::FixupEncodingTypes(filter_context, &encoding_types);
   ASSERT_EQ(1U, encoding_types.size());
   EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
-
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(false);
-  filter_context.SetMimeType(kTarMime);
-  filter_context.SetURL(GURL(kBadTgzUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(1U, encoding_types.size());
-  EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
-
-  // Same behavior for downloads.
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(true);
-  filter_context.SetMimeType(kTarMime);
-  filter_context.SetURL(GURL(kBadTgzUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(1U, encoding_types.size());
-  EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
-}
-
-TEST(FilterTest, SupportedMimeGzip) {
-  // From issue 16430 - Files with supported mime types should be decompressed,
-  // even though these files end in .gz/.tgz.
-  MockFilterContext filter_context;
-  std::vector<Filter::FilterType> encoding_types;
-  const std::string kGzUrl("http://ignore.com/foo.gz");
-  const std::string kUrl("http://ignore.com/foo");
-  const std::string kHtmlMime("text/html");
-  const std::string kJavascriptMime("text/javascript");
-
-  // For files that does not end in .gz/.tgz, we always decompress.
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(false);
-  filter_context.SetMimeType(kHtmlMime);
-  filter_context.SetURL(GURL(kUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(1U, encoding_types.size());
-  EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
-
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(true);
-  filter_context.SetMimeType(kHtmlMime);
-  filter_context.SetURL(GURL(kUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(1U, encoding_types.size());
-  EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
-
-  // And also decompress files that end in .gz/.tgz.
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(false);
-  filter_context.SetMimeType(kHtmlMime);
-  filter_context.SetURL(GURL(kGzUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(1U, encoding_types.size());
-  EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
-
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(false);
-  filter_context.SetMimeType(kJavascriptMime);
-  filter_context.SetURL(GURL(kGzUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  ASSERT_EQ(1U, encoding_types.size());
-  EXPECT_EQ(Filter::FILTER_TYPE_GZIP, encoding_types.front());
-
-  // Except on downloads, where they just get saved.
-  encoding_types.clear();
-  encoding_types.push_back(Filter::FILTER_TYPE_GZIP);
-  filter_context.SetDownload(true);
-  filter_context.SetMimeType(kHtmlMime);
-  filter_context.SetURL(GURL(kGzUrl));
-  Filter::FixupEncodingTypes(filter_context, &encoding_types);
-  EXPECT_TRUE(encoding_types.empty());
 }
 
 // Make sure a series of three pass-through filters copies the data cleanly.
diff --git a/net/filter/mock_filter_context.cc b/net/filter/mock_filter_context.cc
index 67012de0..ebcaa18 100644
--- a/net/filter/mock_filter_context.cc
+++ b/net/filter/mock_filter_context.cc
@@ -10,7 +10,6 @@
 
 MockFilterContext::MockFilterContext()
     : is_cached_content_(false),
-      is_download_(false),
       ok_to_call_get_url_(true),
       response_code_(-1),
       context_(new URLRequestContext()) {
@@ -37,13 +36,6 @@
   return true;
 }
 
-bool MockFilterContext::GetContentDisposition(std::string* disposition) const {
-  if (content_disposition_.empty())
-    return false;
-  *disposition = content_disposition_;
-  return true;
-}
-
 // What was this data requested from a server?
 base::Time MockFilterContext::GetRequestTime() const {
   return request_time_;
@@ -51,8 +43,6 @@
 
 bool MockFilterContext::IsCachedContent() const { return is_cached_content_; }
 
-bool MockFilterContext::IsDownload() const { return is_download_; }
-
 SdchManager::DictionarySet*
 MockFilterContext::SdchDictionariesAdvertised() const {
   return dictionaries_handle_.get();
diff --git a/net/filter/mock_filter_context.h b/net/filter/mock_filter_context.h
index f66939da..1a55eb59 100644
--- a/net/filter/mock_filter_context.h
+++ b/net/filter/mock_filter_context.h
@@ -24,12 +24,8 @@
 
   void SetMimeType(const std::string& mime_type) { mime_type_ = mime_type; }
   void SetURL(const GURL& gurl) { gurl_ = gurl; }
-  void SetContentDisposition(const std::string& disposition) {
-    content_disposition_ = disposition;
-  }
   void SetRequestTime(const base::Time time) { request_time_ = time; }
   void SetCached(bool is_cached) { is_cached_content_ = is_cached; }
-  void SetDownload(bool is_download) { is_download_ = is_download; }
   void SetResponseCode(int response_code) { response_code_ = response_code; }
   void SetSdchResponse(scoped_ptr<SdchManager::DictionarySet> handle) {
     dictionaries_handle_ = handle.Pass();
@@ -49,19 +45,12 @@
   // Return false if gurl is not present.
   bool GetURL(GURL* gurl) const override;
 
-  // What Content-Disposition did the server supply for this data?
-  // Return false if Content-Disposition was not present.
-  bool GetContentDisposition(std::string* disposition) const override;
-
   // What was this data requested from a server?
   base::Time GetRequestTime() const override;
 
   // Is data supplied from cache, or fresh across the net?
   bool IsCachedContent() const override;
 
-  // Is this a download?
-  bool IsDownload() const override;
-
   // Handle to dictionaries advertised.
   SdchManager::DictionarySet* SdchDictionariesAdvertised() const override;
 
@@ -79,11 +68,9 @@
 
  private:
   std::string mime_type_;
-  std::string content_disposition_;
   GURL gurl_;
   base::Time request_time_;
   bool is_cached_content_;
-  bool is_download_;
   scoped_ptr<SdchManager::DictionarySet> dictionaries_handle_;
   bool ok_to_call_get_url_;
   int response_code_;
diff --git a/net/net.gypi b/net/net.gypi
index f790b84..bd58e35 100644
--- a/net/net.gypi
+++ b/net/net.gypi
@@ -216,8 +216,6 @@
       'base/filename_util.h',
       'base/filename_util_internal.cc',
       'base/filename_util_internal.h',
-      'base/filename_util_unsafe.cc',
-      'base/filename_util_unsafe.h',
       'base/host_mapping_rules.cc',
       'base/host_mapping_rules.h',
       'base/int128.cc',
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 728c44b7..28d3a5ac 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -62,10 +62,8 @@
   // FilterContext implementation.
   bool GetMimeType(std::string* mime_type) const override;
   bool GetURL(GURL* gurl) const override;
-  bool GetContentDisposition(std::string* disposition) const override;
   base::Time GetRequestTime() const override;
   bool IsCachedContent() const override;
-  bool IsDownload() const override;
   SdchManager::DictionarySet* SdchDictionariesAdvertised() const override;
   int64 GetByteReadCount() const override;
   int GetResponseCode() const override;
@@ -103,13 +101,6 @@
   return true;
 }
 
-bool URLRequestHttpJob::HttpFilterContext::GetContentDisposition(
-    std::string* disposition) const {
-  HttpResponseHeaders* headers = job_->GetResponseHeaders();
-  void *iter = NULL;
-  return headers->EnumerateHeader(&iter, "Content-Disposition", disposition);
-}
-
 base::Time URLRequestHttpJob::HttpFilterContext::GetRequestTime() const {
   return job_->request() ? job_->request()->request_time() : base::Time();
 }
@@ -118,10 +109,6 @@
   return job_->is_cached_content_;
 }
 
-bool URLRequestHttpJob::HttpFilterContext::IsDownload() const {
-  return (job_->request_info_.load_flags & LOAD_IS_DOWNLOAD) != 0;
-}
-
 SdchManager::DictionarySet*
 URLRequestHttpJob::HttpFilterContext::SdchDictionariesAdvertised() const {
   return job_->dictionaries_advertised_.get();
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index bc7a43e..4ee57330 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -17960,6 +17960,10 @@
 </histogram>
 
 <histogram name="Net.GzipEncodingFixupResult" enum="GzipEncodingFixupResult">
+  <obsolete>
+    Removed around 2015/03/18. The code which implemented Gzip encoding fixup
+    was removed.
+  </obsolete>
   <owner>asanka@chromium.org</owner>
   <summary>
     Resources are sometimes transferred with an incorrect encoding type of gzip.