Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/arc/notification/arc_custom_notification_view.h" | 5 #include "ui/arc/notification/arc_custom_notification_view.h" |
| 6 | 6 |
| 7 #include "ash/wm/window_util.h" | 7 #include "ash/wm/window_util.h" |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "components/exo/notification_surface.h" | 10 #include "components/exo/notification_surface.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 void OnBlur() override { | 215 void OnBlur() override { |
| 216 views::ImageButton::OnBlur(); | 216 views::ImageButton::OnBlur(); |
| 217 owner_->UpdateCloseButtonVisiblity(); | 217 owner_->UpdateCloseButtonVisiblity(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 private: | 220 private: |
| 221 ArcCustomNotificationView* const owner_; | 221 ArcCustomNotificationView* const owner_; |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 ArcCustomNotificationView::ArcCustomNotificationView( | 224 ArcCustomNotificationView::ArcCustomNotificationView( |
| 225 ArcCustomNotificationItem* item) | 225 ArcCustomNotificationItem* item, |
| 226 message_center::MessageView* parent) | |
| 226 : item_(item), | 227 : item_(item), |
| 228 parent_(parent), | |
| 227 notification_key_(item->notification_key()), | 229 notification_key_(item->notification_key()), |
| 228 event_forwarder_(new EventForwarder(this)) { | 230 event_forwarder_(new EventForwarder(this)) { |
| 229 SetFocusBehavior(FocusBehavior::ALWAYS); | 231 SetFocusBehavior(FocusBehavior::ALWAYS); |
| 230 | 232 |
| 231 item_->IncrementWindowRefCount(); | 233 item_->IncrementWindowRefCount(); |
| 232 item_->AddObserver(this); | 234 item_->AddObserver(this); |
| 233 | 235 |
| 234 ArcNotificationSurfaceManager::Get()->AddObserver(this); | 236 ArcNotificationSurfaceManager::Get()->AddObserver(this); |
| 235 exo::NotificationSurface* surface = | 237 exo::NotificationSurface* surface = |
| 236 ArcNotificationSurfaceManager::Get()->GetSurface(notification_key_); | 238 ArcNotificationSurfaceManager::Get()->GetSurface(notification_key_); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 views::FocusTraversable* ArcCustomNotificationView::GetFocusTraversable() { | 499 views::FocusTraversable* ArcCustomNotificationView::GetFocusTraversable() { |
| 498 if (floating_close_button_widget_) | 500 if (floating_close_button_widget_) |
| 499 return static_cast<views::internal::RootView*>( | 501 return static_cast<views::internal::RootView*>( |
| 500 floating_close_button_widget_->GetRootView()); | 502 floating_close_button_widget_->GetRootView()); |
| 501 return nullptr; | 503 return nullptr; |
| 502 } | 504 } |
| 503 | 505 |
| 504 void ArcCustomNotificationView::ButtonPressed(views::Button* sender, | 506 void ArcCustomNotificationView::ButtonPressed(views::Button* sender, |
| 505 const ui::Event& event) { | 507 const ui::Event& event) { |
| 506 if (item_ && !item_->pinned() && sender == floating_close_button_) { | 508 if (item_ && !item_->pinned() && sender == floating_close_button_) { |
| 507 item_->CloseFromCloseButton(); | 509 parent_->OnCloseButtonPressed(); |
|
dewittj
2017/02/07 00:03:11
any reason you didn't just use views::View::parent
yoshiki
2017/02/22 08:55:23
Thanks. I changed the code with using parent(). PT
| |
| 508 } | 510 } |
| 509 } | 511 } |
| 510 | 512 |
| 511 void ArcCustomNotificationView::OnWindowBoundsChanged( | 513 void ArcCustomNotificationView::OnWindowBoundsChanged( |
| 512 aura::Window* window, | 514 aura::Window* window, |
| 513 const gfx::Rect& old_bounds, | 515 const gfx::Rect& old_bounds, |
| 514 const gfx::Rect& new_bounds) { | 516 const gfx::Rect& new_bounds) { |
| 515 if (in_layout_) | 517 if (in_layout_) |
| 516 return; | 518 return; |
| 517 | 519 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 547 | 549 |
| 548 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( | 550 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( |
| 549 exo::NotificationSurface* surface) { | 551 exo::NotificationSurface* surface) { |
| 550 if (surface->notification_id() != notification_key_) | 552 if (surface->notification_id() != notification_key_) |
| 551 return; | 553 return; |
| 552 | 554 |
| 553 SetSurface(nullptr); | 555 SetSurface(nullptr); |
| 554 } | 556 } |
| 555 | 557 |
| 556 } // namespace arc | 558 } // namespace arc |
| OLD | NEW |