| 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/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
| 9 #include "ash/common/wm/shelf/wm_shelf_util.h" | 9 #include "ash/common/wm/shelf/wm_shelf_util.h" |
| 10 #include "ash/common/wm/wm_lookup.h" | 10 #include "ash/common/wm_lookup.h" |
| 11 #include "ash/common/wm/wm_root_window_controller.h" | 11 #include "ash/common/wm_root_window_controller.h" |
| 12 #include "ash/common/wm/wm_window.h" | 12 #include "ash/common/wm_window.h" |
| 13 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
| 14 #include "ash/shelf/shelf_layout_manager.h" | 14 #include "ash/shelf/shelf_layout_manager.h" |
| 15 #include "ash/shelf/shelf_layout_manager_observer.h" | 15 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 16 #include "ash/shelf/shelf_util.h" | 16 #include "ash/shelf/shelf_util.h" |
| 17 #include "ash/shelf/shelf_widget.h" | 17 #include "ash/shelf/shelf_widget.h" |
| 18 #include "ash/shell.h" | 18 #include "ash/shell.h" |
| 19 #include "ash/system/status_area_widget.h" | 19 #include "ash/system/status_area_widget.h" |
| 20 #include "ash/system/tray/system_tray.h" | 20 #include "ash/system/tray/system_tray.h" |
| 21 #include "ash/system/tray/tray_background_view.h" | 21 #include "ash/system/tray/tray_background_view.h" |
| 22 #include "ash/system/tray/tray_bubble_wrapper.h" | 22 #include "ash/system/tray/tray_bubble_wrapper.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 status_area_widget->shelf_widget()->shelf_layout_manager())); | 213 status_area_widget->shelf_widget()->shelf_layout_manager())); |
| 214 // TODO(jamescook): Either MessagePopupCollection needs to become aware of | 214 // TODO(jamescook): Either MessagePopupCollection needs to become aware of |
| 215 // mus or we need some sort of parent/container provider. | 215 // mus or we need some sort of parent/container provider. |
| 216 popup_collection_.reset(new message_center::MessagePopupCollection( | 216 popup_collection_.reset(new message_center::MessagePopupCollection( |
| 217 ash::Shell::GetContainer( | 217 ash::Shell::GetContainer( |
| 218 status_area_widget->GetNativeView()->GetRootWindow(), | 218 status_area_widget->GetNativeView()->GetRootWindow(), |
| 219 kShellWindowId_StatusContainer), | 219 kShellWindowId_StatusContainer), |
| 220 message_center(), | 220 message_center(), |
| 221 message_center_tray_.get(), | 221 message_center_tray_.get(), |
| 222 popup_alignment_delegate_.get())); | 222 popup_alignment_delegate_.get())); |
| 223 const display::Display& display = wm::WmLookup::Get() | 223 const display::Display& display = WmLookup::Get() |
| 224 ->GetWindowForWidget(status_area_widget) | 224 ->GetWindowForWidget(status_area_widget) |
| 225 ->GetDisplayNearestWindow(); | 225 ->GetDisplayNearestWindow(); |
| 226 popup_alignment_delegate_->StartObserving(display::Screen::GetScreen(), | 226 popup_alignment_delegate_->StartObserving(display::Screen::GetScreen(), |
| 227 display); | 227 display); |
| 228 OnMessageCenterTrayChanged(); | 228 OnMessageCenterTrayChanged(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 WebNotificationTray::~WebNotificationTray() { | 231 WebNotificationTray::~WebNotificationTray() { |
| 232 // Release any child views that might have back pointers before ~View(). | 232 // Release any child views that might have back pointers before ~View(). |
| 233 message_center_bubble_.reset(); | 233 message_center_bubble_.reset(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 246 new message_center::MessageCenterBubble( | 246 new message_center::MessageCenterBubble( |
| 247 message_center(), | 247 message_center(), |
| 248 message_center_tray_.get(), | 248 message_center_tray_.get(), |
| 249 true); | 249 true); |
| 250 | 250 |
| 251 int max_height; | 251 int max_height; |
| 252 if (wm::IsHorizontalAlignment(GetShelfLayoutManager()->GetAlignment())) { | 252 if (wm::IsHorizontalAlignment(GetShelfLayoutManager()->GetAlignment())) { |
| 253 max_height = GetShelfLayoutManager()->GetIdealBounds().y(); | 253 max_height = GetShelfLayoutManager()->GetIdealBounds().y(); |
| 254 } else { | 254 } else { |
| 255 // Assume the status area and bubble bottoms are aligned when vertical. | 255 // Assume the status area and bubble bottoms are aligned when vertical. |
| 256 wm::WmWindow* status_area_window = | 256 WmWindow* status_area_window = |
| 257 wm::WmLookup::Get()->GetWindowForWidget(status_area_widget()); | 257 WmLookup::Get()->GetWindowForWidget(status_area_widget()); |
| 258 gfx::Rect bounds_in_root = | 258 gfx::Rect bounds_in_root = |
| 259 status_area_window->GetRootWindow()->ConvertRectFromScreen( | 259 status_area_window->GetRootWindow()->ConvertRectFromScreen( |
| 260 status_area_window->GetBoundsInScreen()); | 260 status_area_window->GetBoundsInScreen()); |
| 261 max_height = bounds_in_root.bottom(); | 261 max_height = bounds_in_root.bottom(); |
| 262 } | 262 } |
| 263 message_center_bubble->SetMaxHeight(std::max(0, max_height - kTraySpacing)); | 263 message_center_bubble->SetMaxHeight(std::max(0, max_height - kTraySpacing)); |
| 264 if (show_settings) | 264 if (show_settings) |
| 265 message_center_bubble->SetSettingsVisible(); | 265 message_center_bubble->SetSettingsVisible(); |
| 266 message_center_bubble_.reset( | 266 message_center_bubble_.reset( |
| 267 new WebNotificationBubbleWrapper(this, message_center_bubble)); | 267 new WebNotificationBubbleWrapper(this, message_center_bubble)); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 | 513 |
| 514 message_center::MessageCenterBubble* | 514 message_center::MessageCenterBubble* |
| 515 WebNotificationTray::GetMessageCenterBubbleForTest() { | 515 WebNotificationTray::GetMessageCenterBubbleForTest() { |
| 516 if (!message_center_bubble()) | 516 if (!message_center_bubble()) |
| 517 return NULL; | 517 return NULL; |
| 518 return static_cast<message_center::MessageCenterBubble*>( | 518 return static_cast<message_center::MessageCenterBubble*>( |
| 519 message_center_bubble()->bubble()); | 519 message_center_bubble()->bubble()); |
| 520 } | 520 } |
| 521 | 521 |
| 522 } // namespace ash | 522 } // namespace ash |
| OLD | NEW |