| 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/common/wm/wm_lookup.h" |
| 8 #include "ash/common/wm/wm_window.h" |
| 7 #include "ash/display/window_tree_host_manager.h" | 9 #include "ash/display/window_tree_host_manager.h" |
| 8 #include "ash/screen_util.h" | |
| 9 #include "ash/shelf/shelf_constants.h" | 10 #include "ash/shelf/shelf_constants.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf_layout_manager.h" |
| 11 #include "ash/shelf/shelf_types.h" | 12 #include "ash/shelf/shelf_types.h" |
| 12 #include "ash/shelf/shelf_widget.h" | 13 #include "ash/shelf/shelf_widget.h" |
| 13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 14 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
| 15 #include "ui/aura/window.h" | |
| 16 #include "ui/display/display.h" | 16 #include "ui/display/display.h" |
| 17 #include "ui/display/screen.h" | 17 #include "ui/display/screen.h" |
| 18 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
| 19 #include "ui/message_center/message_center_style.h" | 19 #include "ui/message_center/message_center_style.h" |
| 20 #include "ui/message_center/views/message_popup_collection.h" | 20 #include "ui/message_center/views/message_popup_collection.h" |
| 21 | 21 |
| 22 namespace ash { | 22 namespace ash { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 void AshPopupAlignmentDelegate::RecomputeAlignment( | 105 void AshPopupAlignmentDelegate::RecomputeAlignment( |
| 106 const display::Display& display) { | 106 const display::Display& display) { |
| 107 // Nothing needs to be done. | 107 // Nothing needs to be done. |
| 108 } | 108 } |
| 109 | 109 |
| 110 wm::ShelfAlignment AshPopupAlignmentDelegate::GetAlignment() const { | 110 wm::ShelfAlignment AshPopupAlignmentDelegate::GetAlignment() const { |
| 111 return shelf_->GetAlignment(); | 111 return shelf_->GetAlignment(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 display::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const { | 114 display::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const { |
| 115 return display::Screen::GetScreen()->GetDisplayNearestWindow( | 115 return wm::WmLookup::Get() |
| 116 shelf_->shelf_widget()->GetNativeView()); | 116 ->GetWindowForWidget(shelf_->shelf_widget()) |
| 117 ->GetDisplayNearestWindow(); |
| 117 } | 118 } |
| 118 | 119 |
| 119 void AshPopupAlignmentDelegate::UpdateWorkArea() { | 120 void AshPopupAlignmentDelegate::UpdateWorkArea() { |
| 120 work_area_ = shelf_->user_work_area_bounds(); | 121 work_area_ = shelf_->user_work_area_bounds(); |
| 121 DoUpdateIfPossible(); | 122 DoUpdateIfPossible(); |
| 122 } | 123 } |
| 123 | 124 |
| 124 void AshPopupAlignmentDelegate::OnDisplayWorkAreaInsetsChanged() { | 125 void AshPopupAlignmentDelegate::OnDisplayWorkAreaInsetsChanged() { |
| 125 UpdateWorkArea(); | 126 UpdateWorkArea(); |
| 126 } | 127 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 142 const display::Display& old_display) {} | 143 const display::Display& old_display) {} |
| 143 | 144 |
| 144 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( | 145 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( |
| 145 const display::Display& display, | 146 const display::Display& display, |
| 146 uint32_t metrics) { | 147 uint32_t metrics) { |
| 147 if (GetCurrentDisplay().id() == display.id()) | 148 if (GetCurrentDisplay().id() == display.id()) |
| 148 UpdateWorkArea(); | 149 UpdateWorkArea(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 } // namespace ash | 152 } // namespace ash |
| OLD | NEW |