Chromium Code Reviews| 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 10 matching lines...) Expand all Loading... | |
| 21 #include "content/public/browser/navigation_entry.h" | 21 #include "content/public/browser/navigation_entry.h" |
| 22 #include "content/public/browser/navigation_handle.h" | 22 #include "content/public/browser/navigation_handle.h" |
| 23 #include "content/public/browser/render_frame_host.h" | 23 #include "content/public/browser/render_frame_host.h" |
| 24 #include "ipc/ipc_message_macros.h" | 24 #include "ipc/ipc_message_macros.h" |
| 25 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
| 26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 27 | 27 |
| 28 #if BUILDFLAG(ANDROID_JAVA_UI) | 28 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 29 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 29 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| 30 #include "chrome/browser/android/tab_android.h" | 30 #include "chrome/browser/android/tab_android.h" |
| 31 #include "components/offline_pages/client_namespace_constants.h" | |
| 31 #include "components/offline_pages/offline_page_feature.h" | 32 #include "components/offline_pages/offline_page_feature.h" |
| 32 #include "components/offline_pages/offline_page_item.h" | 33 #include "components/offline_pages/offline_page_item.h" |
| 33 #include "components/offline_pages/offline_page_model.h" | 34 #include "components/offline_pages/offline_page_model.h" |
| 34 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 35 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
| 35 | 36 |
| 36 using content::BrowserContext; | 37 using content::BrowserContext; |
| 37 using content::BrowserThread; | 38 using content::BrowserThread; |
| 38 using content::WebContents; | 39 using content::WebContents; |
| 39 using content::WebContentsObserver; | 40 using content::WebContentsObserver; |
| 40 using error_page::DnsProbeStatus; | 41 using error_page::DnsProbeStatus; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 if (!offline_pages::IsOfflinePagesEnabled()) | 302 if (!offline_pages::IsOfflinePagesEnabled()) |
| 302 return; | 303 return; |
| 303 | 304 |
| 304 offline_pages::OfflinePageModel* offline_page_model = | 305 offline_pages::OfflinePageModel* offline_page_model = |
| 305 offline_pages::OfflinePageModelFactory::GetForBrowserContext( | 306 offline_pages::OfflinePageModelFactory::GetForBrowserContext( |
| 306 web_contents()->GetBrowserContext()); | 307 web_contents()->GetBrowserContext()); |
| 307 if (!offline_page_model) | 308 if (!offline_page_model) |
| 308 return; | 309 return; |
| 309 | 310 |
| 310 offline_page_model->HasPages( | 311 offline_page_model->HasPages( |
| 311 offline_pages::kBookmarkNamespace, | 312 offline_pages::kBookmarkNamespace, |
|
dewittj
2016/05/31 23:12:01
this seems wrong now.
jianli
2016/05/31 23:50:07
This will be updated. For now, the offline related
| |
| 312 base::Bind(&NetErrorTabHelper::SetHasOfflinePages, | 313 base::Bind(&NetErrorTabHelper::SetHasOfflinePages, |
| 313 weak_factory_.GetWeakPtr(), | 314 weak_factory_.GetWeakPtr(), |
| 314 render_frame_host->GetFrameTreeNodeId())); | 315 render_frame_host->GetFrameTreeNodeId())); |
| 315 } | 316 } |
| 316 | 317 |
| 317 void NetErrorTabHelper::SetHasOfflinePages(int frame_tree_node_id, | 318 void NetErrorTabHelper::SetHasOfflinePages(int frame_tree_node_id, |
| 318 bool has_offline_pages) { | 319 bool has_offline_pages) { |
| 319 content::RenderFrameHost* render_frame_host = | 320 content::RenderFrameHost* render_frame_host = |
| 320 web_contents()->FindFrameByFrameTreeNodeId(frame_tree_node_id); | 321 web_contents()->FindFrameByFrameTreeNodeId(frame_tree_node_id); |
| 321 if (render_frame_host == nullptr) | 322 if (render_frame_host == nullptr) |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 338 | 339 |
| 339 bool NetErrorTabHelper::IsFromErrorPage() const { | 340 bool NetErrorTabHelper::IsFromErrorPage() const { |
| 340 content::NavigationEntry* entry = | 341 content::NavigationEntry* entry = |
| 341 web_contents()->GetController().GetLastCommittedEntry(); | 342 web_contents()->GetController().GetLastCommittedEntry(); |
| 342 return entry && (entry->GetPageType() == content::PAGE_TYPE_ERROR); | 343 return entry && (entry->GetPageType() == content::PAGE_TYPE_ERROR); |
| 343 } | 344 } |
| 344 | 345 |
| 345 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 346 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
| 346 | 347 |
| 347 } // namespace chrome_browser_net | 348 } // namespace chrome_browser_net |
| OLD | NEW |