| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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 CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/sequence_checker.h" | 9 #include "base/sequence_checker.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 class URLRequest; | 15 class URLRequest; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 class AppCacheURLLoaderRequest; |
| 20 class AppCacheURLRequest; |
| 19 struct ResourceRequest; | 21 struct ResourceRequest; |
| 20 | 22 |
| 21 // Interface for an AppCache request. Subclasses implement this interface to | 23 // Interface for an AppCache request. Subclasses implement this interface to |
| 22 // wrap custom request objects like URLRequest, etc to ensure that these | 24 // wrap custom request objects like URLRequest, etc to ensure that these |
| 23 // dependencies stay out of the AppCache code. | 25 // dependencies stay out of the AppCache code. |
| 24 class CONTENT_EXPORT AppCacheRequest { | 26 class CONTENT_EXPORT AppCacheRequest { |
| 25 public: | 27 public: |
| 26 virtual ~AppCacheRequest(); | 28 virtual ~AppCacheRequest(); |
| 27 | 29 |
| 28 // The URL for this request. | 30 // The URL for this request. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 51 | 53 |
| 52 // Get response header(s) by name. Returns an empty string if the header | 54 // Get response header(s) by name. Returns an empty string if the header |
| 53 // wasn't found, | 55 // wasn't found, |
| 54 virtual std::string GetResponseHeaderByName( | 56 virtual std::string GetResponseHeaderByName( |
| 55 const std::string& name) const = 0; | 57 const std::string& name) const = 0; |
| 56 | 58 |
| 57 // Returns true if the scheme and method are supported for AppCache. | 59 // Returns true if the scheme and method are supported for AppCache. |
| 58 static bool IsSchemeAndMethodSupportedForAppCache( | 60 static bool IsSchemeAndMethodSupportedForAppCache( |
| 59 const AppCacheRequest* request); | 61 const AppCacheRequest* request); |
| 60 | 62 |
| 63 // Returns the underlying AppCacheURLRequest if any. This only applies to |
| 64 // AppCache requests loaded via the URLRequest mechanism |
| 65 virtual AppCacheURLRequest* AsURLRequest(); |
| 66 |
| 67 // Returns the underlying AppCacheURLLoaderRequest if any. This only applies |
| 68 // to AppCache requests loaded via the URLLoader mechanism. |
| 69 virtual AppCacheURLLoaderRequest* AsURLLoaderRequest(); |
| 70 |
| 61 protected: | 71 protected: |
| 62 friend class AppCacheRequestHandler; | 72 friend class AppCacheRequestHandler; |
| 63 // Enables the AppCacheJob to call GetURLRequest() and GetResourceRequest(). | 73 // Enables the AppCacheJob to call GetURLRequest() and GetResourceRequest(). |
| 64 friend class AppCacheJob; | 74 friend class AppCacheJob; |
| 65 | 75 |
| 66 AppCacheRequest() {} | 76 AppCacheRequest() {} |
| 67 | 77 |
| 68 // Getters for the request types we currently support. | 78 // Getters for the request types we currently support. |
| 69 virtual net::URLRequest* GetURLRequest(); | 79 virtual net::URLRequest* GetURLRequest(); |
| 70 | 80 |
| 71 // Returns the underlying ResourceRequest. Please note that only one of | 81 // Returns the underlying ResourceRequest. Please note that only one of |
| 72 // GetURLRequest() and GetResourceRequest() should return valid results. | 82 // GetURLRequest() and GetResourceRequest() should return valid results. |
| 73 virtual ResourceRequest* GetResourceRequest(); | 83 virtual ResourceRequest* GetResourceRequest(); |
| 74 | 84 |
| 75 SEQUENCE_CHECKER(sequence_checker_); | 85 SEQUENCE_CHECKER(sequence_checker_); |
| 76 | 86 |
| 77 DISALLOW_COPY_AND_ASSIGN(AppCacheRequest); | 87 DISALLOW_COPY_AND_ASSIGN(AppCacheRequest); |
| 78 }; | 88 }; |
| 79 | 89 |
| 80 } // namespace content | 90 } // namespace content |
| 81 | 91 |
| 82 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_H_ | 92 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_H_ |
| OLD | NEW |