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_JOB_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ |
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 class NetworkDelegate; | 18 class NetworkDelegate; |
19 class URLRequestJob; | 19 class URLRequestJob; |
20 } | 20 } |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 class AppCacheEntry; | 24 class AppCacheEntry; |
25 class AppCacheHost; | 25 class AppCacheHost; |
26 class AppCacheRequest; | 26 class AppCacheRequest; |
27 class AppCacheStorage; | 27 class AppCacheStorage; |
| 28 class AppCacheURLLoaderJob; |
28 class URLRequestJob; | 29 class URLRequestJob; |
29 | 30 |
30 // Interface for an AppCache job. This is used to send data stored in the | 31 // Interface for an AppCache job. This is used to send data stored in the |
31 // AppCache to networking consumers. | 32 // AppCache to networking consumers. |
32 // Subclasses implement this interface to wrap custom job objects like | 33 // Subclasses implement this interface to wrap custom job objects like |
33 // URLRequestJob, URLLoaderJob, etc to ensure that these dependencies stay out | 34 // URLRequestJob, URLLoaderJob, etc to ensure that these dependencies stay out |
34 // of the AppCache code. | 35 // of the AppCache code. |
35 class CONTENT_EXPORT AppCacheJob | 36 class CONTENT_EXPORT AppCacheJob |
36 : NON_EXPORTED_BASE(public base::NonThreadSafe), | 37 : NON_EXPORTED_BASE(public base::NonThreadSafe), |
37 public base::SupportsWeakPtr<AppCacheJob> { | 38 public base::SupportsWeakPtr<AppCacheJob> { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Informs the job that it should deliver an error response. | 94 // Informs the job that it should deliver an error response. |
94 virtual void DeliverErrorResponse() = 0; | 95 virtual void DeliverErrorResponse() = 0; |
95 | 96 |
96 // Returns a weak pointer reference to the job. | 97 // Returns a weak pointer reference to the job. |
97 virtual base::WeakPtr<AppCacheJob> GetWeakPtr(); | 98 virtual base::WeakPtr<AppCacheJob> GetWeakPtr(); |
98 | 99 |
99 // Returns the URL of the job. | 100 // Returns the URL of the job. |
100 virtual const GURL& GetURL() const = 0; | 101 virtual const GURL& GetURL() const = 0; |
101 | 102 |
102 // Returns the underlying URLRequestJob if any. This only applies to | 103 // Returns the underlying URLRequestJob if any. This only applies to |
| 104 // AppCaches loaded via the URLLoader mechanism. |
| 105 virtual net::URLRequestJob* AsURLRequestJob(); |
| 106 |
| 107 // Returns the underlying ApppCacheURLLoaderJob if any. This only applies to |
103 // AppCaches loaded via the URLRequest mechanism. | 108 // AppCaches loaded via the URLRequest mechanism. |
104 virtual net::URLRequestJob* AsURLRequestJob(); | 109 virtual AppCacheURLLoaderJob* AsURLLoaderJob(); |
105 | 110 |
106 protected: | 111 protected: |
107 AppCacheJob(); | 112 AppCacheJob(); |
108 | 113 |
109 base::WeakPtrFactory<AppCacheJob> weak_factory_; | 114 base::WeakPtrFactory<AppCacheJob> weak_factory_; |
110 | 115 |
111 DISALLOW_COPY_AND_ASSIGN(AppCacheJob); | 116 DISALLOW_COPY_AND_ASSIGN(AppCacheJob); |
112 }; | 117 }; |
113 | 118 |
114 } // namespace content | 119 } // namespace content |
115 | 120 |
116 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ | 121 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_JOB_H_ |
OLD | NEW |