| Index: ui/arc/notification/arc_notification_content_view.cc
|
| diff --git a/ui/arc/notification/arc_custom_notification_view.cc b/ui/arc/notification/arc_notification_content_view.cc
|
| similarity index 86%
|
| rename from ui/arc/notification/arc_custom_notification_view.cc
|
| rename to ui/arc/notification/arc_notification_content_view.cc
|
| index c84e64642e490599258fa8245a8c856e11661246..0335bb3b5d6466188965b53e811f294704ec5fcf 100644
|
| --- a/ui/arc/notification/arc_custom_notification_view.cc
|
| +++ b/ui/arc/notification/arc_notification_content_view.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "ui/arc/notification/arc_custom_notification_view.h"
|
| +#include "ui/arc/notification/arc_notification_content_view.h"
|
|
|
| #include "ash/wm/window_util.h"
|
| #include "base/auto_reset.h"
|
| @@ -48,9 +48,9 @@ SkColor GetControlButtonBackgroundColor(
|
|
|
| } // namespace
|
|
|
| -class ArcCustomNotificationView::EventForwarder : public ui::EventHandler {
|
| +class ArcNotificationContentView::EventForwarder : public ui::EventHandler {
|
| public:
|
| - explicit EventForwarder(ArcCustomNotificationView* owner) : owner_(owner) {}
|
| + explicit EventForwarder(ArcNotificationContentView* owner) : owner_(owner) {}
|
| ~EventForwarder() override = default;
|
|
|
| private:
|
| @@ -96,15 +96,15 @@ class ArcCustomNotificationView::EventForwarder : public ui::EventHandler {
|
| }
|
| }
|
|
|
| - ArcCustomNotificationView* const owner_;
|
| + ArcNotificationContentView* const owner_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(EventForwarder);
|
| };
|
|
|
| -class ArcCustomNotificationView::SlideHelper
|
| +class ArcNotificationContentView::SlideHelper
|
| : public ui::LayerAnimationObserver {
|
| public:
|
| - explicit SlideHelper(ArcCustomNotificationView* owner) : owner_(owner) {
|
| + explicit SlideHelper(ArcNotificationContentView* owner) : owner_(owner) {
|
| GetSlideOutLayer()->GetAnimator()->AddObserver(this);
|
|
|
| // Reset opacity to 1 to handle to case when the surface is sliding before
|
| @@ -168,17 +168,17 @@ class ArcCustomNotificationView::SlideHelper
|
| }
|
| void OnLayerAnimationScheduled(ui::LayerAnimationSequence* seq) override {}
|
|
|
| - ArcCustomNotificationView* const owner_;
|
| + ArcNotificationContentView* const owner_;
|
| bool sliding_ = false;
|
| std::unique_ptr<ui::LayerTreeOwner> surface_copy_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(SlideHelper);
|
| };
|
|
|
| -class ArcCustomNotificationView::ContentViewDelegate
|
| +class ArcNotificationContentView::ContentViewDelegate
|
| : public ArcNotificationContentViewDelegate {
|
| public:
|
| - explicit ContentViewDelegate(ArcCustomNotificationView* owner)
|
| + explicit ContentViewDelegate(ArcNotificationContentView* owner)
|
| : owner_(owner) {}
|
|
|
| bool IsCloseButtonFocused() const override {
|
| @@ -203,13 +203,13 @@ class ArcCustomNotificationView::ContentViewDelegate
|
| }
|
|
|
| private:
|
| - ArcCustomNotificationView* const owner_;
|
| + ArcNotificationContentView* const owner_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ContentViewDelegate);
|
| };
|
|
|
| -ArcCustomNotificationView::ControlButton::ControlButton(
|
| - ArcCustomNotificationView* owner)
|
| +ArcNotificationContentView::ControlButton::ControlButton(
|
| + ArcNotificationContentView* owner)
|
| : message_center::PaddedButton(owner), owner_(owner) {
|
| if (owner_->item_) {
|
| set_background(views::Background::CreateSolidBackground(
|
| @@ -220,17 +220,18 @@ ArcCustomNotificationView::ControlButton::ControlButton(
|
| }
|
| }
|
|
|
| -void ArcCustomNotificationView::ControlButton::OnFocus() {
|
| +void ArcNotificationContentView::ControlButton::OnFocus() {
|
| message_center::PaddedButton::OnFocus();
|
| owner_->UpdateControlButtonsVisibility();
|
| }
|
|
|
| -void ArcCustomNotificationView::ControlButton::OnBlur() {
|
| +void ArcNotificationContentView::ControlButton::OnBlur() {
|
| message_center::PaddedButton::OnBlur();
|
| owner_->UpdateControlButtonsVisibility();
|
| }
|
|
|
| -ArcCustomNotificationView::ArcCustomNotificationView(ArcNotificationItem* item)
|
| +ArcNotificationContentView::ArcNotificationContentView(
|
| + ArcNotificationItem* item)
|
| : item_(item),
|
| notification_key_(item->GetNotificationKey()),
|
| event_forwarder_(new EventForwarder(this)) {
|
| @@ -253,7 +254,7 @@ ArcCustomNotificationView::ArcCustomNotificationView(ArcNotificationItem* item)
|
| UpdatePreferredSize();
|
| }
|
|
|
| -ArcCustomNotificationView::~ArcCustomNotificationView() {
|
| +ArcNotificationContentView::~ArcNotificationContentView() {
|
| SetSurface(nullptr);
|
|
|
| auto* surface_manager = ArcNotificationSurfaceManager::Get();
|
| @@ -266,11 +267,12 @@ ArcCustomNotificationView::~ArcCustomNotificationView() {
|
| }
|
|
|
| std::unique_ptr<ArcNotificationContentViewDelegate>
|
| -ArcCustomNotificationView::CreateContentViewDelegate() {
|
| - return base::MakeUnique<ArcCustomNotificationView::ContentViewDelegate>(this);
|
| +ArcNotificationContentView::CreateContentViewDelegate() {
|
| + return base::MakeUnique<ArcNotificationContentView::ContentViewDelegate>(
|
| + this);
|
| }
|
|
|
| -void ArcCustomNotificationView::CreateCloseButton() {
|
| +void ArcNotificationContentView::CreateCloseButton() {
|
| DCHECK(control_buttons_view_);
|
| DCHECK(item_);
|
|
|
| @@ -285,7 +287,7 @@ void ArcCustomNotificationView::CreateCloseButton() {
|
| control_buttons_view_->AddChildView(close_button_.get());
|
| }
|
|
|
| -void ArcCustomNotificationView::CreateSettingsButton() {
|
| +void ArcNotificationContentView::CreateSettingsButton() {
|
| DCHECK(control_buttons_view_);
|
| DCHECK(item_);
|
|
|
| @@ -299,7 +301,7 @@ void ArcCustomNotificationView::CreateSettingsButton() {
|
| control_buttons_view_->AddChildView(settings_button_);
|
| }
|
|
|
| -void ArcCustomNotificationView::MaybeCreateFloatingControlButtons() {
|
| +void ArcNotificationContentView::MaybeCreateFloatingControlButtons() {
|
| // Floating close button is a transient child of |surface_| and also part
|
| // of the hosting widget's focus chain. It could only be created when both
|
| // are present. Further, if we are being destroyed (|item_| is null), don't
|
| @@ -335,7 +337,7 @@ void ArcCustomNotificationView::MaybeCreateFloatingControlButtons() {
|
| Layout();
|
| }
|
|
|
| -void ArcCustomNotificationView::SetSurface(exo::NotificationSurface* surface) {
|
| +void ArcNotificationContentView::SetSurface(exo::NotificationSurface* surface) {
|
| if (surface_ == surface)
|
| return;
|
|
|
| @@ -363,7 +365,7 @@ void ArcCustomNotificationView::SetSurface(exo::NotificationSurface* surface) {
|
| }
|
| }
|
|
|
| -void ArcCustomNotificationView::UpdatePreferredSize() {
|
| +void ArcNotificationContentView::UpdatePreferredSize() {
|
| gfx::Size preferred_size;
|
| if (surface_)
|
| preferred_size = surface_->GetSize();
|
| @@ -383,7 +385,7 @@ void ArcCustomNotificationView::UpdatePreferredSize() {
|
| SetPreferredSize(preferred_size);
|
| }
|
|
|
| -void ArcCustomNotificationView::UpdateControlButtonsVisibility() {
|
| +void ArcNotificationContentView::UpdateControlButtonsVisibility() {
|
| if (!surface_)
|
| return;
|
|
|
| @@ -412,7 +414,7 @@ void ArcCustomNotificationView::UpdateControlButtonsVisibility() {
|
| floating_control_buttons_widget_->Hide();
|
| }
|
|
|
| -void ArcCustomNotificationView::UpdatePinnedState() {
|
| +void ArcNotificationContentView::UpdatePinnedState() {
|
| if (!item_)
|
| return;
|
|
|
| @@ -426,7 +428,7 @@ void ArcCustomNotificationView::UpdatePinnedState() {
|
| }
|
| }
|
|
|
| -void ArcCustomNotificationView::UpdateSnapshot() {
|
| +void ArcNotificationContentView::UpdateSnapshot() {
|
| // Bail if we have a |surface_| because it controls the sizes and paints UI.
|
| if (surface_)
|
| return;
|
| @@ -435,7 +437,7 @@ void ArcCustomNotificationView::UpdateSnapshot() {
|
| SchedulePaint();
|
| }
|
|
|
| -void ArcCustomNotificationView::AttachSurface() {
|
| +void ArcNotificationContentView::AttachSurface() {
|
| if (!GetWidget())
|
| return;
|
|
|
| @@ -459,7 +461,7 @@ void ArcCustomNotificationView::AttachSurface() {
|
| UpdatePinnedState();
|
| }
|
|
|
| -void ArcCustomNotificationView::StartControlButtonsColorAnimation() {
|
| +void ArcNotificationContentView::StartControlButtonsColorAnimation() {
|
| if (control_button_color_animation_)
|
| control_button_color_animation_->End();
|
| control_button_color_animation_.reset(new gfx::LinearAnimation(this));
|
| @@ -467,7 +469,7 @@ void ArcCustomNotificationView::StartControlButtonsColorAnimation() {
|
| control_button_color_animation_->Start();
|
| }
|
|
|
| -bool ArcCustomNotificationView::ShouldUpdateControlButtonsColor() const {
|
| +bool ArcNotificationContentView::ShouldUpdateControlButtonsColor() const {
|
| // Don't update the control button color when we are about to be destroyed.
|
| if (!item_)
|
| return false;
|
| @@ -483,7 +485,7 @@ bool ArcCustomNotificationView::ShouldUpdateControlButtonsColor() const {
|
| return false;
|
| }
|
|
|
| -void ArcCustomNotificationView::ViewHierarchyChanged(
|
| +void ArcNotificationContentView::ViewHierarchyChanged(
|
| const views::View::ViewHierarchyChangedDetails& details) {
|
| views::Widget* widget = GetWidget();
|
|
|
| @@ -493,9 +495,9 @@ void ArcCustomNotificationView::ViewHierarchyChanged(
|
|
|
| // Bail if this view is no longer attached to a widget or native_view() has
|
| // attached to a different widget.
|
| - if (!widget || (native_view() &&
|
| - views::Widget::GetTopLevelWidgetForNativeView(
|
| - native_view()) != widget)) {
|
| + if (!widget ||
|
| + (native_view() && views::Widget::GetTopLevelWidgetForNativeView(
|
| + native_view()) != widget)) {
|
| return;
|
| }
|
| }
|
| @@ -508,7 +510,7 @@ void ArcCustomNotificationView::ViewHierarchyChanged(
|
| AttachSurface();
|
| }
|
|
|
| -void ArcCustomNotificationView::Layout() {
|
| +void ArcNotificationContentView::Layout() {
|
| base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true);
|
|
|
| views::NativeViewHost::Layout();
|
| @@ -559,7 +561,7 @@ void ArcCustomNotificationView::Layout() {
|
| ash::wm::SnapWindowToPixelBoundary(surface_->window());
|
| }
|
|
|
| -void ArcCustomNotificationView::OnPaint(gfx::Canvas* canvas) {
|
| +void ArcNotificationContentView::OnPaint(gfx::Canvas* canvas) {
|
| views::NativeViewHost::OnPaint(canvas);
|
|
|
| // Bail if there is a |surface_| or no item or no snapshot image.
|
| @@ -572,22 +574,22 @@ void ArcCustomNotificationView::OnPaint(gfx::Canvas* canvas) {
|
| contents_bounds.height(), false);
|
| }
|
|
|
| -void ArcCustomNotificationView::OnMouseEntered(const ui::MouseEvent&) {
|
| +void ArcNotificationContentView::OnMouseEntered(const ui::MouseEvent&) {
|
| UpdateControlButtonsVisibility();
|
| }
|
|
|
| -void ArcCustomNotificationView::OnMouseExited(const ui::MouseEvent&) {
|
| +void ArcNotificationContentView::OnMouseExited(const ui::MouseEvent&) {
|
| UpdateControlButtonsVisibility();
|
| }
|
|
|
| -void ArcCustomNotificationView::OnFocus() {
|
| +void ArcNotificationContentView::OnFocus() {
|
| CHECK_EQ(ArcNotificationView::kViewClassName, parent()->GetClassName());
|
|
|
| NativeViewHost::OnFocus();
|
| static_cast<ArcNotificationView*>(parent())->OnContentFocused();
|
| }
|
|
|
| -void ArcCustomNotificationView::OnBlur() {
|
| +void ArcNotificationContentView::OnBlur() {
|
| if (!parent()) {
|
| // OnBlur may be called when this view is being removed.
|
| return;
|
| @@ -599,7 +601,7 @@ void ArcCustomNotificationView::OnBlur() {
|
| static_cast<ArcNotificationView*>(parent())->OnContentBlured();
|
| }
|
|
|
| -void ArcCustomNotificationView::ActivateToast() {
|
| +void ArcNotificationContentView::ActivateToast() {
|
| if (message_center::ToastContentsView::kViewClassName ==
|
| parent()->parent()->GetClassName()) {
|
| static_cast<message_center::ToastContentsView*>(parent()->parent())
|
| @@ -607,14 +609,14 @@ void ArcCustomNotificationView::ActivateToast() {
|
| }
|
| }
|
|
|
| -views::FocusTraversable* ArcCustomNotificationView::GetFocusTraversable() {
|
| +views::FocusTraversable* ArcNotificationContentView::GetFocusTraversable() {
|
| if (floating_control_buttons_widget_)
|
| return static_cast<views::internal::RootView*>(
|
| floating_control_buttons_widget_->GetRootView());
|
| return nullptr;
|
| }
|
|
|
| -bool ArcCustomNotificationView::HandleAccessibleAction(
|
| +bool ArcNotificationContentView::HandleAccessibleAction(
|
| const ui::AXActionData& action_data) {
|
| if (item_ && action_data.action == ui::AX_ACTION_DO_DEFAULT) {
|
| item_->ToggleExpansion();
|
| @@ -623,8 +625,8 @@ bool ArcCustomNotificationView::HandleAccessibleAction(
|
| return false;
|
| }
|
|
|
| -void ArcCustomNotificationView::ButtonPressed(views::Button* sender,
|
| - const ui::Event& event) {
|
| +void ArcNotificationContentView::ButtonPressed(views::Button* sender,
|
| + const ui::Event& event) {
|
| if (item_ && !item_->GetPinned() && sender == close_button_.get()) {
|
| CHECK_EQ(ArcNotificationView::kViewClassName, parent()->GetClassName());
|
| static_cast<ArcNotificationView*>(parent())->OnCloseButtonPressed();
|
| @@ -634,7 +636,7 @@ void ArcCustomNotificationView::ButtonPressed(views::Button* sender,
|
| }
|
| }
|
|
|
| -void ArcCustomNotificationView::OnWindowBoundsChanged(
|
| +void ArcNotificationContentView::OnWindowBoundsChanged(
|
| aura::Window* window,
|
| const gfx::Rect& old_bounds,
|
| const gfx::Rect& new_bounds) {
|
| @@ -645,11 +647,11 @@ void ArcCustomNotificationView::OnWindowBoundsChanged(
|
| Layout();
|
| }
|
|
|
| -void ArcCustomNotificationView::OnWindowDestroying(aura::Window* window) {
|
| +void ArcNotificationContentView::OnWindowDestroying(aura::Window* window) {
|
| SetSurface(nullptr);
|
| }
|
|
|
| -void ArcCustomNotificationView::OnItemDestroying() {
|
| +void ArcNotificationContentView::OnItemDestroying() {
|
| item_->RemoveObserver(this);
|
| item_ = nullptr;
|
|
|
| @@ -658,14 +660,14 @@ void ArcCustomNotificationView::OnItemDestroying() {
|
| SetSurface(nullptr);
|
| }
|
|
|
| -void ArcCustomNotificationView::OnItemUpdated() {
|
| +void ArcNotificationContentView::OnItemUpdated() {
|
| UpdatePinnedState();
|
| UpdateSnapshot();
|
| if (ShouldUpdateControlButtonsColor())
|
| StartControlButtonsColorAnimation();
|
| }
|
|
|
| -void ArcCustomNotificationView::OnNotificationSurfaceAdded(
|
| +void ArcNotificationContentView::OnNotificationSurfaceAdded(
|
| exo::NotificationSurface* surface) {
|
| if (surface->notification_id() != notification_key_)
|
| return;
|
| @@ -673,7 +675,7 @@ void ArcCustomNotificationView::OnNotificationSurfaceAdded(
|
| SetSurface(surface);
|
| }
|
|
|
| -void ArcCustomNotificationView::OnNotificationSurfaceRemoved(
|
| +void ArcNotificationContentView::OnNotificationSurfaceRemoved(
|
| exo::NotificationSurface* surface) {
|
| if (surface->notification_id() != notification_key_)
|
| return;
|
| @@ -681,13 +683,13 @@ void ArcCustomNotificationView::OnNotificationSurfaceRemoved(
|
| SetSurface(nullptr);
|
| }
|
|
|
| -void ArcCustomNotificationView::AnimationEnded(
|
| +void ArcNotificationContentView::AnimationEnded(
|
| const gfx::Animation* animation) {
|
| DCHECK_EQ(animation, control_button_color_animation_.get());
|
| control_button_color_animation_.reset();
|
| }
|
|
|
| -void ArcCustomNotificationView::AnimationProgressed(
|
| +void ArcNotificationContentView::AnimationProgressed(
|
| const gfx::Animation* animation) {
|
| DCHECK_EQ(animation, control_button_color_animation_.get());
|
|
|
|
|