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

Unified Diff: chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.cc

Issue 2965043003: ToolbarModel: Supply offline page status. (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.h ('k') | components/toolbar/toolbar_model.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.cc
diff --git a/chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.cc b/chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.cc
index 643a331d5494718f5afc54342b3a53388815135b..993e4c65d020365445cca664821d4f7f22d5c588 100644
--- a/chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.cc
+++ b/chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.h"
#include "base/logging.h"
+#include "build/build_config.h"
#include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/search.h"
@@ -27,6 +28,10 @@
#include "components/toolbar/vector_icons.h" // nogncheck
#endif
+#if defined(OS_ANDROID)
+#include "chrome/browser/android/offline_pages/offline_page_utils.h"
+#endif
+
ChromeToolbarModelDelegate::ChromeToolbarModelDelegate() {}
ChromeToolbarModelDelegate::~ChromeToolbarModelDelegate() {}
@@ -126,6 +131,18 @@ const gfx::VectorIcon* ChromeToolbarModelDelegate::GetVectorIconOverride()
return nullptr;
}
+bool ChromeToolbarModelDelegate::IsOfflinePage() const {
+#if defined(OS_ANDROID)
+ content::WebContents* web_contents = GetActiveWebContents();
+ if (!web_contents)
+ return false;
+ return offline_pages::OfflinePageUtils::GetOfflinePageFromWebContents(
+ web_contents) != nullptr;
Peter Kasting 2017/07/06 06:08:07 Nit: Simpler: return web_contents && o
+#else
+ return false;
+#endif
+}
+
content::NavigationController*
ChromeToolbarModelDelegate::GetNavigationController() const {
// This |current_tab| can be null during the initialization of the toolbar
« no previous file with comments | « chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.h ('k') | components/toolbar/toolbar_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698