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