Commit 5d654b92 authored by juyik@chromium.org's avatar juyik@chromium.org

Rename notification_id() to disambiguate its meaning.

As an intermediate step to disambiguate notifications
at notification UI manager level, we rename notification_id()
to delegate_id() to clarify that it is not an id for
notification in message center.

Also change assignment operator of message center's
notification to protected. Other members are still used by
notification list so they need to be public.

BUG=297867

Review URL: https://codereview.chromium.org/344763002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278593 0039d316-1c4b-4281-b951-d872f2087c98
parent 995127b8
......@@ -383,7 +383,7 @@ std::string DesktopNotificationService::AddIconNotification(
blink::WebTextDirectionDefault,
base::string16(), replace_id, delegate);
g_browser_process->notification_ui_manager()->Add(notification, profile);
return notification.notification_id();
return notification.delegate_id();
}
DesktopNotificationService::DesktopNotificationService(
......
......@@ -137,7 +137,7 @@ bool MessageCenterNotificationManager::Update(const Notification& notification,
// Changing the type from non-progress to progress does not count towards
// the immediate update allowed in the message center.
std::string old_id =
old_notification->notification().notification_id();
old_notification->notification().delegate_id();
DCHECK(message_center_->FindVisibleNotificationById(old_id));
// Add/remove notification in the local list but just update the same
......@@ -146,7 +146,7 @@ bool MessageCenterNotificationManager::Update(const Notification& notification,
profile_notifications_.erase(old_id);
ProfileNotification* new_notification =
new ProfileNotification(profile, notification, message_center_);
profile_notifications_[notification.notification_id()] = new_notification;
profile_notifications_[notification.delegate_id()] = new_notification;
// Now pass a copy to message center.
scoped_ptr<message_center::Notification> message_center_notification(
......@@ -323,7 +323,7 @@ void MessageCenterNotificationManager::ImageDownloads::StartDownloads(
notification.icon_url(),
base::Bind(&message_center::MessageCenter::SetNotificationIcon,
base::Unretained(message_center_),
notification.notification_id()));
notification.delegate_id()));
// Notification image.
StartDownloadWithImage(
......@@ -332,7 +332,7 @@ void MessageCenterNotificationManager::ImageDownloads::StartDownloads(
notification.image_url(),
base::Bind(&message_center::MessageCenter::SetNotificationImage,
base::Unretained(message_center_),
notification.notification_id()));
notification.delegate_id()));
// Notification button icons.
StartDownloadWithImage(
......@@ -341,7 +341,7 @@ void MessageCenterNotificationManager::ImageDownloads::StartDownloads(
notification.button_one_icon_url(),
base::Bind(&message_center::MessageCenter::SetNotificationButtonIcon,
base::Unretained(message_center_),
notification.notification_id(),
notification.delegate_id(),
0));
StartDownloadWithImage(
notification,
......@@ -349,7 +349,7 @@ void MessageCenterNotificationManager::ImageDownloads::StartDownloads(
notification.button_two_icon_url(),
base::Bind(&message_center::MessageCenter::SetNotificationButtonIcon,
base::Unretained(message_center_),
notification.notification_id(),
notification.delegate_id(),
1));
// This should tell the observer we're done if everything was synchronous.
......@@ -472,7 +472,7 @@ std::string
void MessageCenterNotificationManager::AddProfileNotification(
ProfileNotification* profile_notification) {
const Notification& notification = profile_notification->notification();
std::string id = notification.notification_id();
std::string id = notification.delegate_id();
// Notification ids should be unique.
DCHECK(profile_notifications_.find(id) == profile_notifications_.end());
profile_notifications_[id] = profile_notification;
......@@ -487,7 +487,7 @@ void MessageCenterNotificationManager::AddProfileNotification(
void MessageCenterNotificationManager::RemoveProfileNotification(
ProfileNotification* profile_notification) {
std::string id = profile_notification->notification().notification_id();
std::string id = profile_notification->notification().delegate_id();
profile_notifications_.erase(id);
delete profile_notification;
}
......
......@@ -82,7 +82,8 @@ class Notification : public message_center::Notification {
// A url for the image to be shown (optional).
const GURL& image_url() const { return image_url_; }
std::string notification_id() const { return delegate()->id(); }
// Id of the delegate embedded inside this instance.
std::string delegate_id() const { return delegate()->id(); }
int process_id() const { return delegate()->process_id(); }
content::WebContents* GetWebContents() const {
......
......@@ -65,7 +65,7 @@ StubNotificationUIManager::GetAllIdsByProfileAndSourceOrigin(
const GURL& source) {
std::set<std::string> notification_ids;
if (source == notification_.origin_url() && profile->IsSameProfile(profile_))
notification_ids.insert(notification_.notification_id());
notification_ids.insert(notification_.delegate_id());
return notification_ids;
}
......
......@@ -66,8 +66,6 @@ class MESSAGE_CENTER_EXPORT Notification {
Notification(const Notification& other);
Notification& operator=(const Notification& other);
virtual ~Notification();
// Copies the internal on-memory state from |base|, i.e. shown_as_popup,
......@@ -202,6 +200,8 @@ class MESSAGE_CENTER_EXPORT Notification {
const base::Closure& click_callback);
protected:
Notification& operator=(const Notification& other);
// The type of notification we'd like displayed.
NotificationType type_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment