| 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 30 matching lines...) Expand all Loading... |
| 41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 42 | 42 |
| 43 // Check again on UI thread and proceed if it's connected. | 43 // Check again on UI thread and proceed if it's connected. |
| 44 if (!net::NetworkChangeNotifier::IsOffline()) { | 44 if (!net::NetworkChangeNotifier::IsOffline()) { |
| 45 BrowserThread::PostTask( | 45 BrowserThread::PostTask( |
| 46 BrowserThread::IO, FROM_HERE, base::Bind(callback, true)); | 46 BrowserThread::IO, FROM_HERE, base::Bind(callback, true)); |
| 47 } else { | 47 } else { |
| 48 RenderViewHost* render_view_host = | 48 RenderViewHost* render_view_host = |
| 49 RenderViewHost::FromID(render_process_id, render_view_id); | 49 RenderViewHost::FromID(render_process_id, render_view_id); |
| 50 WebContents* web_contents = render_view_host ? | 50 WebContents* web_contents = render_view_host ? |
| 51 render_view_host->delegate()->GetAsWebContents() : NULL; | 51 render_view_host->GetDelegate()->GetAsWebContents() : NULL; |
| 52 // There is a chance that the tab closed after we decided to show | 52 // There is a chance that the tab closed after we decided to show |
| 53 // the offline page on the IO thread and before we actually show the | 53 // the offline page on the IO thread and before we actually show the |
| 54 // offline page here on the UI thread. | 54 // offline page here on the UI thread. |
| 55 if (web_contents) | 55 if (web_contents) |
| 56 (new chromeos::OfflineLoadPage(web_contents, url, callback))->Show(); | 56 (new chromeos::OfflineLoadPage(web_contents, url, callback))->Show(); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace | 60 } // namespace |
| 61 | 61 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 base::Bind( | 132 base::Bind( |
| 133 &ShowOfflinePage, | 133 &ShowOfflinePage, |
| 134 render_process_id_, | 134 render_process_id_, |
| 135 render_view_id_, | 135 render_view_id_, |
| 136 request_->url(), | 136 request_->url(), |
| 137 base::Bind( | 137 base::Bind( |
| 138 &OfflineResourceThrottle::OnBlockingPageComplete, | 138 &OfflineResourceThrottle::OnBlockingPageComplete, |
| 139 AsWeakPtr()))); | 139 AsWeakPtr()))); |
| 140 } | 140 } |
| 141 } | 141 } |
| OLD | NEW |