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

Side by Side Diff: ash/system/web_notification/web_notification_tray.cc

Issue 2961313003: Touch gestures for System Tray/ IME/ Stylus/ Notifications (Closed)
Patch Set: Fixed msw's comments. Created 3 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/system/web_notification/web_notification_tray.h" 5 #include "ash/system/web_notification/web_notification_tray.h"
6 6
7 #include "ash/accelerators/accelerator_controller.h" 7 #include "ash/accelerators/accelerator_controller.h"
8 #include "ash/accessibility_delegate.h" 8 #include "ash/accessibility_delegate.h"
9 #include "ash/resources/vector_icons/vector_icons.h" 9 #include "ash/resources/vector_icons/vector_icons.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 bool WebNotificationTray::ShouldShowMessageCenter() const { 393 bool WebNotificationTray::ShouldShowMessageCenter() const {
394 // Hidden at login screen, during supervised user creation, etc. 394 // Hidden at login screen, during supervised user creation, etc.
395 return Shell::Get()->session_controller()->ShouldShowNotificationTray(); 395 return Shell::Get()->session_controller()->ShouldShowNotificationTray();
396 } 396 }
397 397
398 bool WebNotificationTray::IsMessageCenterBubbleVisible() const { 398 bool WebNotificationTray::IsMessageCenterBubbleVisible() const {
399 return (message_center_bubble() && 399 return (message_center_bubble() &&
400 message_center_bubble()->bubble()->IsVisible()); 400 message_center_bubble()->bubble()->IsVisible());
401 } 401 }
402 402
403 void WebNotificationTray::ShowMessageCenterBubble() {
404 if (!IsMessageCenterBubbleVisible())
405 message_center_tray_->ShowMessageCenterBubble();
406 }
407
408 void WebNotificationTray::UpdateAfterLoginStatusChange( 403 void WebNotificationTray::UpdateAfterLoginStatusChange(
409 LoginStatus login_status) { 404 LoginStatus login_status) {
410 message_center()->SetLockedState(login_status == LoginStatus::LOCKED); 405 message_center()->SetLockedState(login_status == LoginStatus::LOCKED);
411 OnMessageCenterTrayChanged(); 406 OnMessageCenterTrayChanged();
412 } 407 }
413 408
414 void WebNotificationTray::UpdateAfterShelfAlignmentChange() { 409 void WebNotificationTray::UpdateAfterShelfAlignmentChange() {
415 TrayBackgroundView::UpdateAfterShelfAlignmentChange(); 410 TrayBackgroundView::UpdateAfterShelfAlignmentChange();
416 // Destroy any existing bubble so that it will be rebuilt correctly. 411 // Destroy any existing bubble so that it will be rebuilt correctly.
417 message_center_tray_->HideMessageCenterBubble(); 412 message_center_tray_->HideMessageCenterBubble();
(...skipping 14 matching lines...) Expand all
432 void WebNotificationTray::HideBubbleWithView( 427 void WebNotificationTray::HideBubbleWithView(
433 const views::TrayBubbleView* bubble_view) { 428 const views::TrayBubbleView* bubble_view) {
434 if (message_center_bubble() && 429 if (message_center_bubble() &&
435 bubble_view == message_center_bubble()->bubble_view()) { 430 bubble_view == message_center_bubble()->bubble_view()) {
436 message_center_tray_->HideMessageCenterBubble(); 431 message_center_tray_->HideMessageCenterBubble();
437 } else if (popup_collection_.get()) { 432 } else if (popup_collection_.get()) {
438 message_center_tray_->HidePopupBubble(); 433 message_center_tray_->HidePopupBubble();
439 } 434 }
440 } 435 }
441 436
442 bool WebNotificationTray::PerformAction(const ui::Event& event) {
443 if (message_center_bubble())
444 message_center_tray_->HideMessageCenterBubble();
445 else
446 message_center_tray_->ShowMessageCenterBubble();
447 return true;
448 }
449
450 void WebNotificationTray::BubbleViewDestroyed() { 437 void WebNotificationTray::BubbleViewDestroyed() {
451 if (message_center_bubble()) 438 if (message_center_bubble())
452 message_center_bubble()->bubble()->BubbleViewDestroyed(); 439 message_center_bubble()->bubble()->BubbleViewDestroyed();
453 } 440 }
454 441
455 void WebNotificationTray::OnMouseEnteredView() {} 442 void WebNotificationTray::OnMouseEnteredView() {}
456 443
457 void WebNotificationTray::OnMouseExitedView() {} 444 void WebNotificationTray::OnMouseExitedView() {}
458 445
459 void WebNotificationTray::RegisterAccelerators( 446 void WebNotificationTray::RegisterAccelerators(
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 583 }
597 584
598 void WebNotificationTray::ClickedOutsideBubble() { 585 void WebNotificationTray::ClickedOutsideBubble() {
599 // Only hide the message center 586 // Only hide the message center
600 if (!message_center_bubble()) 587 if (!message_center_bubble())
601 return; 588 return;
602 589
603 message_center_tray_->HideMessageCenterBubble(); 590 message_center_tray_->HideMessageCenterBubble();
604 } 591 }
605 592
593 bool WebNotificationTray::PerformAction(const ui::Event& event) {
594 if (message_center_bubble())
595 message_center_tray_->HideMessageCenterBubble();
596 else
597 message_center_tray_->ShowMessageCenterBubble();
598 return true;
599 }
600
601 void WebNotificationTray::CloseBubble() {
602 message_center_tray_->HideMessageCenterBubble();
603 }
604
605 void WebNotificationTray::ShowBubble() {
606 if (!IsMessageCenterBubbleVisible())
607 message_center_tray_->ShowMessageCenterBubble();
608 }
609
610 views::TrayBubbleView* WebNotificationTray::GetBubbleView() {
611 return message_center_bubble_ ? message_center_bubble_->bubble_view()
612 : nullptr;
613 }
614
606 message_center::MessageCenter* WebNotificationTray::message_center() const { 615 message_center::MessageCenter* WebNotificationTray::message_center() const {
607 return message_center_tray_->message_center(); 616 return message_center_tray_->message_center();
608 } 617 }
609 618
610 // Methods for testing 619 // Methods for testing
611 620
612 bool WebNotificationTray::IsPopupVisible() const { 621 bool WebNotificationTray::IsPopupVisible() const {
613 return message_center_tray_->popups_visible(); 622 return message_center_tray_->popups_visible();
614 } 623 }
615 624
616 message_center::MessageCenterBubble* 625 message_center::MessageCenterBubble*
617 WebNotificationTray::GetMessageCenterBubbleForTest() { 626 WebNotificationTray::GetMessageCenterBubbleForTest() {
618 if (!message_center_bubble()) 627 if (!message_center_bubble())
619 return nullptr; 628 return nullptr;
620 return static_cast<message_center::MessageCenterBubble*>( 629 return static_cast<message_center::MessageCenterBubble*>(
621 message_center_bubble()->bubble()); 630 message_center_bubble()->bubble());
622 } 631 }
623 632
624 } // namespace ash 633 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698