| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/system/web_notification/ash_popup_alignment_delegate.h" | 5 #include "ash/common/system/web_notification/ash_popup_alignment_delegate.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_constants.h" | 7 #include "ash/common/shelf/shelf_constants.h" |
| 8 #include "ash/common/shelf/wm_shelf.h" | 8 #include "ash/common/shelf/wm_shelf.h" |
| 9 #include "ash/common/wm_root_window_controller.h" | 9 #include "ash/common/wm_root_window_controller.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/common/wm_window.h" | 11 #include "ash/common/wm_window.h" |
| 12 #include "ash/public/cpp/shelf_types.h" | 12 #include "ash/public/cpp/shelf_types.h" |
| 13 #include "ash/public/cpp/shell_window_ids.h" | 13 #include "ash/public/cpp/shell_window_ids.h" |
| 14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 15 #include "ui/display/display.h" | 15 #include "ui/display/display.h" |
| 16 #include "ui/display/screen.h" | 16 #include "ui/display/screen.h" |
| 17 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
| 18 #include "ui/message_center/message_center_style.h" | 18 #include "ui/message_center/message_center_style.h" |
| 19 #include "ui/message_center/views/message_popup_collection.h" | 19 #include "ui/message_center/views/message_popup_collection.h" |
| 20 #include "ui/wm/core/shadow_types.h" |
| 20 | 21 |
| 21 namespace ash { | 22 namespace ash { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 const int kToastMarginX = 7; | 26 const int kToastMarginX = 7; |
| 26 | 27 |
| 27 // If there should be no margin for the first item, this value needs to be | 28 // If there should be no margin for the first item, this value needs to be |
| 28 // substracted to flush the message to the shelf (the width of the border + | 29 // substracted to flush the message to the shelf (the width of the border + |
| 29 // shadow). | 30 // shadow). |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 107 } |
| 107 | 108 |
| 108 void AshPopupAlignmentDelegate::RecomputeAlignment( | 109 void AshPopupAlignmentDelegate::RecomputeAlignment( |
| 109 const display::Display& display) { | 110 const display::Display& display) { |
| 110 // Nothing needs to be done. | 111 // Nothing needs to be done. |
| 111 } | 112 } |
| 112 | 113 |
| 113 void AshPopupAlignmentDelegate::ConfigureWidgetInitParamsForContainer( | 114 void AshPopupAlignmentDelegate::ConfigureWidgetInitParamsForContainer( |
| 114 views::Widget* widget, | 115 views::Widget* widget, |
| 115 views::Widget::InitParams* init_params) { | 116 views::Widget::InitParams* init_params) { |
| 117 init_params->shadow_type = views::Widget::InitParams::SHADOW_TYPE_DROP; |
| 118 init_params->shadow_elevation = ::wm::ShadowElevation::MEDIUM; |
| 116 // On ash, popups go in the status container. | 119 // On ash, popups go in the status container. |
| 117 shelf_->GetWindow() | 120 shelf_->GetWindow() |
| 118 ->GetRootWindowController() | 121 ->GetRootWindowController() |
| 119 ->ConfigureWidgetInitParamsForContainer( | 122 ->ConfigureWidgetInitParamsForContainer( |
| 120 widget, kShellWindowId_StatusContainer, init_params); | 123 widget, kShellWindowId_StatusContainer, init_params); |
| 121 } | 124 } |
| 122 | 125 |
| 123 ShelfAlignment AshPopupAlignmentDelegate::GetAlignment() const { | 126 ShelfAlignment AshPopupAlignmentDelegate::GetAlignment() const { |
| 124 return shelf_->GetAlignment(); | 127 return shelf_->GetAlignment(); |
| 125 } | 128 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 156 const display::Display& old_display) {} | 159 const display::Display& old_display) {} |
| 157 | 160 |
| 158 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( | 161 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( |
| 159 const display::Display& display, | 162 const display::Display& display, |
| 160 uint32_t metrics) { | 163 uint32_t metrics) { |
| 161 if (GetCurrentDisplay().id() == display.id()) | 164 if (GetCurrentDisplay().id() == display.id()) |
| 162 UpdateWorkArea(); | 165 UpdateWorkArea(); |
| 163 } | 166 } |
| 164 | 167 |
| 165 } // namespace ash | 168 } // namespace ash |
| OLD | NEW |