Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1035)

Side by Side Diff: chrome/browser/net/net_error_tab_helper.cc

Issue 1904613005: [Offline pages] Removing bookmarks dependency from offline pages component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests compilation Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_factory.cc ('k') | components/offline_pages.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_factory.cc ('k') | components/offline_pages.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698