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

Unified Diff: chrome/browser/printing/cloud_print/privet_notifications.h

Issue 2446043002: Close privet printer notifications when clicked. (Closed)
Patch Set: Add test, fix potential UAF Created 4 years, 2 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/printing/cloud_print/privet_notifications.h
diff --git a/chrome/browser/printing/cloud_print/privet_notifications.h b/chrome/browser/printing/cloud_print/privet_notifications.h
index 2e9df8d1f2eeaff6ab489bf40aca09e57132407d..a6a64fae4d332c18419aed4578560f29a4d31455 100644
--- a/chrome/browser/printing/cloud_print/privet_notifications.h
+++ b/chrome/browser/printing/cloud_print/privet_notifications.h
@@ -16,6 +16,7 @@
#include "components/prefs/pref_member.h"
class NotificationUIManager;
+class Profile;
namespace content {
class BrowserContext;
@@ -30,6 +31,7 @@ namespace cloud_print {
class PrivetDeviceLister;
class PrivetHTTPAsynchronousFactory;
class PrivetHTTPResolution;
+class PrivetNotificationDelegate;
struct DeviceDescription;
#if defined(ENABLE_MDNS)
@@ -119,6 +121,10 @@ class PrivetNotificationService
void OnNotificationsEnabledChanged();
void StartLister();
+ // Virtual for testing. The returned delegate is refcounted.
+ virtual PrivetNotificationDelegate* CreateNotificationDelegate(
+ Profile* profile);
+
content::BrowserContext* const profile_;
std::unique_ptr<PrivetDeviceLister> device_lister_;
scoped_refptr<local_discovery::ServiceDiscoverySharedClient>
@@ -133,20 +139,24 @@ class PrivetNotificationService
class PrivetNotificationDelegate : public NotificationDelegate {
public:
- explicit PrivetNotificationDelegate(content::BrowserContext* profile);
+ explicit PrivetNotificationDelegate(Profile* profile);
// NotificationDelegate implementation.
std::string id() const override;
void ButtonClick(int button_index) override;
- private:
+ protected:
// Refcounted.
~PrivetNotificationDelegate() override;
- void OpenTab(const GURL& url);
- void DisableNotifications();
+ private:
+ // ButtonClick() response handlers. Virtual for testing.
+ virtual void OpenTab(const GURL& url);
+ virtual void DisableNotifications();
- content::BrowserContext* const profile_;
+ void CloseNotification();
+
+ Profile* const profile_;
};
} // namespace cloud_print

Powered by Google App Engine
This is Rietveld 408576698