| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_HANDLER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "chrome/browser/chromeos/offline/offline_load_page.h" | 12 #include "chrome/browser/chromeos/offline/offline_load_page.h" |
| 13 #include "content/browser/renderer_host/resource_handler.h" | 13 #include "content/browser/renderer_host/resource_handler.h" |
| 14 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
| 15 | 15 |
| 16 class ChromeAppCacheService; |
| 16 class MessageLoop; | 17 class MessageLoop; |
| 17 class ResourceDispatcherHost; | 18 class ResourceDispatcherHost; |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 class URLRequest; | 21 class URLRequest; |
| 21 } // namespace net | 22 } // namespace net |
| 22 | 23 |
| 23 // Used to show an offline interstitial page when the network is not available. | 24 // Used to show an offline interstitial page when the network is not available. |
| 24 class OfflineResourceHandler : public ResourceHandler, | 25 class OfflineResourceHandler : public ResourceHandler, |
| 25 public chromeos::OfflineLoadPage::Delegate { | 26 public chromeos::OfflineLoadPage::Delegate { |
| 26 public: | 27 public: |
| 27 OfflineResourceHandler(ResourceHandler* handler, | 28 OfflineResourceHandler(ResourceHandler* handler, |
| 28 int host_id, | 29 int host_id, |
| 29 int render_view_id, | 30 int render_view_id, |
| 30 ResourceDispatcherHost* rdh, | 31 ResourceDispatcherHost* rdh, |
| 31 net::URLRequest* request); | 32 net::URLRequest* request, |
| 33 ChromeAppCacheService* appcache_service); |
| 32 virtual ~OfflineResourceHandler(); | 34 virtual ~OfflineResourceHandler(); |
| 33 | 35 |
| 34 // ResourceHandler implementation: | 36 // ResourceHandler implementation: |
| 35 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); | 37 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); |
| 36 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, | 38 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, |
| 37 ResourceResponse* response, bool* defer); | 39 ResourceResponse* response, bool* defer); |
| 38 virtual bool OnResponseStarted(int request_id, ResourceResponse* response); | 40 virtual bool OnResponseStarted(int request_id, ResourceResponse* response); |
| 39 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); | 41 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); |
| 40 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 42 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
| 41 int min_size); | 43 int min_size); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 64 | 66 |
| 65 // A callback to tell if an appcache exists. | 67 // A callback to tell if an appcache exists. |
| 66 void OnCanHandleOfflineComplete(int rv); | 68 void OnCanHandleOfflineComplete(int rv); |
| 67 | 69 |
| 68 scoped_refptr<ResourceHandler> next_handler_; | 70 scoped_refptr<ResourceHandler> next_handler_; |
| 69 | 71 |
| 70 int process_host_id_; | 72 int process_host_id_; |
| 71 int render_view_id_; | 73 int render_view_id_; |
| 72 ResourceDispatcherHost* rdh_; | 74 ResourceDispatcherHost* rdh_; |
| 73 net::URLRequest* request_; | 75 net::URLRequest* request_; |
| 76 ChromeAppCacheService* const appcache_service_; |
| 74 | 77 |
| 75 // The state for deferred load quest. | 78 // The state for deferred load quest. |
| 76 int deferred_request_id_; | 79 int deferred_request_id_; |
| 77 GURL deferred_url_; | 80 GURL deferred_url_; |
| 78 | 81 |
| 79 scoped_refptr<net::CancelableCompletionCallback<OfflineResourceHandler> > | 82 scoped_refptr<net::CancelableCompletionCallback<OfflineResourceHandler> > |
| 80 appcache_completion_callback_; | 83 appcache_completion_callback_; |
| 81 | 84 |
| 82 DISALLOW_COPY_AND_ASSIGN(OfflineResourceHandler); | 85 DISALLOW_COPY_AND_ASSIGN(OfflineResourceHandler); |
| 83 }; | 86 }; |
| 84 | 87 |
| 85 #endif // CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_HANDLER_H_ | 88 #endif // CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_HANDLER_H_ |
| OLD | NEW |