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

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

Issue 2668583005: Not Remove Non-Closable Arc Popup When Close Button is Pressed (Closed)
Patch Set: Created 3 years, 10 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 UpdateCloseButtonVisiblity(); 482 UpdateCloseButtonVisiblity();
483 } 483 }
484 484
485 void ArcCustomNotificationView::OnFocus() { 485 void ArcCustomNotificationView::OnFocus() {
486 NativeViewHost::OnFocus(); 486 NativeViewHost::OnFocus();
487 static_cast<message_center::CustomNotificationView*>(parent()) 487 static_cast<message_center::CustomNotificationView*>(parent())
488 ->OnContentFocused(); 488 ->OnContentFocused();
489 } 489 }
490 490
491 void ArcCustomNotificationView::OnBlur() { 491 void ArcCustomNotificationView::OnBlur() {
492 CHECK_EQ(message_center::CustomNotificationView::kViewClassName,
dewittj 2017/02/28 21:38:48 Unclear to me whether this should be CHECK or DCHE
yoshiki 2017/03/02 03:33:35 I'm adding a test, which checks CHECK for ButtonPr
493 parent()->GetClassName());
494
492 NativeViewHost::OnBlur(); 495 NativeViewHost::OnBlur();
493 static_cast<message_center::CustomNotificationView*>(parent()) 496 static_cast<message_center::CustomNotificationView*>(parent())
494 ->OnContentBlured(); 497 ->OnContentBlured();
495 } 498 }
496 499
497 views::FocusTraversable* ArcCustomNotificationView::GetFocusTraversable() { 500 views::FocusTraversable* ArcCustomNotificationView::GetFocusTraversable() {
501 CHECK_EQ(message_center::CustomNotificationView::kViewClassName,
dewittj 2017/02/28 21:38:48 this doesn't seem to be relevant here?
yoshiki 2017/03/02 03:33:35 Good catch. This should be in OnFocus() instead of
502 parent()->GetClassName());
503
498 if (floating_close_button_widget_) 504 if (floating_close_button_widget_)
499 return static_cast<views::internal::RootView*>( 505 return static_cast<views::internal::RootView*>(
500 floating_close_button_widget_->GetRootView()); 506 floating_close_button_widget_->GetRootView());
501 return nullptr; 507 return nullptr;
502 } 508 }
503 509
504 void ArcCustomNotificationView::ButtonPressed(views::Button* sender, 510 void ArcCustomNotificationView::ButtonPressed(views::Button* sender,
505 const ui::Event& event) { 511 const ui::Event& event) {
512 CHECK_EQ(message_center::CustomNotificationView::kViewClassName,
513 parent()->GetClassName());
506 if (item_ && !item_->pinned() && sender == floating_close_button_) { 514 if (item_ && !item_->pinned() && sender == floating_close_button_) {
507 item_->CloseFromCloseButton(); 515 static_cast<message_center::CustomNotificationView*>(parent())
516 ->OnCloseButtonPressed();
508 } 517 }
509 } 518 }
510 519
511 void ArcCustomNotificationView::OnWindowBoundsChanged( 520 void ArcCustomNotificationView::OnWindowBoundsChanged(
512 aura::Window* window, 521 aura::Window* window,
513 const gfx::Rect& old_bounds, 522 const gfx::Rect& old_bounds,
514 const gfx::Rect& new_bounds) { 523 const gfx::Rect& new_bounds) {
515 if (in_layout_) 524 if (in_layout_)
516 return; 525 return;
517 526
(...skipping 29 matching lines...) Expand all
547 556
548 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( 557 void ArcCustomNotificationView::OnNotificationSurfaceRemoved(
549 exo::NotificationSurface* surface) { 558 exo::NotificationSurface* surface) {
550 if (surface->notification_id() != notification_key_) 559 if (surface->notification_id() != notification_key_)
551 return; 560 return;
552 561
553 SetSurface(nullptr); 562 SetSurface(nullptr);
554 } 563 }
555 564
556 } // namespace arc 565 } // namespace arc
OLDNEW
« no previous file with comments | « ui/arc/notification/arc_custom_notification_view.h ('k') | ui/message_center/views/custom_notification_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698