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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
9 #include "ash/common/shelf/shelf_constants.h" | 9 #include "ash/common/shelf/shelf_constants.h" |
10 #include "ash/common/shelf/wm_shelf_util.h" | 10 #include "ash/common/shelf/wm_shelf_util.h" |
11 #include "ash/common/shell_window_ids.h" | 11 #include "ash/common/shell_window_ids.h" |
12 #include "ash/common/system/tray/tray_constants.h" | 12 #include "ash/common/system/tray/tray_constants.h" |
13 #include "ash/common/system/tray/tray_utils.h" | 13 #include "ash/common/system/tray/tray_utils.h" |
14 #include "ash/common/wm_lookup.h" | 14 #include "ash/common/wm_lookup.h" |
15 #include "ash/common/wm_root_window_controller.h" | 15 #include "ash/common/wm_root_window_controller.h" |
16 #include "ash/common/wm_window.h" | 16 #include "ash/common/wm_window.h" |
17 #include "ash/root_window_controller.h" | |
18 #include "ash/shelf/shelf_layout_manager.h" | 17 #include "ash/shelf/shelf_layout_manager.h" |
19 #include "ash/shelf/shelf_layout_manager_observer.h" | |
20 #include "ash/shelf/shelf_util.h" | |
21 #include "ash/shelf/shelf_widget.h" | |
22 #include "ash/shell.h" | 18 #include "ash/shell.h" |
23 #include "ash/system/status_area_widget.h" | 19 #include "ash/system/status_area_widget.h" |
24 #include "ash/system/tray/system_tray.h" | 20 #include "ash/system/tray/system_tray.h" |
25 #include "ash/system/tray/tray_background_view.h" | 21 #include "ash/system/tray/tray_background_view.h" |
26 #include "ash/system/tray/tray_bubble_wrapper.h" | 22 #include "ash/system/tray/tray_bubble_wrapper.h" |
27 #include "ash/system/web_notification/ash_popup_alignment_delegate.h" | 23 #include "ash/system/web_notification/ash_popup_alignment_delegate.h" |
28 #include "base/auto_reset.h" | 24 #include "base/auto_reset.h" |
29 #include "base/i18n/number_formatting.h" | 25 #include "base/i18n/number_formatting.h" |
30 #include "base/i18n/rtl.h" | 26 #include "base/i18n/rtl.h" |
31 #include "base/strings/utf_string_conversions.h" | 27 #include "base/strings/utf_string_conversions.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 should_block_shelf_auto_hide_(false) { | 208 should_block_shelf_auto_hide_(false) { |
213 button_ = new WebNotificationButton(this); | 209 button_ = new WebNotificationButton(this); |
214 button_->set_triggerable_event_flags( | 210 button_->set_triggerable_event_flags( |
215 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON); | 211 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON); |
216 tray_container()->AddChildView(button_); | 212 tray_container()->AddChildView(button_); |
217 SetContentsBackground(); | 213 SetContentsBackground(); |
218 tray_container()->SetBorder(views::Border::NullBorder()); | 214 tray_container()->SetBorder(views::Border::NullBorder()); |
219 message_center_tray_.reset(new message_center::MessageCenterTray( | 215 message_center_tray_.reset(new message_center::MessageCenterTray( |
220 this, | 216 this, |
221 message_center::MessageCenter::Get())); | 217 message_center::MessageCenter::Get())); |
222 popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate( | 218 WmShelf* shelf = WmLookup::Get() |
223 status_area_widget->shelf_widget()->shelf_layout_manager())); | 219 ->GetWindowForWidget(status_area_widget) |
| 220 ->GetRootWindowController() |
| 221 ->GetShelf(); |
| 222 popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf)); |
224 // TODO(jamescook): Either MessagePopupCollection needs to become aware of | 223 // TODO(jamescook): Either MessagePopupCollection needs to become aware of |
225 // mus or we need some sort of parent/container provider. | 224 // mus or we need some sort of parent/container provider. |
226 popup_collection_.reset(new message_center::MessagePopupCollection( | 225 popup_collection_.reset(new message_center::MessagePopupCollection( |
227 ash::Shell::GetContainer( | 226 ash::Shell::GetContainer( |
228 status_area_widget->GetNativeView()->GetRootWindow(), | 227 status_area_widget->GetNativeView()->GetRootWindow(), |
229 kShellWindowId_StatusContainer), | 228 kShellWindowId_StatusContainer), |
230 message_center(), | 229 message_center(), |
231 message_center_tray_.get(), | 230 message_center_tray_.get(), |
232 popup_alignment_delegate_.get())); | 231 popup_alignment_delegate_.get())); |
233 const display::Display& display = WmLookup::Get() | 232 const display::Display& display = WmLookup::Get() |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 | 524 |
526 message_center::MessageCenterBubble* | 525 message_center::MessageCenterBubble* |
527 WebNotificationTray::GetMessageCenterBubbleForTest() { | 526 WebNotificationTray::GetMessageCenterBubbleForTest() { |
528 if (!message_center_bubble()) | 527 if (!message_center_bubble()) |
529 return NULL; | 528 return NULL; |
530 return static_cast<message_center::MessageCenterBubble*>( | 529 return static_cast<message_center::MessageCenterBubble*>( |
531 message_center_bubble()->bubble()); | 530 message_center_bubble()->bubble()); |
532 } | 531 } |
533 | 532 |
534 } // namespace ash | 533 } // namespace ash |
OLD | NEW |