| 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_URL_LOADER_REQUEST_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_REQUEST_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_REQUEST_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_REQUEST_H_ |
| 7 | 7 |
| 8 #include "content/browser/appcache/appcache_request.h" | 8 #include "content/browser/appcache/appcache_request.h" |
| 9 #include "content/common/resource_request.h" | 9 #include "content/common/resource_request.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 // AppCacheRequest wrapper for the ResourceRequest class for users of | 13 // AppCacheRequest wrapper for the ResourceRequest class for users of |
| 14 // URLLoader. | 14 // URLLoader. |
| 15 class CONTENT_EXPORT AppCacheURLLoaderRequest : public AppCacheRequest { | 15 class CONTENT_EXPORT AppCacheURLLoaderRequest : public AppCacheRequest { |
| 16 public: | 16 public: |
| 17 // Factory function to create an instance of the AppCacheResourceRequest | 17 // Factory function to create an instance of the AppCacheResourceRequest |
| 18 // class. | 18 // class. |
| 19 static std::unique_ptr<AppCacheURLLoaderRequest> Create( | 19 static std::unique_ptr<AppCacheURLLoaderRequest> Create( |
| 20 std::unique_ptr<ResourceRequest> request); | 20 const ResourceRequest& request); |
| 21 | 21 |
| 22 ~AppCacheURLLoaderRequest() override; | 22 ~AppCacheURLLoaderRequest() override; |
| 23 | 23 |
| 24 // AppCacheRequest overrides. | 24 // AppCacheRequest overrides. |
| 25 // TODO(ananta) | 25 // TODO(ananta) |
| 26 // Add support to the GetURL() call to return the updated URL while following | 26 // Add support to the GetURL() call to return the updated URL while following |
| 27 // a chain of redirects. | 27 // a chain of redirects. |
| 28 const GURL& GetURL() const override; | 28 const GURL& GetURL() const override; |
| 29 const std::string& GetMethod() const override; | 29 const std::string& GetMethod() const override; |
| 30 const GURL& GetFirstPartyForCookies() const override; | 30 const GURL& GetFirstPartyForCookies() const override; |
| 31 const GURL GetReferrer() const override; | 31 const GURL GetReferrer() const override; |
| 32 // TODO(ananta) | 32 // TODO(ananta) |
| 33 // ResourceRequest only identifies the request unlike URLRequest which | 33 // ResourceRequest only identifies the request unlike URLRequest which |
| 34 // contains response information as well. We need the following methods to | 34 // contains response information as well. We need the following methods to |
| 35 // work for AppCache. Look into this. | 35 // work for AppCache. Look into this. |
| 36 bool IsSuccess() const override; | 36 bool IsSuccess() const override; |
| 37 bool IsCancelled() const override; | 37 bool IsCancelled() const override; |
| 38 bool IsError() const override; | 38 bool IsError() const override; |
| 39 int GetResponseCode() const override; | 39 int GetResponseCode() const override; |
| 40 std::string GetResponseHeaderByName(const std::string& name) const override; | 40 std::string GetResponseHeaderByName(const std::string& name) const override; |
| 41 | |
| 42 ResourceRequest* GetResourceRequest() override; | 41 ResourceRequest* GetResourceRequest() override; |
| 43 | 42 |
| 44 protected: | 43 protected: |
| 45 explicit AppCacheURLLoaderRequest(std::unique_ptr<ResourceRequest> request); | 44 explicit AppCacheURLLoaderRequest(const ResourceRequest& request); |
| 46 | 45 |
| 47 private: | 46 private: |
| 48 std::unique_ptr<ResourceRequest> request_; | 47 ResourceRequest request_; |
| 49 | 48 |
| 50 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderRequest); | 49 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderRequest); |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 } // namespace content | 52 } // namespace content |
| 54 | 53 |
| 55 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_REQUEST_H_ | 54 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_REQUEST_H_ |
| OLD | NEW |