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

Unified Diff: chrome/browser/notifications/web_notification_delegate.cc

Issue 2921263002: Remove many delegates, let's see what breaks
Patch Set: fix test Created 3 years, 6 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/notifications/web_notification_delegate.h ('k') | chrome/tools/build/mac/verify_order » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/web_notification_delegate.cc
diff --git a/chrome/browser/notifications/web_notification_delegate.cc b/chrome/browser/notifications/web_notification_delegate.cc
index 8d4e792eb4d48b3ef517254fdb88c3ccac68cfd7..a99bad6e06a9cfd40ff122a91c63c5be223f93bc 100644
--- a/chrome/browser/notifications/web_notification_delegate.cc
+++ b/chrome/browser/notifications/web_notification_delegate.cc
@@ -7,27 +7,11 @@
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/nullable_string16.h"
+#include "chrome/browser/notifications/notification_common.h"
#include "chrome/browser/notifications/notification_display_service.h"
#include "chrome/browser/notifications/notification_display_service_factory.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
-#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
-#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "content/public/browser/web_contents.h"
-#include "ui/message_center/notifier_settings.h"
-using message_center::NotifierId;
-
-namespace features {
-
-const base::Feature kAllowFullscreenWebNotificationsFeature{
- "FSNotificationsWeb", base::FEATURE_ENABLED_BY_DEFAULT
-};
-
-} // namespace features
WebNotificationDelegate::WebNotificationDelegate(
NotificationCommon::Type notification_type,
@@ -55,53 +39,17 @@ bool WebNotificationDelegate::SettingsClick() {
}
bool WebNotificationDelegate::ShouldDisplaySettingsButton() {
- return true;
+ return notification_type_ != NotificationCommon::EXTENSION;
}
bool WebNotificationDelegate::ShouldDisplayOverFullscreen() const {
-#if !defined(OS_ANDROID)
- // Check to see if this notification comes from a webpage that is displaying
- // fullscreen content.
- for (auto* browser : *BrowserList::GetInstance()) {
- // Only consider the browsers for the profile that created the notification
- if (browser->profile() != profile_)
- continue;
-
- const content::WebContents* active_contents =
- browser->tab_strip_model()->GetActiveWebContents();
- if (!active_contents)
- continue;
-
- // Check to see if
- // (a) the active tab in the browser shares its origin with the
- // notification.
- // (b) the browser is fullscreen
- // (c) the browser has focus.
- if (active_contents->GetURL().GetOrigin() == origin_ &&
- browser->exclusive_access_manager()->context()->IsFullscreen() &&
- browser->window()->IsActive()) {
- bool enabled = base::FeatureList::IsEnabled(
- features::kAllowFullscreenWebNotificationsFeature);
- if (enabled) {
- UMA_HISTOGRAM_ENUMERATION("Notifications.Display_Fullscreen.Shown",
- NotifierId::WEB_PAGE,
- NotifierId::SIZE);
- } else {
- UMA_HISTOGRAM_ENUMERATION(
- "Notifications.Display_Fullscreen.Suppressed",
- NotifierId::WEB_PAGE,
- NotifierId::SIZE);
- }
- return enabled;
- }
- }
-#endif
+ NotificationDisplayService* display_service =
+ NotificationDisplayServiceFactory::GetForProfile(profile_);
- return false;
+ return display_service->ShouldDisplayOverFullscreen(origin_,
+ notification_type_);
}
-void WebNotificationDelegate::Display() {}
-
void WebNotificationDelegate::Close(bool by_user) {
auto* display_service =
NotificationDisplayServiceFactory::GetForProfile(profile_);
« no previous file with comments | « chrome/browser/notifications/web_notification_delegate.h ('k') | chrome/tools/build/mac/verify_order » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698