| 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/system/web_notification/ash_popup_alignment_delegate.h" | 5 #include "ash/system/web_notification/ash_popup_alignment_delegate.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/shelf_types.h" | 7 #include "ash/public/cpp/shelf_types.h" |
| 8 #include "ash/public/cpp/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shelf/shelf_constants.h" | 10 #include "ash/shelf/shelf_constants.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 views::Widget::InitParams* init_params) { | 115 views::Widget::InitParams* init_params) { |
| 116 init_params->shadow_type = views::Widget::InitParams::SHADOW_TYPE_DROP; | 116 init_params->shadow_type = views::Widget::InitParams::SHADOW_TYPE_DROP; |
| 117 init_params->shadow_elevation = ::wm::ShadowElevation::MEDIUM; | 117 init_params->shadow_elevation = ::wm::ShadowElevation::MEDIUM; |
| 118 // On ash, popups go in the status container. | 118 // On ash, popups go in the status container. |
| 119 shelf_->GetWindow() | 119 shelf_->GetWindow() |
| 120 ->GetRootWindowController() | 120 ->GetRootWindowController() |
| 121 ->ConfigureWidgetInitParamsForContainer( | 121 ->ConfigureWidgetInitParamsForContainer( |
| 122 widget, kShellWindowId_StatusContainer, init_params); | 122 widget, kShellWindowId_StatusContainer, init_params); |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool AshPopupAlignmentDelegate::IsPrimaryDisplayForNotification() const { |
| 126 return screen_ && |
| 127 GetCurrentDisplay().id() == screen_->GetPrimaryDisplay().id(); |
| 128 } |
| 129 |
| 125 ShelfAlignment AshPopupAlignmentDelegate::GetAlignment() const { | 130 ShelfAlignment AshPopupAlignmentDelegate::GetAlignment() const { |
| 126 return shelf_->GetAlignment(); | 131 return shelf_->GetAlignment(); |
| 127 } | 132 } |
| 128 | 133 |
| 129 display::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const { | 134 display::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const { |
| 130 return shelf_->GetWindow()->GetDisplayNearestWindow(); | 135 return shelf_->GetWindow()->GetDisplayNearestWindow(); |
| 131 } | 136 } |
| 132 | 137 |
| 133 void AshPopupAlignmentDelegate::UpdateWorkArea() { | 138 void AshPopupAlignmentDelegate::UpdateWorkArea() { |
| 134 work_area_ = shelf_->GetUserWorkAreaBounds(); | 139 work_area_ = shelf_->GetUserWorkAreaBounds(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 158 const display::Display& old_display) {} | 163 const display::Display& old_display) {} |
| 159 | 164 |
| 160 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( | 165 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( |
| 161 const display::Display& display, | 166 const display::Display& display, |
| 162 uint32_t metrics) { | 167 uint32_t metrics) { |
| 163 if (GetCurrentDisplay().id() == display.id()) | 168 if (GetCurrentDisplay().id() == display.id()) |
| 164 UpdateWorkArea(); | 169 UpdateWorkArea(); |
| 165 } | 170 } |
| 166 | 171 |
| 167 } // namespace ash | 172 } // namespace ash |
| OLD | NEW |