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

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

Issue 2723143002: Add unittests of ArcCustomNotificationView (Closed)
Patch Set: Created 3 years, 10 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.cc
diff --git a/ui/arc/notification/arc_custom_notification_view.cc b/ui/arc/notification/arc_custom_notification_view.cc
index b622f420755237ce93700d03a26ce68e2073049f..f21b2714dbd4f3dbc0b086c6d1bf619db65ee669 100644
--- a/ui/arc/notification/arc_custom_notification_view.cc
+++ b/ui/arc/notification/arc_custom_notification_view.cc
@@ -200,8 +200,11 @@ class ArcCustomNotificationView::ControlButton
ArcCustomNotificationView* const owner_;
};
-ArcCustomNotificationView::ArcCustomNotificationView(
- ArcCustomNotificationItem* item)
+// static
+const char ArcCustomNotificationView::kViewClassName[] =
+ "ArcCustomNotificationView";
+
+ArcCustomNotificationView::ArcCustomNotificationView(ArcNotificationItem* item)
: item_(item),
notification_key_(item->notification_key()),
event_forwarder_(new EventForwarder(this)) {
@@ -210,11 +213,13 @@ ArcCustomNotificationView::ArcCustomNotificationView(
item_->IncrementWindowRefCount();
item_->AddObserver(this);
- ArcNotificationSurfaceManager::Get()->AddObserver(this);
- exo::NotificationSurface* surface =
- ArcNotificationSurfaceManager::Get()->GetSurface(notification_key_);
- if (surface)
- OnNotificationSurfaceAdded(surface);
+ if (ArcNotificationSurfaceManager::Get()) {
+ ArcNotificationSurfaceManager::Get()->AddObserver(this);
+ exo::NotificationSurface* surface =
+ ArcNotificationSurfaceManager::Get()->GetSurface(notification_key_);
+ if (surface)
+ OnNotificationSurfaceAdded(surface);
+ }
// Create a layer as an anchor to insert surface copy during a slide.
SetPaintToLayer();
@@ -232,6 +237,10 @@ ArcCustomNotificationView::~ArcCustomNotificationView() {
ArcNotificationSurfaceManager::Get()->RemoveObserver(this);
}
+const char* ArcCustomNotificationView::GetClassName() const {
+ return kViewClassName;
+}
+
std::unique_ptr<message_center::CustomNotificationContentViewDelegate>
ArcCustomNotificationView::CreateContentViewDelegate() {
return base::MakeUnique<ArcCustomNotificationView::ContentViewDelegate>(this);
@@ -366,7 +375,7 @@ void ArcCustomNotificationView::AttachSurface() {
return;
UpdatePreferredSize();
- Attach(surface_->window());
+ surface_->AttachWindow(this);
// The texture for this window can be placed at subpixel position
// with fractional scale factor. Force to align it at the pixel

Powered by Google App Engine
This is Rietveld 408576698