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

Unified Diff: chrome/browser/push_messaging/push_messaging_notification_manager.h

Issue 1467573003: PushMessagingNotificationManager: extract IsTabVisible and test it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address peter's comments. Created 5 years, 1 month 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 | « no previous file | chrome/browser/push_messaging/push_messaging_notification_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/push_messaging/push_messaging_notification_manager.h
diff --git a/chrome/browser/push_messaging/push_messaging_notification_manager.h b/chrome/browser/push_messaging/push_messaging_notification_manager.h
index b9a9c68e172c0229eacd3f59f9b11ca31bd69d3f..ca81e6569c4efeb0ed34a145e7e63724d1c9ea30 100644
--- a/chrome/browser/push_messaging/push_messaging_notification_manager.h
+++ b/chrome/browser/push_messaging/push_messaging_notification_manager.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/callback_forward.h"
+#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
@@ -18,6 +19,7 @@ class Profile;
namespace content {
struct NotificationDatabaseData;
struct PlatformNotificationData;
+class WebContents;
}
// Developers may be required to display a Web Notification in response to an
@@ -45,6 +47,8 @@ class PushMessagingNotificationManager {
const base::Closure& message_handled_closure);
private:
+ FRIEND_TEST_ALL_PREFIXES(PushMessagingNotificationManagerTest, IsTabVisible);
+
static void DidGetNotificationsFromDatabaseIOProxy(
const base::WeakPtr<PushMessagingNotificationManager>& ui_weak_ptr,
const GURL& origin,
@@ -60,6 +64,13 @@ class PushMessagingNotificationManager {
bool success,
const std::vector<content::NotificationDatabaseData>& data);
+ // Checks whether |profile| is the one owning this instance,
+ // |active_web_contents| exists and its main frame is visible, and the URL
+ // currently visible to the user is for |origin|.
+ bool IsTabVisible(Profile* profile,
+ content::WebContents* active_web_contents,
+ const GURL& origin);
+
void DidGetNotificationsShownAndNeeded(
const GURL& origin,
int64_t service_worker_registration_id,
« no previous file with comments | « no previous file | chrome/browser/push_messaging/push_messaging_notification_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698