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

Unified Diff: ui/message_center/views/message_center_view.cc

Issue 117513006: Remove experimental code fro grouping notifications from the same source. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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: ui/message_center/views/message_center_view.cc
diff --git a/ui/message_center/views/message_center_view.cc b/ui/message_center/views/message_center_view.cc
index 6008b8f59ade04505405d8eb0fce3cc703f044dd..8054a3de7c165c48b7485ab2b3be87892dbc35e6 100644
--- a/ui/message_center/views/message_center_view.cc
+++ b/ui/message_center/views/message_center_view.cc
@@ -25,7 +25,6 @@
#include "ui/message_center/message_center_tray.h"
#include "ui/message_center/message_center_types.h"
#include "ui/message_center/message_center_util.h"
-#include "ui/message_center/views/group_view.h"
#include "ui/message_center/views/message_center_button_bar.h"
#include "ui/message_center/views/message_view.h"
#include "ui/message_center/views/message_view_context_menu_controller.h"
@@ -56,9 +55,6 @@ const int kMinScrollViewHeight = 100;
const int kDefaultAnimationDurationMs = 120;
const int kDefaultFrameRateHz = 60;
-
-const int kMaxNotificationCountFromSingleDisplaySource = 1;
-
} // namespace
// BoundedScrollView ///////////////////////////////////////////////////////////
@@ -672,65 +668,14 @@ void MessageCenterView::SetNotifications(
notification_views_.clear();
- // Count how many times each Notifier is encountered. We group Notifications
- // by NotifierId.
- std::map<NotifierId, int> groups;
int index = 0;
+ for (NotificationList::Notifications::const_iterator iter =
+ notifications.begin(); iter != notifications.end(); ++iter) {
+ AddNotificationAt(*(*iter), index++);
- if (IsExperimentalNotificationUIEnabled()) {
- for (NotificationList::Notifications::const_iterator iter =
- notifications.begin(); iter != notifications.end(); ++iter) {
- NotifierId group_id = (*iter)->notifier_id();
- std::map<NotifierId, int>::iterator group_iter = groups.find(group_id);
- if (group_iter != groups.end())
- group_iter->second++;
- else
- groups[group_id] = 1;
- }
-
- // TODO(dimich): Find a better group icon. Preferably associated with
- // the group (notifier icon?).
- gfx::ImageSkia* group_icon = ui::ResourceBundle::GetSharedInstance().
- GetImageSkiaNamed(IDR_FOLDER_CLOSED);
-
- for (NotificationList::Notifications::const_iterator iter =
- notifications.begin(); iter != notifications.end(); ++iter) {
- // See if the notification's NotifierId is encountered too many
- // times - in this case replace all notifications from this source with
- // a synthetic placeholder that says "N more". Mark the NotifierId
- // as "seen" by setting count to 0 so the subsequent notificaitons from
- // the same source are ignored.
- std::map<NotifierId, int>::iterator group_iter =
- groups.find((*iter)->notifier_id());
- // We should have collected all groups in the loop above.
- DCHECK(group_iter != groups.end());
-
- if (group_iter->second > kMaxNotificationCountFromSingleDisplaySource) {
- AddGroupPlaceholder(group_iter->first,
- *(*iter),
- group_icon ? *group_icon : gfx::ImageSkia(),
- group_iter->second,
- index++);
- group_iter->second = 0; // Mark.
- } else if (group_iter->second == 0) { // Marked, skip.
- continue;
- } else { // Ungrouped notifications
- AddNotificationAt(*(*iter), index++);
- }
-
- message_center_->DisplayedNotification((*iter)->id());
- if (notification_views_.size() >= kMaxVisibleMessageCenterNotifications)
- break;
- }
- } else {
- for (NotificationList::Notifications::const_iterator iter =
- notifications.begin(); iter != notifications.end(); ++iter) {
- AddNotificationAt(*(*iter), index++);
-
- message_center_->DisplayedNotification((*iter)->id());
- if (notification_views_.size() >= kMaxVisibleMessageCenterNotifications)
- break;
- }
+ message_center_->DisplayedNotification((*iter)->id());
+ if (notification_views_.size() >= kMaxVisibleMessageCenterNotifications)
+ break;
}
NotificationsChanged();
@@ -929,7 +874,6 @@ void MessageCenterView::OnMouseExited(const ui::MouseEvent& event) {
NotificationsChanged();
}
-// TODO(dimich): update for GROUP_VIEW
void MessageCenterView::OnNotificationAdded(const std::string& id) {
int index = 0;
const NotificationList::Notifications& notifications =
@@ -947,7 +891,6 @@ void MessageCenterView::OnNotificationAdded(const std::string& id) {
NotificationsChanged();
}
-// TODO(dimich): update for GROUP_VIEW
void MessageCenterView::OnNotificationRemoved(const std::string& id,
bool by_user) {
NotificationViewsMap::iterator view_iter = notification_views_.find(id);
@@ -983,7 +926,6 @@ void MessageCenterView::OnNotificationRemoved(const std::string& id,
NotificationsChanged();
}
-// TODO(dimich): update for GROUP_VIEW
void MessageCenterView::OnNotificationUpdated(const std::string& id) {
NotificationViewsMap::const_iterator view_iter = notification_views_.find(id);
if (view_iter == notification_views_.end())
@@ -1046,37 +988,6 @@ void MessageCenterView::ExpandNotification(const std::string& notification_id) {
message_center_->ExpandNotification(notification_id);
}
-void MessageCenterView::GroupBodyClicked(
- const std::string& last_notification_id) {
- message_center_->ClickOnNotification(last_notification_id);
-}
-
-// When clicked on the "N more" button, perform some reasonable action.
-// TODO(dimich): find out what the reasonable action could be.
-void MessageCenterView::ExpandGroup(const NotifierId& notifier_id) {
- NOTIMPLEMENTED();
-}
-
-// Click on Close button on a GroupView should remove all notifications
-// represented by this GroupView.
-void MessageCenterView::RemoveGroup(const NotifierId& notifier_id) {
- std::vector<std::string> notifications_to_remove;
-
- // Can not remove notifications while iterating the list. Collect the ids
- // and then run separate loop to remove notifications.
- const NotificationList::Notifications& notifications =
- message_center_->GetVisibleNotifications();
- for (NotificationList::Notifications::const_iterator iter =
- notifications.begin(); iter != notifications.end(); ++iter) {
- if ((*iter)->notifier_id() == notifier_id)
- notifications_to_remove.push_back((*iter)->id());
- }
-
- for (size_t i = 0; i < notifications_to_remove.size(); ++i)
- // "by_user" = true
- message_center_->RemoveNotification(notifications_to_remove[i], true);
-}
-
void MessageCenterView::AnimationEnded(const gfx::Animation* animation) {
DCHECK_EQ(animation, settings_transition_animation_.get());
@@ -1123,22 +1034,6 @@ void MessageCenterView::AddMessageViewAt(MessageView* view, int index) {
message_list_view_->AddNotificationAt(view, index);
}
-void MessageCenterView::AddGroupPlaceholder(
- const NotifierId& group_id,
- const Notification& last_notification,
- const gfx::ImageSkia& group_icon,
- int group_size,
- int index) {
- GroupView* view = new GroupView(this,
- group_id,
- last_notification,
- group_icon,
- group_size);
- view->set_context_menu_controller(context_menu_controller_.get());
- group_views_.push_back(view);
- AddMessageViewAt(view, index);
-}
-
void MessageCenterView::AddNotificationAt(const Notification& notification,
int index) {
// NotificationViews are expanded by default here until
@@ -1158,7 +1053,7 @@ void MessageCenterView::AddNotificationAt(const Notification& notification,
}
void MessageCenterView::NotificationsChanged() {
- bool no_message_views = notification_views_.empty() && group_views_.empty();
+ bool no_message_views = notification_views_.empty();
// When the child view is removed from the hierarchy, its focus is cleared.
// In this case we want to save which view has focus so that the user can
« no previous file with comments | « ui/message_center/views/message_center_view.h ('k') | ui/message_center/views/message_center_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698