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

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

Issue 2863163002: Fix ARC notification crash. (Closed)
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 57c03447773177b2bc22842c18d16fb401c21205..7c72f3a57cbfc93cd3a867081fc23abef981f56a 100644
--- a/ui/arc/notification/arc_custom_notification_view.cc
+++ b/ui/arc/notification/arc_custom_notification_view.cc
@@ -110,7 +110,7 @@ class ArcCustomNotificationView::SlideHelper
: public ui::LayerAnimationObserver {
public:
explicit SlideHelper(ArcCustomNotificationView* owner) : owner_(owner) {
- owner_->parent()->layer()->GetAnimator()->AddObserver(this);
+ GetSlideOutLayer()->GetAnimator()->AddObserver(this);
// Reset opacity to 1 to handle to case when the surface is sliding before
// getting managed by this class, e.g. sliding in a popup before showing
@@ -119,13 +119,13 @@ class ArcCustomNotificationView::SlideHelper
owner_->surface_->window()->layer()->SetOpacity(1.0f);
}
~SlideHelper() override {
- owner_->parent()->layer()->GetAnimator()->RemoveObserver(this);
+ GetSlideOutLayer()->GetAnimator()->RemoveObserver(this);
}
void Update() {
const bool has_animation =
- owner_->parent()->layer()->GetAnimator()->is_animating();
- const bool has_transform = !owner_->parent()->GetTransform().IsIdentity();
+ GetSlideOutLayer()->GetAnimator()->is_animating();
+ const bool has_transform = !GetSlideOutLayer()->transform().IsIdentity();
const bool sliding = has_transform || has_animation;
if (sliding_ == sliding)
return;
@@ -139,6 +139,12 @@ class ArcCustomNotificationView::SlideHelper
}
private:
+ // This is a temporary hack to address crbug.com/718965
+ ui::Layer* GetSlideOutLayer() {
+ ui::Layer* layer = owner_->parent()->layer();
+ return layer ? layer : owner_->GetWidget()->GetLayer();
+ }
+
void OnSlideStart() {
if (!owner_->surface_ || !owner_->surface_->window())
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698