OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/system/web_notification/web_notification_tray.h" | 5 #include "ash/system/web_notification/web_notification_tray.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "grit/ui_strings.h" | 22 #include "grit/ui_strings.h" |
23 #include "ui/aura/root_window.h" | 23 #include "ui/aura/root_window.h" |
24 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
27 #include "ui/gfx/screen.h" | 27 #include "ui/gfx/screen.h" |
28 #include "ui/message_center/message_center_tray_delegate.h" | 28 #include "ui/message_center/message_center_tray_delegate.h" |
29 #include "ui/message_center/message_center_util.h" | 29 #include "ui/message_center/message_center_util.h" |
30 #include "ui/message_center/views/message_bubble_base.h" | 30 #include "ui/message_center/views/message_bubble_base.h" |
31 #include "ui/message_center/views/message_center_bubble.h" | 31 #include "ui/message_center/views/message_center_bubble.h" |
32 #include "ui/message_center/views/message_popup_bubble.h" | |
33 #include "ui/message_center/views/message_popup_collection.h" | 32 #include "ui/message_center/views/message_popup_collection.h" |
34 #include "ui/views/bubble/tray_bubble_view.h" | 33 #include "ui/views/bubble/tray_bubble_view.h" |
35 #include "ui/views/controls/button/custom_button.h" | 34 #include "ui/views/controls/button/custom_button.h" |
36 #include "ui/views/controls/image_view.h" | 35 #include "ui/views/controls/image_view.h" |
37 #include "ui/views/controls/label.h" | 36 #include "ui/views/controls/label.h" |
38 #include "ui/views/controls/menu/menu_runner.h" | 37 #include "ui/views/controls/menu/menu_runner.h" |
39 | 38 |
40 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
41 | 40 |
42 namespace message_center { | 41 namespace message_center { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 else | 264 else |
266 message_center_tray_->ShowPopupBubble(); | 265 message_center_tray_->ShowPopupBubble(); |
267 } | 266 } |
268 | 267 |
269 bool WebNotificationTray::ShowPopups() { | 268 bool WebNotificationTray::ShowPopups() { |
270 if (status_area_widget()->login_status() == user::LOGGED_IN_LOCKED || | 269 if (status_area_widget()->login_status() == user::LOGGED_IN_LOCKED || |
271 message_center_bubble() || | 270 message_center_bubble() || |
272 !status_area_widget()->ShouldShowWebNotifications()) { | 271 !status_area_widget()->ShouldShowWebNotifications()) { |
273 return false; | 272 return false; |
274 } | 273 } |
275 if (message_center::IsRichNotificationEnabled()) { | 274 |
276 // No bubble wrappers here, since |popup_collection_| is not a bubble but a | 275 popup_collection_.reset(new message_center::MessagePopupCollection( |
277 // collection of widgets. | 276 ash::Shell::GetContainer( |
278 popup_collection_.reset(new message_center::MessagePopupCollection( | 277 GetWidget()->GetNativeView()->GetRootWindow(), |
279 ash::Shell::GetContainer( | 278 internal::kShellWindowId_StatusContainer), |
280 GetWidget()->GetNativeView()->GetRootWindow(), | 279 message_center(), |
281 internal::kShellWindowId_StatusContainer), | 280 message_center_tray_.get())); |
282 message_center(), | 281 |
283 message_center_tray_.get())); | |
284 } else { | |
285 message_center::MessagePopupBubble* popup_bubble = | |
286 new message_center::MessagePopupBubble(message_center()); | |
287 popup_bubble_.reset(new internal::WebNotificationBubbleWrapper( | |
288 this, popup_bubble)); | |
289 } | |
290 return true; | 282 return true; |
291 } | 283 } |
292 | 284 |
293 void WebNotificationTray::UpdatePopups() { | 285 void WebNotificationTray::UpdatePopups() { |
294 if (popup_bubble()) | 286 if (popup_bubble()) |
295 popup_bubble()->bubble()->ScheduleUpdate(); | 287 popup_bubble()->bubble()->ScheduleUpdate(); |
296 }; | 288 }; |
297 | 289 |
298 void WebNotificationTray::HidePopups() { | 290 void WebNotificationTray::HidePopups() { |
299 popup_bubble_.reset(); | 291 popup_bubble_.reset(); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } | 516 } |
525 | 517 |
526 message_center::MessageCenterBubble* | 518 message_center::MessageCenterBubble* |
527 WebNotificationTray::GetMessageCenterBubbleForTest() { | 519 WebNotificationTray::GetMessageCenterBubbleForTest() { |
528 if (!message_center_bubble()) | 520 if (!message_center_bubble()) |
529 return NULL; | 521 return NULL; |
530 return static_cast<message_center::MessageCenterBubble*>( | 522 return static_cast<message_center::MessageCenterBubble*>( |
531 message_center_bubble()->bubble()); | 523 message_center_bubble()->bubble()); |
532 } | 524 } |
533 | 525 |
534 message_center::MessagePopupBubble* | |
535 WebNotificationTray::GetPopupBubbleForTest() { | |
536 if (!popup_bubble()) | |
537 return NULL; | |
538 return static_cast<message_center::MessagePopupBubble*>( | |
539 popup_bubble()->bubble()); | |
540 } | |
541 | |
542 } // namespace ash | 526 } // namespace ash |
OLD | NEW |