Index: ui/arc/notification/arc_notification_delegate.h |
diff --git a/ui/arc/notification/arc_notification_delegate.h b/ui/arc/notification/arc_notification_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..787010b2d49c7fc7f6ca07b07697e89c41d1baaf |
--- /dev/null |
+++ b/ui/arc/notification/arc_notification_delegate.h |
@@ -0,0 +1,42 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_ARC_NOTIFICATION_ARC_CUSTOM_DELEGATE_H_ |
+#define UI_ARC_NOTIFICATION_ARC_CUSTOM_DELEGATE_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "ui/message_center/notification_delegate.h" |
+ |
+namespace arc { |
+ |
+class ArcNotificationItem; |
+ |
+/* |
+ * Implementation of NotificationDelegate for ARC notifications. |
+ */ |
+class ArcNotificationDelegate : public message_center::NotificationDelegate { |
+ public: |
+ explicit ArcNotificationDelegate(base::WeakPtr<ArcNotificationItem> item); |
+ |
+ // message_center::NotificationDelegate overrides: |
+ std::unique_ptr<message_center::CustomContent> CreateCustomContent() override; |
+ void Close(bool by_user) override; |
+ void Click() override; |
+ |
+ private: |
+ // The destructor is private since this class is ref-counted. |
+ ~ArcNotificationDelegate() override; |
+ |
+ // We use weak ptr to detect potential use-after-free. The lives of objects |
+ // around ARC notification is somewhat complex so we want to use it until |
+ // it gets stable. |
+ base::WeakPtr<ArcNotificationItem> item_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ArcNotificationDelegate); |
+}; |
+ |
+} // namespace arc |
+ |
+#endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_DELEGATE_H_ |