| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ref_counted.h" | 11 #include "base/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 "chrome/browser/renderer_host/resource_handler.h" | 13 #include "chrome/browser/renderer_host/resource_handler.h" |
| 14 | 14 |
| 15 class MessageLoop; | 15 class MessageLoop; |
| 16 class ResourceDispatcherHost; | 16 class ResourceDispatcherHost; |
| 17 |
| 18 namespace net { |
| 17 class URLRequest; | 19 class URLRequest; |
| 20 } // namespace net |
| 18 | 21 |
| 19 // Used to show an offline interstitial page when the network is not available. | 22 // Used to show an offline interstitial page when the network is not available. |
| 20 class OfflineResourceHandler : public ResourceHandler, | 23 class OfflineResourceHandler : public ResourceHandler, |
| 21 public chromeos::OfflineLoadPage::Delegate { | 24 public chromeos::OfflineLoadPage::Delegate { |
| 22 public: | 25 public: |
| 23 OfflineResourceHandler(ResourceHandler* handler, | 26 OfflineResourceHandler(ResourceHandler* handler, |
| 24 int host_id, | 27 int host_id, |
| 25 int render_view_id, | 28 int render_view_id, |
| 26 ResourceDispatcherHost* rdh, | 29 ResourceDispatcherHost* rdh, |
| 27 URLRequest* request); | 30 net::URLRequest* request); |
| 28 ~OfflineResourceHandler() {} | 31 ~OfflineResourceHandler() {} |
| 29 | 32 |
| 30 // ResourceHandler implementation: | 33 // ResourceHandler implementation: |
| 31 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); | 34 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); |
| 32 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, | 35 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, |
| 33 ResourceResponse* response, bool* defer); | 36 ResourceResponse* response, bool* defer); |
| 34 virtual bool OnResponseStarted(int request_id, ResourceResponse* response); | 37 virtual bool OnResponseStarted(int request_id, ResourceResponse* response); |
| 35 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); | 38 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); |
| 36 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 39 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
| 37 int min_size); | 40 int min_size); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 56 bool ShouldShowOfflinePage(const GURL& url) const; | 59 bool ShouldShowOfflinePage(const GURL& url) const; |
| 57 | 60 |
| 58 // Shows the offline interstitinal page in UI thread. | 61 // Shows the offline interstitinal page in UI thread. |
| 59 void ShowOfflinePage(); | 62 void ShowOfflinePage(); |
| 60 | 63 |
| 61 scoped_refptr<ResourceHandler> next_handler_; | 64 scoped_refptr<ResourceHandler> next_handler_; |
| 62 | 65 |
| 63 int process_host_id_; | 66 int process_host_id_; |
| 64 int render_view_id_; | 67 int render_view_id_; |
| 65 ResourceDispatcherHost* rdh_; | 68 ResourceDispatcherHost* rdh_; |
| 66 URLRequest* request_; | 69 net::URLRequest* request_; |
| 67 | 70 |
| 68 // The state for deferred load quest. | 71 // The state for deferred load quest. |
| 69 int deferred_request_id_; | 72 int deferred_request_id_; |
| 70 GURL deferred_url_; | 73 GURL deferred_url_; |
| 71 | 74 |
| 72 DISALLOW_COPY_AND_ASSIGN(OfflineResourceHandler); | 75 DISALLOW_COPY_AND_ASSIGN(OfflineResourceHandler); |
| 73 }; | 76 }; |
| 74 | 77 |
| 75 #endif // CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_HANDLER_H_ | 78 #endif // CHROME_BROWSER_RENDERER_HOST_OFFLINE_RESOURCE_HANDLER_H_ |
| OLD | NEW |