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

Unified Diff: chrome/browser/notifications/notification_platform_bridge_linux.h

Issue 2821533003: Refactor NotificationPlatformBridgeLinux (Closed)
Patch Set: address latest comments from thestig Created 3 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: chrome/browser/notifications/notification_platform_bridge_linux.h
diff --git a/chrome/browser/notifications/notification_platform_bridge_linux.h b/chrome/browser/notifications/notification_platform_bridge_linux.h
index d86935c95a75f55430d1b4f42c1eda86d8522c56..9975e151d95228c61f5d20b0cb20660500bfeb1a 100644
--- a/chrome/browser/notifications/notification_platform_bridge_linux.h
+++ b/chrome/browser/notifications/notification_platform_bridge_linux.h
@@ -5,22 +5,13 @@
#ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_LINUX_H_
#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_LINUX_H_
-#include <gio/gio.h>
-
-#include <unordered_map>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
#include "chrome/browser/notifications/notification_platform_bridge.h"
Peter Beverloo 2017/04/25 15:16:55 #include "base/callback_forward.h" #include "base/
Tom (Use chromium acct) 2017/04/25 18:35:21 Done.
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-#include "ui/base/glib/glib_signal.h"
-#include "ui/base/glib/scoped_gobject.h"
-class NotificationPlatformBridgeLinux : public NotificationPlatformBridge,
- public content::NotificationObserver {
+class NotificationPlatformBridgeLinuxImpl;
+
+class NotificationPlatformBridgeLinux : public NotificationPlatformBridge {
public:
- explicit NotificationPlatformBridgeLinux(GDBusProxy* notification_proxy);
+ NotificationPlatformBridgeLinux();
~NotificationPlatformBridgeLinux() override;
@@ -37,73 +28,10 @@ class NotificationPlatformBridgeLinux : public NotificationPlatformBridge,
bool incognito,
const GetDisplayedNotificationsCallback& callback) const override;
- // Called from NotifyCompleteReceiver().
- void NotifyCompleteInternal(gpointer user_data, GVariant* value);
+ void CheckConnection(base::OnceCallback<void(bool)> callback);
private:
- struct NotificationData;
- struct ResourceFiles;
-
- // content::NotificationObserver:
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) override;
-
- // Sets up a task to call NotifyNow() after an IO thread writes the
- // necessary resource files.
- void Notify(const Notification& notification,
- NotificationData* data,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
- // Makes the "Notify" call to D-Bus.
- void NotifyNow(const Notification& notification,
- base::WeakPtr<NotificationData> data,
- GAsyncReadyCallback callback,
- gpointer user_data,
- std::unique_ptr<ResourceFiles> resource_files);
-
- // Makes the "CloseNotification" call to D-Bus.
- void CloseNow(uint32_t dbus_id);
-
- void ForwardNotificationOperation(uint32_t dbus_id,
- NotificationCommon::Operation operation,
- int action_index);
-
- // GSignalReceiver: The function that GLib calls into for
- // ActionInvoked and NotificationClosed signals.
- CHROMEG_CALLBACK_3(NotificationPlatformBridgeLinux,
- void,
- GSignalReceiver,
- GDBusProxy*,
- const char*,
- const char*,
- GVariant*);
-
- NotificationData* FindNotificationData(const std::string& notification_id,
- const std::string& profile_id,
- bool is_incognito);
-
- NotificationData* FindNotificationData(uint32_t dbus_id);
-
- ScopedGObject<GDBusProxy> notification_proxy_;
-
- // Used to disconnect from "g-signal" during destruction.
- gulong proxy_signal_handler_ = 0;
-
- // A std::set<std::unique_ptr<T>> doesn't work well because
- // eg. std::set::erase(T) would require a std::unique_ptr<T>
- // argument, so the data would get double-destructed.
- template <typename T>
- using UnorderedUniqueSet = std::unordered_map<T*, std::unique_ptr<T>>;
-
- UnorderedUniqueSet<NotificationData> notifications_;
-
- content::NotificationRegistrar registrar_;
-
- base::WeakPtrFactory<NotificationPlatformBridgeLinux> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(NotificationPlatformBridgeLinux);
+ scoped_refptr<NotificationPlatformBridgeLinuxImpl> impl_;
Peter Beverloo 2017/04/25 15:16:56 Please keep DISALLOW_COPY_AND_ASSIGN()
Tom (Use chromium acct) 2017/04/25 18:35:21 Done.
};
#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_PLATFORM_BRIDGE_LINUX_H_

Powered by Google App Engine
This is Rietveld 408576698