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

Unified Diff: chrome/browser/ui/android/tab_model/tab_model.cc

Issue 866443003: Push API: Don't require notification if tab is visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ycm_outdir
Patch Set: Fix Android compile Created 5 years, 10 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/android/tab_model/tab_model.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/android/tab_model/tab_model.cc
diff --git a/chrome/browser/ui/android/tab_model/tab_model.cc b/chrome/browser/ui/android/tab_model/tab_model.cc
index 2d5bd6a04f043705bbcf52b55161a7cb80fd45f0..1c07f779d9e4f3789fdb96c896be893b6551c241 100644
--- a/chrome/browser/ui/android/tab_model/tab_model.cc
+++ b/chrome/browser/ui/android/tab_model/tab_model.cc
@@ -14,6 +14,10 @@
using content::NotificationService;
+// Keep this in sync with
+// chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabList.java
+static int INVALID_TAB_INDEX = -1;
+
TabModel::TabModel(Profile* profile)
: profile_(profile),
synced_window_delegate_(
@@ -58,6 +62,13 @@ SessionID::id_type TabModel::GetSessionId() const {
return session_id_.id();
}
+content::WebContents* TabModel::GetActiveWebContents() const {
+ int active_index = GetActiveIndex();
+ if (active_index == INVALID_TAB_INDEX)
+ return nullptr;
+ return GetWebContentsAt(active_index);
+}
+
void TabModel::BroadcastSessionRestoreComplete() {
if (profile_) {
NotificationService::current()->Notify(
« no previous file with comments | « chrome/browser/ui/android/tab_model/tab_model.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698