| 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/net/net_error_tab_helper.h" | 5 #include "chrome/browser/net/net_error_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/io_thread.h" | 10 #include "chrome/browser/io_thread.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 if (!offline_pages::IsOfflinePagesEnabled()) | 301 if (!offline_pages::IsOfflinePagesEnabled()) |
| 302 return; | 302 return; |
| 303 | 303 |
| 304 offline_pages::OfflinePageModel* offline_page_model = | 304 offline_pages::OfflinePageModel* offline_page_model = |
| 305 offline_pages::OfflinePageModelFactory::GetForBrowserContext( | 305 offline_pages::OfflinePageModelFactory::GetForBrowserContext( |
| 306 web_contents()->GetBrowserContext()); | 306 web_contents()->GetBrowserContext()); |
| 307 if (!offline_page_model) | 307 if (!offline_page_model) |
| 308 return; | 308 return; |
| 309 | 309 |
| 310 offline_page_model->HasPages( | 310 offline_page_model->HasPages( |
| 311 offline_pages::BOOKMARK_NAMESPACE, | 311 offline_pages::kBookmarkNamespace, |
| 312 base::Bind(&NetErrorTabHelper::SetHasOfflinePages, | 312 base::Bind(&NetErrorTabHelper::SetHasOfflinePages, |
| 313 weak_factory_.GetWeakPtr(), | 313 weak_factory_.GetWeakPtr(), |
| 314 render_frame_host->GetFrameTreeNodeId())); | 314 render_frame_host->GetFrameTreeNodeId())); |
| 315 } | 315 } |
| 316 | 316 |
| 317 void NetErrorTabHelper::SetHasOfflinePages(int frame_tree_node_id, | 317 void NetErrorTabHelper::SetHasOfflinePages(int frame_tree_node_id, |
| 318 bool has_offline_pages) { | 318 bool has_offline_pages) { |
| 319 content::RenderFrameHost* render_frame_host = | 319 content::RenderFrameHost* render_frame_host = |
| 320 web_contents()->FindFrameByFrameTreeNodeId(frame_tree_node_id); | 320 web_contents()->FindFrameByFrameTreeNodeId(frame_tree_node_id); |
| 321 if (render_frame_host == nullptr) | 321 if (render_frame_host == nullptr) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 338 | 338 |
| 339 bool NetErrorTabHelper::IsFromErrorPage() const { | 339 bool NetErrorTabHelper::IsFromErrorPage() const { |
| 340 content::NavigationEntry* entry = | 340 content::NavigationEntry* entry = |
| 341 web_contents()->GetController().GetLastCommittedEntry(); | 341 web_contents()->GetController().GetLastCommittedEntry(); |
| 342 return entry && (entry->GetPageType() == content::PAGE_TYPE_ERROR); | 342 return entry && (entry->GetPageType() == content::PAGE_TYPE_ERROR); |
| 343 } | 343 } |
| 344 | 344 |
| 345 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 345 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
| 346 | 346 |
| 347 } // namespace chrome_browser_net | 347 } // namespace chrome_browser_net |
| OLD | NEW |