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

Unified Diff: ui/message_center/views/custom_notification_view.h

Issue 2723143002: Add unittests of ArcCustomNotificationView (Closed)
Patch Set: wip Created 3 years, 7 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
« no previous file with comments | « ui/arc/notification/arc_notification_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/custom_notification_view.h
diff --git a/ui/message_center/views/custom_notification_view.h b/ui/message_center/views/custom_notification_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..3ec27a4531110bfb41bf5dc2d8533a7fde37d734
--- /dev/null
+++ b/ui/message_center/views/custom_notification_view.h
@@ -0,0 +1,68 @@
+// Copyright 2016 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_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_
+#define UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_
+
+#include "base/macros.h"
+#include "ui/message_center/message_center_export.h"
+#include "ui/message_center/views/message_view.h"
+
+namespace views {
+class Painter;
+}
+
+namespace message_center {
+
+// View for notification with NOTIFICATION_TYPE_CUSTOM that hosts the custom
+// content of the notification.
+class MESSAGE_CENTER_EXPORT CustomNotificationView : public MessageView {
+ public:
+ static const char kViewClassName[];
+
+ CustomNotificationView(MessageCenterController* controller,
+ const Notification& notification);
+ ~CustomNotificationView() override;
+
+ // These method are called by the content view when focus handling is defered
+ // to the content.
+ void OnContentFocused();
+ void OnContentBlured();
+
+ // Overidden from MessageView:
+ void SetDrawBackgroundAsActive(bool active) override;
+ bool IsCloseButtonFocused() const override;
+ void RequestFocusOnCloseButton() override;
+ bool IsPinned() const override;
+ void UpdateControlButtonsVisibility() override;
+
+ // Overridden from views::View:
+ const char* GetClassName() const override;
+ gfx::Size GetPreferredSize() const override;
+ void Layout() override;
+ bool HasFocus() const override;
+ void RequestFocus() override;
+ void OnPaint(gfx::Canvas* canvas) override;
+ bool OnKeyPressed(const ui::KeyEvent& event) override;
+ void ChildPreferredSizeChanged(View* child) override;
+ bool OnMousePressed(const ui::MouseEvent& event) override;
+
+ views::View* GetContentsViewForTesting() const { return contents_view_; }
+
+ private:
+ friend class CustomNotificationViewTest;
+
+ // The view for the custom content. Owned by view hierarchy.
+ views::View* contents_view_ = nullptr;
+ std::unique_ptr<CustomNotificationContentViewDelegate>
+ contents_view_delegate_;
+
+ std::unique_ptr<views::Painter> focus_painter_;
+
+ DISALLOW_COPY_AND_ASSIGN(CustomNotificationView);
+};
+
+} // namespace message_center
+
+#endif // UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_
« no previous file with comments | « ui/arc/notification/arc_notification_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698