OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/message_center/message_center_tray.h" | 5 #include "ui/message_center/message_center_tray.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" |
8 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
9 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
11 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
12 #include "ui/base/models/simple_menu_model.h" | 13 #include "ui/base/models/simple_menu_model.h" |
13 #include "ui/message_center/message_center.h" | 14 #include "ui/message_center/message_center.h" |
14 #include "ui/message_center/message_center_tray_delegate.h" | 15 #include "ui/message_center/message_center_tray_delegate.h" |
15 #include "ui/message_center/message_center_types.h" | 16 #include "ui/message_center/message_center_types.h" |
16 #include "ui/message_center/notification_blocker.h" | 17 #include "ui/message_center/notification_blocker.h" |
17 #include "ui/strings/grit/ui_strings.h" | 18 #include "ui/strings/grit/ui_strings.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 void MessageCenterTray::ShowNotifierSettingsBubble() { | 193 void MessageCenterTray::ShowNotifierSettingsBubble() { |
193 if (popups_visible_) | 194 if (popups_visible_) |
194 HidePopupBubbleInternal(); | 195 HidePopupBubbleInternal(); |
195 | 196 |
196 message_center_visible_ = delegate_->ShowNotifierSettings(); | 197 message_center_visible_ = delegate_->ShowNotifierSettings(); |
197 message_center_->SetVisibility(message_center::VISIBILITY_SETTINGS); | 198 message_center_->SetVisibility(message_center::VISIBILITY_SETTINGS); |
198 | 199 |
199 NotifyMessageCenterTrayChanged(); | 200 NotifyMessageCenterTrayChanged(); |
200 } | 201 } |
201 | 202 |
202 scoped_ptr<ui::MenuModel> MessageCenterTray::CreateNotificationMenuModel( | 203 std::unique_ptr<ui::MenuModel> MessageCenterTray::CreateNotificationMenuModel( |
203 const NotifierId& notifier_id, | 204 const NotifierId& notifier_id, |
204 const base::string16& display_source) { | 205 const base::string16& display_source) { |
205 #if !defined(OS_CHROMEOS) | 206 #if !defined(OS_CHROMEOS) |
206 // Only web pages are configurable on non-chromeos platforms. | 207 // Only web pages are configurable on non-chromeos platforms. |
207 if (notifier_id.type != NotifierId::WEB_PAGE) { | 208 if (notifier_id.type != NotifierId::WEB_PAGE) { |
208 return nullptr; | 209 return nullptr; |
209 } | 210 } |
210 #endif | 211 #endif |
211 | 212 |
212 return make_scoped_ptr( | 213 return base::WrapUnique( |
213 new NotificationMenuModel(this, notifier_id, display_source)); | 214 new NotificationMenuModel(this, notifier_id, display_source)); |
214 } | 215 } |
215 | 216 |
216 void MessageCenterTray::OnNotificationAdded( | 217 void MessageCenterTray::OnNotificationAdded( |
217 const std::string& notification_id) { | 218 const std::string& notification_id) { |
218 OnMessageCenterChanged(); | 219 OnMessageCenterChanged(); |
219 } | 220 } |
220 | 221 |
221 void MessageCenterTray::OnNotificationRemoved( | 222 void MessageCenterTray::OnNotificationRemoved( |
222 const std::string& notification_id, | 223 const std::string& notification_id, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 ShowPopupBubble(); | 267 ShowPopupBubble(); |
267 | 268 |
268 NotifyMessageCenterTrayChanged(); | 269 NotifyMessageCenterTrayChanged(); |
269 } | 270 } |
270 | 271 |
271 void MessageCenterTray::NotifyMessageCenterTrayChanged() { | 272 void MessageCenterTray::NotifyMessageCenterTrayChanged() { |
272 delegate_->OnMessageCenterTrayChanged(); | 273 delegate_->OnMessageCenterTrayChanged(); |
273 } | 274 } |
274 | 275 |
275 } // namespace message_center | 276 } // namespace message_center |
OLD | NEW |