1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_INFO_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_INFO_H_
7 
8 #include <stdint.h>
9 
10 #include <memory>
11 
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h"
14 #include "content/common/content_export.h"
15 #include "net/base/completion_once_callback.h"
16 #include "url/gurl.h"
17 
18 namespace net {
19 class HttpResponseInfo;
20 }
21 
22 namespace content {
23 
24 class AppCacheStorage;
25 
26 // Response info for a particular response id. Instances are tracked in
27 // the working set.
28 class CONTENT_EXPORT AppCacheResponseInfo
29     : public base::RefCounted<AppCacheResponseInfo> {
30  public:
31   AppCacheResponseInfo(base::WeakPtr<AppCacheStorage> storage,
32                        const GURL& manifest_url,
33                        int64_t response_id,
34                        std::unique_ptr<net::HttpResponseInfo> http_info,
35                        int64_t response_data_size);
36 
manifest_url()37   const GURL& manifest_url() const { return manifest_url_; }
response_id()38   int64_t response_id() const { return response_id_; }
http_response_info()39   const net::HttpResponseInfo& http_response_info() const {
40     return *http_response_info_;
41   }
response_data_size()42   int64_t response_data_size() const { return response_data_size_; }
43 
44  private:
45   friend class base::RefCounted<AppCacheResponseInfo>;
46   ~AppCacheResponseInfo();
47 
48   const GURL manifest_url_;
49   const int64_t response_id_;
50   const std::unique_ptr<net::HttpResponseInfo> http_response_info_;
51   const int64_t response_data_size_;
52   base::WeakPtr<AppCacheStorage> storage_;
53 };
54 
55 }  // namespace content
56 
57 #endif  // CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_INFO_H_
58