| 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 #include "chrome/browser/renderer_host/offline_resource_throttle.h" | 5 #include "chrome/browser/renderer_host/offline_resource_throttle.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 BrowserThread::IO, FROM_HERE, base::Bind(callback, true)); | 44 BrowserThread::IO, FROM_HERE, base::Bind(callback, true)); |
| 45 } else { | 45 } else { |
| 46 RenderViewHost* render_view_host = | 46 RenderViewHost* render_view_host = |
| 47 RenderViewHost::FromID(render_process_id, render_view_id); | 47 RenderViewHost::FromID(render_process_id, render_view_id); |
| 48 WebContents* web_contents = render_view_host ? | 48 WebContents* web_contents = render_view_host ? |
| 49 render_view_host->delegate()->GetAsWebContents() : NULL; | 49 render_view_host->delegate()->GetAsWebContents() : NULL; |
| 50 // There is a chance that the tab closed after we decided to show | 50 // There is a chance that the tab closed after we decided to show |
| 51 // the offline page on the IO thread and before we actually show the | 51 // the offline page on the IO thread and before we actually show the |
| 52 // offline page here on the UI thread. | 52 // offline page here on the UI thread. |
| 53 if (web_contents) | 53 if (web_contents) |
| 54 new chromeos::OfflineLoadPage(web_contents, url, callback); | 54 (new chromeos::OfflineLoadPage(web_contents, url, callback))->Show(); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 OfflineResourceThrottle::OfflineResourceThrottle( | 60 OfflineResourceThrottle::OfflineResourceThrottle( |
| 61 int render_process_id, | 61 int render_process_id, |
| 62 int render_view_id, | 62 int render_view_id, |
| 63 net::URLRequest* request, | 63 net::URLRequest* request, |
| 64 ChromeAppCacheService* appcache_service) | 64 ChromeAppCacheService* appcache_service) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 base::Bind( | 129 base::Bind( |
| 130 &ShowOfflinePage, | 130 &ShowOfflinePage, |
| 131 render_process_id_, | 131 render_process_id_, |
| 132 render_view_id_, | 132 render_view_id_, |
| 133 request_->url(), | 133 request_->url(), |
| 134 base::Bind( | 134 base::Bind( |
| 135 &OfflineResourceThrottle::OnBlockingPageComplete, | 135 &OfflineResourceThrottle::OnBlockingPageComplete, |
| 136 AsWeakPtr()))); | 136 AsWeakPtr()))); |
| 137 } | 137 } |
| 138 } | 138 } |
| OLD | NEW |