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

Side by Side Diff: ui/arc/notification/arc_custom_notification_view.cc

Issue 2767253005: Implement TOGGLE_EXPANSION action for the ARC notifications. (Closed)
Patch Set: rebase Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 } 540 }
541 } 541 }
542 542
543 views::FocusTraversable* ArcCustomNotificationView::GetFocusTraversable() { 543 views::FocusTraversable* ArcCustomNotificationView::GetFocusTraversable() {
544 if (floating_control_buttons_widget_) 544 if (floating_control_buttons_widget_)
545 return static_cast<views::internal::RootView*>( 545 return static_cast<views::internal::RootView*>(
546 floating_control_buttons_widget_->GetRootView()); 546 floating_control_buttons_widget_->GetRootView());
547 return nullptr; 547 return nullptr;
548 } 548 }
549 549
550 bool ArcCustomNotificationView::OnMousePressed(const ui::MouseEvent& event) {
551 // TODO(yhanada): Remove this hack as soon as possible after letting
552 // accessible actions be delivered to this view.
553 // All mouse clicks or touches should be sent to corresponding Android view
554 // because the surface is on this view, so receiving a mouse pressed event
555 // means the event is generated by automation API.
556 if (event.IsOnlyLeftMouseButton() &&
557 item_->expand_state() != mojom::ArcNotificationExpandState::FIXED_SIZE &&
558 event.target() != surface_->window()) {
559 item_->ToggleExpansion();
560 return true;
561 }
562 return false;
563 }
564
550 void ArcCustomNotificationView::ButtonPressed(views::Button* sender, 565 void ArcCustomNotificationView::ButtonPressed(views::Button* sender,
551 const ui::Event& event) { 566 const ui::Event& event) {
552 if (item_ && !item_->pinned() && sender == close_button_.get()) { 567 if (item_ && !item_->pinned() && sender == close_button_.get()) {
553 CHECK_EQ(message_center::CustomNotificationView::kViewClassName, 568 CHECK_EQ(message_center::CustomNotificationView::kViewClassName,
554 parent()->GetClassName()); 569 parent()->GetClassName());
555 static_cast<message_center::CustomNotificationView*>(parent()) 570 static_cast<message_center::CustomNotificationView*>(parent())
556 ->OnCloseButtonPressed(); 571 ->OnCloseButtonPressed();
557 } 572 }
558 if (item_ && settings_button_ && sender == settings_button_) { 573 if (item_ && settings_button_ && sender == settings_button_) {
559 item_->OpenSettings(); 574 item_->OpenSettings();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 614
600 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( 615 void ArcCustomNotificationView::OnNotificationSurfaceRemoved(
601 exo::NotificationSurface* surface) { 616 exo::NotificationSurface* surface) {
602 if (surface->notification_id() != notification_key_) 617 if (surface->notification_id() != notification_key_)
603 return; 618 return;
604 619
605 SetSurface(nullptr); 620 SetSurface(nullptr);
606 } 621 }
607 622
608 } // namespace arc 623 } // namespace arc
OLDNEW
« no previous file with comments | « ui/arc/notification/arc_custom_notification_view.h ('k') | ui/arc/notification/arc_notification_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698