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

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: remove the unused variable Created 3 years, 9 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() !=
558 message_center::NotificationExpandState::FIXED_SIZE &&
559 event.target() != surface_->window()) {
560 item_->ToggleExpansion();
561 return true;
562 }
563 return false;
564 }
565
550 void ArcCustomNotificationView::ButtonPressed(views::Button* sender, 566 void ArcCustomNotificationView::ButtonPressed(views::Button* sender,
551 const ui::Event& event) { 567 const ui::Event& event) {
552 if (item_ && !item_->pinned() && sender == close_button_.get()) { 568 if (item_ && !item_->pinned() && sender == close_button_.get()) {
553 CHECK_EQ(message_center::CustomNotificationView::kViewClassName, 569 CHECK_EQ(message_center::CustomNotificationView::kViewClassName,
554 parent()->GetClassName()); 570 parent()->GetClassName());
555 static_cast<message_center::CustomNotificationView*>(parent()) 571 static_cast<message_center::CustomNotificationView*>(parent())
556 ->OnCloseButtonPressed(); 572 ->OnCloseButtonPressed();
557 } 573 }
558 if (item_ && settings_button_ && sender == settings_button_) { 574 if (item_ && settings_button_ && sender == settings_button_) {
559 item_->OpenSettings(); 575 item_->OpenSettings();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 615
600 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( 616 void ArcCustomNotificationView::OnNotificationSurfaceRemoved(
601 exo::NotificationSurface* surface) { 617 exo::NotificationSurface* surface) {
602 if (surface->notification_id() != notification_key_) 618 if (surface->notification_id() != notification_key_)
603 return; 619 return;
604 620
605 SetSurface(nullptr); 621 SetSurface(nullptr);
606 } 622 }
607 623
608 } // namespace arc 624 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698