1 /*
   2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   3  */
   4 
   5 #pragma once
   6 
   7 #include "HTTPHeaderNames.h"
   8 #include "HTTPParsers.h"
   9 
  10 #include "ResourceResponseBase.h"
  11 
  12 namespace WebCore {
  13 
  14 class ResourceResponse : public ResourceResponseBase {
  15 public:
  16     ResourceResponse()
  17     {
  18     }
  19 
  20     ResourceResponse(const URL& url, const String& mimeType, long long expectedLength, const String& textEncodingName)
  21         : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName)
  22     {
  23     }
  24 
  25     bool isMovedPermanently() const
  26     {
  27         return httpStatusCode() == 301;
  28     }
  29 
  30     bool isFound() const
  31     {
  32         return httpStatusCode() == 302;
  33     }
  34 
  35     bool isSeeOther() const
  36     {
  37         return httpStatusCode() == 303;
  38     }
  39 
  40     bool isNotModified() const
  41     {
  42         return httpStatusCode() == 304;
  43     }
  44 
  45     bool isUnauthorized() const
  46     {
  47         return httpStatusCode() == 401;
  48     }
  49 
  50 private:
  51     friend class ResourceResponseBase;
  52 
  53     String platformSuggestedFilename() const
  54     {
  55         return filenameFromHTTPContentDisposition(httpHeaderField(HTTPHeaderName::ContentDisposition));
  56     }
  57 };
  58 
  59 } // namespace WebCore