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

Unified Diff: ash/system/web_notification/web_notification_tray.cc

Issue 10855113: Show extension settings for extension notifications (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: ash/system/web_notification/web_notification_tray.cc
diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc
index 11f1773897a3dc11a3a9409d1b1b34d4884ca041..83b0794b75b9e8e3834858c59e858c56aa5635de 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);
}
}
@@ -455,6 +457,7 @@ class WebNotificationView : public views::View,
View* source, const gfx::Point& point) OVERRIDE {
if (source != menu_button_)
return;
+ tray_->set_menu_open(true);
sadrul 2012/08/13 22:09:08 This feels like a hack. The app-list controller do
stevenjb 2012/08/14 00:48:37 Sure. I'm not a huge fan of using globals, but at
WebNotificationMenuModel menu_model(tray_, notification_);
views::MenuModelAdapter menu_model_adapter(&menu_model);
views::MenuRunner menu_runner(menu_model_adapter.CreateMenu());
@@ -467,6 +470,7 @@ class WebNotificationView : public views::View,
gfx::Rect(screen_location, menu_button_->size()),
views::MenuItemView::TOPRIGHT,
views::MenuRunner::HAS_MNEMONICS));
+ tray_->set_menu_open(false);
}
private:
@@ -776,7 +780,8 @@ class WebNotificationTray::Bubble : public TrayBubbleView::Host,
virtual void OnClickedOutsideView() OVERRIDE {
// May delete |this|.
- tray_->HideMessageCenterBubble();
+ if (!tray_->menu_open())
+ tray_->HideMessageCenterBubble();
}
// Overridden from views::WidgetObserver:
@@ -828,7 +833,8 @@ WebNotificationTray::WebNotificationTray(
notification_list_(new WebNotificationList()),
count_label_(NULL),
delegate_(NULL),
- show_message_center_on_unlock_(false) {
+ show_message_center_on_unlock_(false),
+ menu_open_(false) {
count_label_ = new views::Label(UTF8ToUTF16("0"));
internal::SetupLabelForTray(count_label_);
gfx::Font font = count_label_->font();
@@ -994,17 +1000,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) {
« no previous file with comments | « ash/system/web_notification/web_notification_tray.h ('k') | chrome/browser/ui/views/ash/balloon_collection_impl_ash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698