OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_THROTTLE_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_THROTTLE_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_THROTTLE_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_THROTTLE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 public: | 27 public: |
28 OfflineResourceThrottle(net::URLRequest* request, | 28 OfflineResourceThrottle(net::URLRequest* request, |
29 content::AppCacheService* appcache_service); | 29 content::AppCacheService* appcache_service); |
30 virtual ~OfflineResourceThrottle(); | 30 virtual ~OfflineResourceThrottle(); |
31 | 31 |
32 // content::ResourceThrottle implementation: | 32 // content::ResourceThrottle implementation: |
33 virtual void WillStartRequest(bool* defer) override; | 33 virtual void WillStartRequest(bool* defer) override; |
34 virtual const char* GetNameForLogging() const override; | 34 virtual const char* GetNameForLogging() const override; |
35 | 35 |
36 private: | 36 private: |
37 // OfflineLoadPage callback. | |
38 void OnBlockingPageComplete(bool proceed); | 37 void OnBlockingPageComplete(bool proceed); |
39 | |
40 // Erase the state associated with a deferred load request. | |
41 void ClearRequestInfo(); | 38 void ClearRequestInfo(); |
42 bool IsRemote(const GURL& url) const; | 39 bool IsRemote(const GURL& url) const; |
43 | |
44 // True if chrome should show the offline page. | |
45 bool ShouldShowOfflinePage(const GURL& url) const; | 40 bool ShouldShowOfflinePage(const GURL& url) const; |
46 | |
47 // A callback to tell if an appcache exists. | |
48 void OnCanHandleOfflineComplete(int rv); | 41 void OnCanHandleOfflineComplete(int rv); |
49 | 42 |
50 net::URLRequest* request_; | 43 net::URLRequest* request_; |
51 // Safe to keep a pointer around since AppCacheService outlives all requests. | 44 // Safe to keep a pointer around since AppCacheService outlives all requests. |
52 content::AppCacheService* appcache_service_; | 45 content::AppCacheService* appcache_service_; |
53 net::CancelableCompletionCallback appcache_completion_callback_; | 46 net::CancelableCompletionCallback completion_callback_; |
| 47 int pending_callbacks_; |
54 | 48 |
55 DISALLOW_COPY_AND_ASSIGN(OfflineResourceThrottle); | 49 DISALLOW_COPY_AND_ASSIGN(OfflineResourceThrottle); |
56 }; | 50 }; |
57 | 51 |
58 #endif // CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_THROTTLE_H_ | 52 #endif // CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_THROTTLE_H_ |
OLD | NEW |