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

Unified Diff: chrome/browser/extensions/api/notifications/notifications_api.cc

Issue 2335293002: ShouldDisplayOverFullscreen implementation (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | chrome/browser/extensions/api/notifications/notifications_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/notifications/notifications_api.cc
diff --git a/chrome/browser/extensions/api/notifications/notifications_api.cc b/chrome/browser/extensions/api/notifications/notifications_api.cc
index 215c9833793066d22cb29bd74b11d70567bd762f..62fea593ed1cd07e68e63aba83cbda16334a4f6a 100644
--- a/chrome/browser/extensions/api/notifications/notifications_api.cc
+++ b/chrome/browser/extensions/api/notifications/notifications_api.cc
@@ -31,6 +31,8 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
+#include "extensions/browser/app_window/app_window.h"
+#include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
@@ -143,6 +145,7 @@ class NotificationsApiDelegate : public NotificationDelegate {
const std::string& id)
: api_function_(api_function),
event_router_(EventRouter::Get(profile)),
+ profile_(profile),
extension_id_(extension_id),
id_(id),
scoped_id_(CreateScopedIdentifier(extension_id, id)) {
@@ -188,6 +191,19 @@ class NotificationsApiDelegate : public NotificationDelegate {
std::string id() const override { return scoped_id_; }
+ // Should only display when fullscreen if this app is the source of the
+ // fullscreen window.
+ bool ShouldDisplayOverFullscreen() const override {
dewittj 2016/09/13 22:56:51 is it possible for two apps to have a fullscreen w
+ AppWindowRegistry::AppWindowList windows =
+ AppWindowRegistry::Get(profile_)->GetAppWindowsForApp(extension_id_);
+ bool shouldDisplay = false;
+ for (AppWindowRegistry::AppWindowList::const_iterator i = windows.begin();
dewittj 2016/09/13 22:56:51 for (const auto& window : windows)
+ i != windows.end() && !shouldDisplay; ++i) {
+ shouldDisplay |= (*i)->IsFullscreen();
dewittj 2016/09/13 22:56:51 I'd prefer: if (i->IsFullscreen()) return true;
+ }
+ return shouldDisplay;
+ }
+
private:
~NotificationsApiDelegate() override {}
@@ -222,6 +238,7 @@ class NotificationsApiDelegate : public NotificationDelegate {
// so make sure to check for a valid pointer before use.
EventRouter* event_router_;
+ Profile* profile_;
const std::string extension_id_;
const std::string id_;
const std::string scoped_id_;
« no previous file with comments | « no previous file | chrome/browser/extensions/api/notifications/notifications_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698