OLD | NEW |
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/system/status_area_widget.h" | 7 #include "ash/system/status_area_widget.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
9 #include "ash/system/tray/tray_bubble_view.h" | 9 #include "ash/system/tray/tray_bubble_view.h" |
10 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 virtual ui::GestureStatus OnGestureEvent( | 438 virtual ui::GestureStatus OnGestureEvent( |
439 const views::GestureEvent& event) OVERRIDE { | 439 const views::GestureEvent& event) OVERRIDE { |
440 if (event.type() != ui::ET_GESTURE_TAP) | 440 if (event.type() != ui::ET_GESTURE_TAP) |
441 return ui::GESTURE_STATUS_UNKNOWN; | 441 return ui::GESTURE_STATUS_UNKNOWN; |
442 tray_->OnClicked(notification_.id); | 442 tray_->OnClicked(notification_.id); |
443 return ui::GESTURE_STATUS_CONSUMED; | 443 return ui::GESTURE_STATUS_CONSUMED; |
444 } | 444 } |
445 | 445 |
446 // Overridden from ButtonListener. | 446 // Overridden from ButtonListener. |
447 virtual void ButtonPressed(views::Button* sender, | 447 virtual void ButtonPressed(views::Button* sender, |
448 const views::Event& event) OVERRIDE { | 448 const ui::Event& event) OVERRIDE { |
449 if (sender == close_button_) | 449 if (sender == close_button_) |
450 tray_->SendRemoveNotification(notification_.id); | 450 tray_->SendRemoveNotification(notification_.id); |
451 } | 451 } |
452 | 452 |
453 // Overridden from MenuButtonListener. | 453 // Overridden from MenuButtonListener. |
454 virtual void OnMenuButtonClicked( | 454 virtual void OnMenuButtonClicked( |
455 View* source, const gfx::Point& point) OVERRIDE { | 455 View* source, const gfx::Point& point) OVERRIDE { |
456 if (source != menu_button_) | 456 if (source != menu_button_) |
457 return; | 457 return; |
458 WebNotificationMenuModel menu_model(tray_, notification_); | 458 WebNotificationMenuModel menu_model(tray_, notification_); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 | 512 |
513 virtual ~WebNotificationButtonView() { | 513 virtual ~WebNotificationButtonView() { |
514 } | 514 } |
515 | 515 |
516 void SetCloseAllVisible(bool visible) { | 516 void SetCloseAllVisible(bool visible) { |
517 close_all_button_->SetVisible(visible); | 517 close_all_button_->SetVisible(visible); |
518 } | 518 } |
519 | 519 |
520 // Overridden from ButtonListener. | 520 // Overridden from ButtonListener. |
521 virtual void ButtonPressed(views::Button* sender, | 521 virtual void ButtonPressed(views::Button* sender, |
522 const views::Event& event) OVERRIDE { | 522 const ui::Event& event) OVERRIDE { |
523 if (sender == close_all_button_) | 523 if (sender == close_all_button_) |
524 tray_->SendRemoveAllNotifications(); | 524 tray_->SendRemoveAllNotifications(); |
525 } | 525 } |
526 | 526 |
527 private: | 527 private: |
528 WebNotificationTray* tray_; | 528 WebNotificationTray* tray_; |
529 TrayPopupTextButton* close_all_button_; | 529 TrayPopupTextButton* close_all_button_; |
530 | 530 |
531 DISALLOW_COPY_AND_ASSIGN(WebNotificationButtonView); | 531 DISALLOW_COPY_AND_ASSIGN(WebNotificationButtonView); |
532 }; | 532 }; |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 delegate_->DisableExtension(id); | 1000 delegate_->DisableExtension(id); |
1001 } | 1001 } |
1002 | 1002 |
1003 void WebNotificationTray::DisableByUrl(const std::string& id) { | 1003 void WebNotificationTray::DisableByUrl(const std::string& id) { |
1004 // Will call SendRemoveNotification for each matching notification. | 1004 // Will call SendRemoveNotification for each matching notification. |
1005 notification_list_->RemoveNotificationsBySource(id); | 1005 notification_list_->RemoveNotificationsBySource(id); |
1006 if (delegate_) | 1006 if (delegate_) |
1007 delegate_->DisableNotificationsFromSource(id); | 1007 delegate_->DisableNotificationsFromSource(id); |
1008 } | 1008 } |
1009 | 1009 |
1010 bool WebNotificationTray::PerformAction(const views::Event& event) { | 1010 bool WebNotificationTray::PerformAction(const ui::Event& event) { |
1011 if (message_center_bubble()) | 1011 if (message_center_bubble()) |
1012 HideMessageCenterBubble(); | 1012 HideMessageCenterBubble(); |
1013 else | 1013 else |
1014 ShowMessageCenterBubble(); | 1014 ShowMessageCenterBubble(); |
1015 return true; | 1015 return true; |
1016 } | 1016 } |
1017 | 1017 |
1018 int WebNotificationTray::GetNotificationCount() const { | 1018 int WebNotificationTray::GetNotificationCount() const { |
1019 return notification_list()->notifications().size(); | 1019 return notification_list()->notifications().size(); |
1020 } | 1020 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 } else if (bubble == notification_bubble()) { | 1063 } else if (bubble == notification_bubble()) { |
1064 HideNotificationBubble(); | 1064 HideNotificationBubble(); |
1065 } | 1065 } |
1066 } | 1066 } |
1067 | 1067 |
1068 bool WebNotificationTray::HasNotificationForTest(const std::string& id) const { | 1068 bool WebNotificationTray::HasNotificationForTest(const std::string& id) const { |
1069 return notification_list_->HasNotification(id); | 1069 return notification_list_->HasNotification(id); |
1070 } | 1070 } |
1071 | 1071 |
1072 } // namespace ash | 1072 } // namespace ash |
OLD | NEW |