diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-14 18:28:11 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-14 18:28:11 +0000 |
commit | 86c7e0c54beca27196778743c8287e9ca26f3381 (patch) | |
tree | ee6e6659d5906ca3a6a8d783caeb19bbbc25aef6 /ash | |
parent | c84b42002c558e2eaff044167b6c22a090c74bfc (diff) | |
download | chromium_src-86c7e0c54beca27196778743c8287e9ca26f3381.zip chromium_src-86c7e0c54beca27196778743c8287e9ca26f3381.tar.gz chromium_src-86c7e0c54beca27196778743c8287e9ca26f3381.tar.bz2 |
Show extension settings for extension notifications
This also:
* Sends notification removal requests instead of directly removing notifications for removal by source
* Fixes a bug where clicking on a menu item outside the bubble would close the buble and not trigger the menu event
BUG=139697
For chrome/browser/ui/views/ash/balloon_collection_impl_ash.cc:
TBR=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10855113
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151518 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/system/tray/tray_bubble_view.cc | 17 | ||||
-rw-r--r-- | ash/system/tray/tray_bubble_view.h | 3 | ||||
-rw-r--r-- | ash/system/web_notification/web_notification_tray.cc | 18 | ||||
-rw-r--r-- | ash/system/web_notification/web_notification_tray.h | 1 |
4 files changed, 27 insertions, 12 deletions
diff --git a/ash/system/tray/tray_bubble_view.cc b/ash/system/tray/tray_bubble_view.cc index 4551e9d..dc443a4 100644 --- a/ash/system/tray/tray_bubble_view.cc +++ b/ash/system/tray/tray_bubble_view.cc @@ -4,9 +4,11 @@ #include "ash/system/tray/tray_bubble_view.h" +#include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/system/tray/tray_constants.h" +#include "ash/wm/property_util.h" #include "ash/wm/shelf_layout_manager.h" #include "ash/wm/window_animations.h" #include "grit/ash_strings.h" @@ -463,7 +465,7 @@ bool TrayBubbleView::Host::PreHandleKeyEvent(aura::Window* target, bool TrayBubbleView::Host::PreHandleMouseEvent(aura::Window* target, ui::MouseEvent* event) { if (event->type() == ui::ET_MOUSE_PRESSED) - ProcessLocatedEvent(*event); + ProcessLocatedEvent(target, *event); return false; } @@ -471,7 +473,7 @@ ui::TouchStatus TrayBubbleView::Host::PreHandleTouchEvent( aura::Window* target, ui::TouchEvent* event) { if (event->type() == ui::ET_TOUCH_PRESSED) - ProcessLocatedEvent(*event); + ProcessLocatedEvent(target, *event); return ui::TOUCH_STATUS_UNKNOWN; } @@ -482,7 +484,16 @@ ui::GestureStatus TrayBubbleView::Host::PreHandleGestureEvent( } void TrayBubbleView::Host::ProcessLocatedEvent( - const ui::LocatedEvent& event) { + aura::Window* target, const ui::LocatedEvent& event) { + if (target) { + // Don't process events that occurred inside an embedded menu. + RootWindowController* root_controller = + GetRootWindowController(target->GetRootWindow()); + if (root_controller && root_controller->GetContainer( + ash::internal::kShellWindowId_MenuContainer)->Contains(target)) { + return; + } + } if (!widget_) return; gfx::Rect bounds = widget_->GetNativeWindow()->GetBoundsInRootWindow(); diff --git a/ash/system/tray/tray_bubble_view.h b/ash/system/tray/tray_bubble_view.h index edcc2c3..e765935 100644 --- a/ash/system/tray/tray_bubble_view.h +++ b/ash/system/tray/tray_bubble_view.h @@ -59,7 +59,8 @@ class TrayBubbleView : public views::BubbleDelegateView { ui::GestureEvent* event) OVERRIDE; private: - void ProcessLocatedEvent(const ui::LocatedEvent& event); + void ProcessLocatedEvent(aura::Window* target, + const ui::LocatedEvent& event); views::Widget* widget_; views::View* tray_view_; diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc index 5274a17..051f6c9 100644 --- a/ash/system/web_notification/web_notification_tray.cc +++ b/ash/system/web_notification/web_notification_tray.cc @@ -162,7 +162,8 @@ class WebNotificationList { notifications_.clear(); } - void RemoveNotificationsBySource(const std::string& id) { + void SendRemoveNotificationsBySource(WebNotificationTray* tray, + const std::string& id) { Notifications::iterator source_iter = GetNotification(id); if (source_iter == notifications_.end()) return; @@ -171,11 +172,12 @@ class WebNotificationList { loopiter != notifications_.end(); ) { Notifications::iterator curiter = loopiter++; if (curiter->display_source == display_source) - EraseNotification(curiter); + tray->SendRemoveNotification(curiter->id); } } - void RemoveNotificationsByExtension(const std::string& id) { + void SendRemoveNotificationsByExtension(WebNotificationTray* tray, + const std::string& id) { Notifications::iterator source_iter = GetNotification(id); if (source_iter == notifications_.end()) return; @@ -184,7 +186,7 @@ class WebNotificationList { loopiter != notifications_.end(); ) { Notifications::iterator curiter = loopiter++; if (curiter->extension_id == extension_id) - EraseNotification(curiter); + tray->SendRemoveNotification(curiter->id); } } @@ -995,17 +997,17 @@ void WebNotificationTray::SendRemoveAllNotifications() { // When we disable notifications, we remove any existing matching // notifications to avoid adding complicated UI to re-enable the source. void WebNotificationTray::DisableByExtension(const std::string& id) { - // Will call SendRemoveNotification for each matching notification. - notification_list_->RemoveNotificationsByExtension(id); if (delegate_) delegate_->DisableExtension(id); + // Will call SendRemoveNotification for each matching notification. + notification_list_->SendRemoveNotificationsByExtension(this, id); } void WebNotificationTray::DisableByUrl(const std::string& id) { - // Will call SendRemoveNotification for each matching notification. - notification_list_->RemoveNotificationsBySource(id); if (delegate_) delegate_->DisableNotificationsFromSource(id); + // Will call SendRemoveNotification for each matching notification. + notification_list_->SendRemoveNotificationsBySource(this, id); } bool WebNotificationTray::PerformAction(const ui::Event& event) { diff --git a/ash/system/web_notification/web_notification_tray.h b/ash/system/web_notification/web_notification_tray.h index cf0f829..960ead8 100644 --- a/ash/system/web_notification/web_notification_tray.h +++ b/ash/system/web_notification/web_notification_tray.h @@ -143,6 +143,7 @@ class ASH_EXPORT WebNotificationTray : public internal::TrayBackgroundView { class Bubble; friend class internal::WebNotificationButtonView; friend class internal::WebNotificationMenuModel; + friend class internal::WebNotificationList; friend class internal::WebNotificationView; FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotifications); FRIEND_TEST_ALL_PREFIXES(WebNotificationTrayTest, WebNotificationBubble); |