| 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/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_layout_manager_observer.h" | 10 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 11 #include "ash/shelf/shelf_util.h" | 11 #include "ash/shelf/shelf_util.h" |
| 12 #include "ash/shelf/shelf_widget.h" | 12 #include "ash/shelf/shelf_widget.h" |
| 13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "ash/shell_window_ids.h" | 14 #include "ash/shell_window_ids.h" |
| 15 #include "ash/system/status_area_widget.h" | 15 #include "ash/system/status_area_widget.h" |
| 16 #include "ash/system/tray/system_tray.h" | 16 #include "ash/system/tray/system_tray.h" |
| 17 #include "ash/system/tray/tray_background_view.h" | 17 #include "ash/system/tray/tray_background_view.h" |
| 18 #include "ash/system/tray/tray_bubble_wrapper.h" | 18 #include "ash/system/tray/tray_bubble_wrapper.h" |
| 19 #include "ash/system/tray/tray_constants.h" | 19 #include "ash/system/tray/tray_constants.h" |
| 20 #include "ash/system/tray/tray_utils.h" | 20 #include "ash/system/tray/tray_utils.h" |
| 21 #include "ash/system/web_notification/ash_popup_alignment_delegate.h" | 21 #include "ash/system/web_notification/ash_popup_alignment_delegate.h" |
| 22 #include "ash/wm/common/shelf/wm_shelf_util.h" |
| 22 #include "base/auto_reset.h" | 23 #include "base/auto_reset.h" |
| 23 #include "base/i18n/number_formatting.h" | 24 #include "base/i18n/number_formatting.h" |
| 24 #include "base/i18n/rtl.h" | 25 #include "base/i18n/rtl.h" |
| 25 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| 26 #include "base/thread_task_runner_handle.h" | 27 #include "base/thread_task_runner_handle.h" |
| 27 #include "grit/ash_strings.h" | 28 #include "grit/ash_strings.h" |
| 28 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
| 29 #include "ui/aura/window_event_dispatcher.h" | 30 #include "ui/aura/window_event_dispatcher.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/display/screen.h" | 32 #include "ui/display/screen.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 should_block_shelf_auto_hide_ = true; | 217 should_block_shelf_auto_hide_ = true; |
| 217 message_center::MessageCenterBubble* message_center_bubble = | 218 message_center::MessageCenterBubble* message_center_bubble = |
| 218 new message_center::MessageCenterBubble( | 219 new message_center::MessageCenterBubble( |
| 219 message_center(), | 220 message_center(), |
| 220 message_center_tray_.get(), | 221 message_center_tray_.get(), |
| 221 true); | 222 true); |
| 222 | 223 |
| 223 // Assume the status area and bubble bottoms are aligned when vertical. | 224 // Assume the status area and bubble bottoms are aligned when vertical. |
| 224 aura::Window* status_area_window = status_area_widget()->GetNativeView(); | 225 aura::Window* status_area_window = status_area_widget()->GetNativeView(); |
| 225 const int max_height = | 226 const int max_height = |
| 226 IsHorizontalAlignment(GetShelfLayoutManager()->GetAlignment()) | 227 wm::IsHorizontalAlignment(GetShelfLayoutManager()->GetAlignment()) |
| 227 ? GetShelfLayoutManager()->GetIdealBounds().y() | 228 ? GetShelfLayoutManager()->GetIdealBounds().y() |
| 228 : status_area_window->GetBoundsInRootWindow().bottom(); | 229 : status_area_window->GetBoundsInRootWindow().bottom(); |
| 229 | 230 |
| 230 message_center_bubble->SetMaxHeight(std::max(0, max_height - kTraySpacing)); | 231 message_center_bubble->SetMaxHeight(std::max(0, max_height - kTraySpacing)); |
| 231 if (show_settings) | 232 if (show_settings) |
| 232 message_center_bubble->SetSettingsVisible(); | 233 message_center_bubble->SetSettingsVisible(); |
| 233 message_center_bubble_.reset( | 234 message_center_bubble_.reset( |
| 234 new WebNotificationBubbleWrapper(this, message_center_bubble)); | 235 new WebNotificationBubbleWrapper(this, message_center_bubble)); |
| 235 | 236 |
| 236 status_area_widget()->SetHideSystemNotifications(true); | 237 status_area_widget()->SetHideSystemNotifications(true); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 | 479 |
| 479 message_center::MessageCenterBubble* | 480 message_center::MessageCenterBubble* |
| 480 WebNotificationTray::GetMessageCenterBubbleForTest() { | 481 WebNotificationTray::GetMessageCenterBubbleForTest() { |
| 481 if (!message_center_bubble()) | 482 if (!message_center_bubble()) |
| 482 return NULL; | 483 return NULL; |
| 483 return static_cast<message_center::MessageCenterBubble*>( | 484 return static_cast<message_center::MessageCenterBubble*>( |
| 484 message_center_bubble()->bubble()); | 485 message_center_bubble()->bubble()); |
| 485 } | 486 } |
| 486 | 487 |
| 487 } // namespace ash | 488 } // namespace ash |
| OLD | NEW |