summaryrefslogtreecommitdiffstats
path: root/ui/message_center
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-13 19:02:47 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-13 19:02:47 +0000
commitd84df40f26d943499a3cead73128db707d900e36 (patch)
treedb911a01c51b9520b784636b0d19c8a20fa6717e /ui/message_center
parentb0ce0982d025ed1148e260a61d71c33273c91e3f (diff)
downloadchromium_src-d84df40f26d943499a3cead73128db707d900e36.zip
chromium_src-d84df40f26d943499a3cead73128db707d900e36.tar.gz
chromium_src-d84df40f26d943499a3cead73128db707d900e36.tar.bz2
Revert 199777 "mac: Minor tweaks to notifications code."
Broke: NotificationControllerTest.Update: ../../ui/message_center/cocoa/notification_controller_unittest.mm:161: Failure Value of: message_center::kNotificationIconSize Actual: 80 Expected: NSHeight([[controller view] frame]) Which is: 86 (which the trybots don't run) > mac: Minor tweaks to notifications code. > > Fixes the lower padding, and simplifies the code a bit. > > BUG=none > TEST=Open a notification with more than 2 lines of text. Bottom margin doesn't > look too small. > > R=rsesek@chromium.org > > Review URL: https://codereview.chromium.org/14735009 TBR=thakis@chromium.org Review URL: https://codereview.chromium.org/14617022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/message_center')
-rw-r--r--ui/message_center/cocoa/notification_controller.mm13
-rw-r--r--ui/message_center/cocoa/popup_collection.mm7
-rw-r--r--ui/message_center/message_center.h2
-rw-r--r--ui/message_center/message_center_observer.h2
4 files changed, 16 insertions, 8 deletions
diff --git a/ui/message_center/cocoa/notification_controller.mm b/ui/message_center/cocoa/notification_controller.mm
index aa2ecbd..202e524 100644
--- a/ui/message_center/cocoa/notification_controller.mm
+++ b/ui/message_center/cocoa/notification_controller.mm
@@ -14,6 +14,13 @@
#include "ui/message_center/message_center_constants.h"
#include "ui/message_center/notification.h"
+namespace {
+
+// Compensates for padding already provided by UI elements involved.
+const int kTextTopPaddingAdjustment = -6;
+
+} // namespace
+
@interface MCNotificationController (Private)
// Configures a NSBox to be borderless, titleless, and otherwise appearance-
// free.
@@ -110,8 +117,10 @@
// In this basic notification UI, the message body is the bottom-most
// vertical element. If it is out of the rootView's bounds, resize the view.
- if (NSMinY(messageFrame) < message_center::kTextTopPadding) {
- CGFloat delta = message_center::kTextTopPadding - NSMinY(messageFrame);
+ if (NSMinY(messageFrame) <
+ message_center::kTextTopPadding + kTextTopPaddingAdjustment) {
+ CGFloat delta = message_center::kTextTopPadding +
+ kTextTopPaddingAdjustment - NSMinY(messageFrame);
rootFrame.size.height += delta;
titleFrame.origin.y += delta;
messageFrame.origin.y += delta;
diff --git a/ui/message_center/cocoa/popup_collection.mm b/ui/message_center/cocoa/popup_collection.mm
index bf3df41..60547e0 100644
--- a/ui/message_center/cocoa/popup_collection.mm
+++ b/ui/message_center/cocoa/popup_collection.mm
@@ -51,9 +51,10 @@ class PopupCollectionObserver : public message_center::MessageCenterObserver {
virtual void OnNotificationAdded(
const std::string& notification_id) OVERRIDE {
- for (const auto& notification : message_center_->GetPopupNotifications()) {
- if (notification->id() == notification_id) {
- [popup_collection_ addNotification:notification];
+ const auto& popups = message_center_->GetPopupNotifications();
+ for (auto it = popups.begin(); it != popups.end(); ++it) {
+ if ((*it)->id() == notification_id) {
+ [popup_collection_ addNotification:*it];
return;
}
}
diff --git a/ui/message_center/message_center.h b/ui/message_center/message_center.h
index d971a30..654e766 100644
--- a/ui/message_center/message_center.h
+++ b/ui/message_center/message_center.h
@@ -122,7 +122,7 @@ class MESSAGE_CENTER_EXPORT MessageCenter {
virtual void SetNotificationImage(const std::string& notification_id,
const gfx::Image& image) = 0;
- // Sets the image for the icon of the specific action button.
+ // Sets the image for the icon of the specific aaction button.
virtual void SetNotificationButtonIcon(const std::string& notification_id,
int button_index,
const gfx::Image& image) = 0;
diff --git a/ui/message_center/message_center_observer.h b/ui/message_center/message_center_observer.h
index 61a3390..d4ef130 100644
--- a/ui/message_center/message_center_observer.h
+++ b/ui/message_center/message_center_observer.h
@@ -5,8 +5,6 @@
#ifndef UI_MESSAGE_CENTER_MESSAGE_CENTER_OBSERVER_H_
#define UI_MESSAGE_CENTER_MESSAGE_CENTER_OBSERVER_H_
-#include <string>
-
#include "ui/message_center/message_center_export.h"
namespace message_center {