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

Unified Diff: content/shell/browser/layout_test/layout_test_notification_manager.h

Issue 1116693002: [NOT FOR REVIEW] Significantly simplify the PlatformNotificationService //content API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
Index: content/shell/browser/layout_test/layout_test_notification_manager.h
diff --git a/content/shell/browser/layout_test/layout_test_notification_manager.h b/content/shell/browser/layout_test/layout_test_notification_manager.h
index ac51c5c368ef552504f65b8cae03c480de269980..ef5121b18a1821fc807f649daf1073966c5e7c67 100644
--- a/content/shell/browser/layout_test/layout_test_notification_manager.h
+++ b/content/shell/browser/layout_test/layout_test_notification_manager.h
@@ -10,16 +10,14 @@
#include <string>
#include "base/callback.h"
-#include "base/memory/weak_ptr.h"
+#include "base/containers/scoped_ptr_hash_map.h"
#include "content/public/browser/platform_notification_service.h"
#include "third_party/WebKit/public/platform/modules/notifications/WebNotificationPermission.h"
+#include "ui/message_center/notification.h"
#include "url/gurl.h"
namespace content {
-class DesktopNotificationDelegate;
-struct PlatformNotificationData;
-
// Responsible for tracking active notifications and allowed origins for the
// Web Notification API when running layout tests.
class LayoutTestNotificationManager : public PlatformNotificationService {
@@ -40,49 +38,20 @@ class LayoutTestNotificationManager : public PlatformNotificationService {
ResourceContext* resource_context,
const GURL& origin,
int render_process_id) override;
- void DisplayNotification(BrowserContext* browser_context,
- const GURL& origin,
- const SkBitmap& icon,
- const PlatformNotificationData& notification_data,
- scoped_ptr<DesktopNotificationDelegate> delegate,
- base::Closure* cancel_callback) override;
- void DisplayPersistentNotification(
+ void DisplayNotification(
BrowserContext* browser_context,
- int64_t persistent_notification_id,
- const GURL& origin,
- const SkBitmap& icon,
- const PlatformNotificationData& notification_data) override;
- void ClosePersistentNotification(
+ const message_center::Notification& notification) override;
+ void CloseNotification(
BrowserContext* browser_context,
- int64_t persistent_notification_id) override;
+ const std::string& notification_id) override;
private:
- // Structure to represent the information of a persistent notification.
- struct PersistentNotification {
- BrowserContext* browser_context = nullptr;
- GURL origin;
- int64_t persistent_id = 0;
- };
-
- // Closes the notification titled |title|. Must be called on the UI thread.
- void Close(const std::string& title);
-
- // Fakes replacing the notification identified by |params| when it has a tag
- // and a previous notification has been displayed using the same tag. All
- // notifications, both page and persistent ones, will be considered for this.
- void ReplaceNotificationIfNeeded(
- const PlatformNotificationData& notification_data);
-
// Checks if |origin| has permission to display notifications. May be called
// on both the IO and the UI threads.
blink::WebNotificationPermission CheckPermission(const GURL& origin);
- std::map<std::string, DesktopNotificationDelegate*> page_notifications_;
- std::map<std::string, PersistentNotification> persistent_notifications_;
-
- std::map<std::string, std::string> replacements_;
-
- base::WeakPtrFactory<LayoutTestNotificationManager> weak_factory_;
+ base::ScopedPtrHashMap<std::string, scoped_ptr<message_center::Notification>>
+ notifications_;
DISALLOW_COPY_AND_ASSIGN(LayoutTestNotificationManager);
};

Powered by Google App Engine
This is Rietveld 408576698