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/shelf/shelf_constants.h" | 7 #include "ash/common/shelf/shelf_constants.h" |
8 #include "ash/common/shelf/shelf_types.h" | 8 #include "ash/common/shelf/shelf_types.h" |
9 #include "ash/common/shelf/wm_shelf.h" | 9 #include "ash/common/shelf/wm_shelf.h" |
| 10 #include "ash/common/shell_window_ids.h" |
| 11 #include "ash/common/wm_root_window_controller.h" |
10 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
11 #include "ash/common/wm_window.h" | 13 #include "ash/common/wm_window.h" |
12 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
13 #include "ui/display/display.h" | 15 #include "ui/display/display.h" |
14 #include "ui/display/screen.h" | 16 #include "ui/display/screen.h" |
15 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
16 #include "ui/message_center/message_center_style.h" | 18 #include "ui/message_center/message_center_style.h" |
17 #include "ui/message_center/views/message_popup_collection.h" | 19 #include "ui/message_center/views/message_popup_collection.h" |
18 | 20 |
19 namespace ash { | 21 namespace ash { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 99 |
98 bool AshPopupAlignmentDelegate::IsFromLeft() const { | 100 bool AshPopupAlignmentDelegate::IsFromLeft() const { |
99 return GetAlignment() == SHELF_ALIGNMENT_LEFT; | 101 return GetAlignment() == SHELF_ALIGNMENT_LEFT; |
100 } | 102 } |
101 | 103 |
102 void AshPopupAlignmentDelegate::RecomputeAlignment( | 104 void AshPopupAlignmentDelegate::RecomputeAlignment( |
103 const display::Display& display) { | 105 const display::Display& display) { |
104 // Nothing needs to be done. | 106 // Nothing needs to be done. |
105 } | 107 } |
106 | 108 |
| 109 void AshPopupAlignmentDelegate::ConfigureWidgetInitParamsForContainer( |
| 110 views::Widget* widget, |
| 111 views::Widget::InitParams* init_params) { |
| 112 // On ash, popups go in the status container. |
| 113 shelf_->GetWindow() |
| 114 ->GetRootWindowController() |
| 115 ->ConfigureWidgetInitParamsForContainer( |
| 116 widget, kShellWindowId_StatusContainer, init_params); |
| 117 } |
| 118 |
107 ShelfAlignment AshPopupAlignmentDelegate::GetAlignment() const { | 119 ShelfAlignment AshPopupAlignmentDelegate::GetAlignment() const { |
108 return shelf_->GetAlignment(); | 120 return shelf_->GetAlignment(); |
109 } | 121 } |
110 | 122 |
111 display::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const { | 123 display::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const { |
112 return shelf_->GetWindow()->GetDisplayNearestWindow(); | 124 return shelf_->GetWindow()->GetDisplayNearestWindow(); |
113 } | 125 } |
114 | 126 |
115 void AshPopupAlignmentDelegate::UpdateWorkArea() { | 127 void AshPopupAlignmentDelegate::UpdateWorkArea() { |
116 work_area_ = shelf_->GetUserWorkAreaBounds(); | 128 work_area_ = shelf_->GetUserWorkAreaBounds(); |
(...skipping 30 matching lines...) Expand all Loading... |
147 const display::Display& old_display) {} | 159 const display::Display& old_display) {} |
148 | 160 |
149 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( | 161 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( |
150 const display::Display& display, | 162 const display::Display& display, |
151 uint32_t metrics) { | 163 uint32_t metrics) { |
152 if (GetCurrentDisplay().id() == display.id()) | 164 if (GetCurrentDisplay().id() == display.id()) |
153 UpdateWorkArea(); | 165 UpdateWorkArea(); |
154 } | 166 } |
155 | 167 |
156 } // namespace ash | 168 } // namespace ash |
OLD | NEW |