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

Unified Diff: ui/arc/notification/arc_custom_notification_view.h

Issue 2093563007: Add a floating close button for arc custom notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 4 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
Index: ui/arc/notification/arc_custom_notification_view.h
diff --git a/ui/arc/notification/arc_custom_notification_view.h b/ui/arc/notification/arc_custom_notification_view.h
index e5de7e93e56835ddabb980b7ebf4a2d74fd11f78..4505f269073b647e33cc923565cb95fde32f9b00 100644
--- a/ui/arc/notification/arc_custom_notification_view.h
+++ b/ui/arc/notification/arc_custom_notification_view.h
@@ -5,29 +5,59 @@
#ifndef UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_
#define UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_
+#include <memory>
#include <string>
#include "base/macros.h"
+#include "ui/arc/notification/arc_custom_notification_item.h"
+#include "ui/views/controls/button/button.h"
#include "ui/views/controls/native/native_view_host.h"
namespace exo {
class NotificationSurface;
}
+namespace views {
+class ImageButton;
+class Widget;
+}
+
namespace arc {
-class ArcCustomNotificationView : public views::NativeViewHost {
+class ArcCustomNotificationView : public views::NativeViewHost,
+ public views::ButtonListener,
+ public ArcCustomNotificationItem::Observer {
public:
- explicit ArcCustomNotificationView(exo::NotificationSurface* surface);
+ ArcCustomNotificationView(ArcCustomNotificationItem* item,
+ exo::NotificationSurface* surface);
~ArcCustomNotificationView() override;
private:
+ void CreateFloatingCloseButton();
+
// views::NativeViewHost
void ViewHierarchyChanged(
const ViewHierarchyChangedDetails& details) override;
+ void Layout() override;
+
+ // views::ButtonListener
+ void ButtonPressed(views::Button* sender, const ui::Event& event) override;
+ // ArcCustomNotificationItem::Observer
+ void OnItemDestroying() override;
+ void OnItemPinnedChanged() override;
+
+ ArcCustomNotificationItem* item_;
exo::NotificationSurface* const surface_;
+ // A close button on top of NotificationSurface. Needed because the
+ // aura::Window of NotificationSurface is added after hosting widget's
+ // RootView thus standard notification close button is always below
+ // it.
+ std::unique_ptr<views::Widget> floating_close_button_widget_;
+
+ views::ImageButton* floating_close_button_ = nullptr;
+
DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView);
};
« no previous file with comments | « ui/arc/notification/arc_custom_notification_item.cc ('k') | ui/arc/notification/arc_custom_notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698