| 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/public/common/resource_request.h" | 9 #include "content/public/common/resource_request.h" |
| 10 #include "content/public/common/resource_response.h" |
| 10 | 11 |
| 11 namespace content { | 12 namespace content { |
| 12 | 13 |
| 13 // AppCacheRequest wrapper for the ResourceRequest class for users of | 14 // AppCacheRequest wrapper for the ResourceRequest class for users of |
| 14 // URLLoader. | 15 // URLLoader. |
| 15 class CONTENT_EXPORT AppCacheURLLoaderRequest : public AppCacheRequest { | 16 class CONTENT_EXPORT AppCacheURLLoaderRequest : public AppCacheRequest { |
| 16 public: | 17 public: |
| 17 // Factory function to create an instance of the AppCacheResourceRequest | 18 // Factory function to create an instance of the AppCacheResourceRequest |
| 18 // class. | 19 // class. |
| 19 static std::unique_ptr<AppCacheURLLoaderRequest> Create( | 20 static std::unique_ptr<AppCacheURLLoaderRequest> Create( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 32 // TODO(ananta) | 33 // TODO(ananta) |
| 33 // ResourceRequest only identifies the request unlike URLRequest which | 34 // ResourceRequest only identifies the request unlike URLRequest which |
| 34 // contains response information as well. We need the following methods to | 35 // contains response information as well. We need the following methods to |
| 35 // work for AppCache. Look into this. | 36 // work for AppCache. Look into this. |
| 36 bool IsSuccess() const override; | 37 bool IsSuccess() const override; |
| 37 bool IsCancelled() const override; | 38 bool IsCancelled() const override; |
| 38 bool IsError() const override; | 39 bool IsError() const override; |
| 39 int GetResponseCode() const override; | 40 int GetResponseCode() const override; |
| 40 std::string GetResponseHeaderByName(const std::string& name) const override; | 41 std::string GetResponseHeaderByName(const std::string& name) const override; |
| 41 ResourceRequest* GetResourceRequest() override; | 42 ResourceRequest* GetResourceRequest() override; |
| 43 AppCacheURLLoaderRequest* AsURLLoaderRequest() override; |
| 44 |
| 45 void set_response(const ResourceResponseHead& response) { |
| 46 response_ = response; |
| 47 } |
| 42 | 48 |
| 43 protected: | 49 protected: |
| 44 explicit AppCacheURLLoaderRequest(const ResourceRequest& request); | 50 explicit AppCacheURLLoaderRequest(const ResourceRequest& request); |
| 45 | 51 |
| 46 private: | 52 private: |
| 47 ResourceRequest request_; | 53 ResourceRequest request_; |
| 54 ResourceResponseHead response_; |
| 48 | 55 |
| 49 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderRequest); | 56 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderRequest); |
| 50 }; | 57 }; |
| 51 | 58 |
| 52 } // namespace content | 59 } // namespace content |
| 53 | 60 |
| 54 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_REQUEST_H_ | 61 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_REQUEST_H_ |
| OLD | NEW |