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/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/screen_util.h" |
8 #include "ash/shelf/shelf_constants.h" | 9 #include "ash/shelf/shelf_constants.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_types.h" | 11 #include "ash/shelf/shelf_types.h" |
11 #include "ash/shelf/shelf_widget.h" | 12 #include "ash/shelf/shelf_widget.h" |
12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
13 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
15 #include "ui/gfx/display.h" | 16 #include "ui/gfx/display.h" |
16 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
17 #include "ui/gfx/screen.h" | 18 #include "ui/gfx/screen.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 130 } |
130 | 131 |
131 gfx::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const { | 132 gfx::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const { |
132 return Shell::GetScreen()->GetDisplayNearestWindow( | 133 return Shell::GetScreen()->GetDisplayNearestWindow( |
133 shelf_->shelf_widget()->GetNativeView()); | 134 shelf_->shelf_widget()->GetNativeView()); |
134 } | 135 } |
135 | 136 |
136 void AshPopupAlignmentDelegate::UpdateWorkArea(const gfx::Display& display, | 137 void AshPopupAlignmentDelegate::UpdateWorkArea(const gfx::Display& display, |
137 ShelfAutoHideState new_state) { | 138 ShelfAutoHideState new_state) { |
138 work_area_ = display.work_area(); | 139 work_area_ = display.work_area(); |
| 140 if (Shell::GetInstance()->display_manager()->IsInUnifiedMode()) { |
| 141 gfx::Rect bounds = ScreenUtil::GetShelfDisplayBoundsInScreen( |
| 142 shelf_->shelf_widget()->GetNativeView()); |
| 143 work_area_.Intersect(bounds); |
| 144 } |
| 145 |
139 int width = 0; | 146 int width = 0; |
140 if (shelf_ && (shelf_->visibility_state() == SHELF_AUTO_HIDE) && | 147 if (shelf_ && (shelf_->visibility_state() == SHELF_AUTO_HIDE) && |
141 new_state == SHELF_AUTO_HIDE_SHOWN) { | 148 new_state == SHELF_AUTO_HIDE_SHOWN) { |
142 // Since the work_area is already reduced by kAutoHideSize, the inset width | 149 // Since the work_area is already reduced by kAutoHideSize, the inset width |
143 // should be just the difference. | 150 // should be just the difference. |
144 width = kShelfSize - ShelfLayoutManager::kAutoHideSize; | 151 width = kShelfSize - ShelfLayoutManager::kAutoHideSize; |
145 } | 152 } |
146 work_area_.Inset(shelf_->SelectValueForShelfAlignment( | 153 work_area_.Inset(shelf_->SelectValueForShelfAlignment( |
147 gfx::Insets(0, 0, width, 0), | 154 gfx::Insets(0, 0, width, 0), |
148 gfx::Insets(0, width, 0, 0), | 155 gfx::Insets(0, width, 0, 0), |
(...skipping 23 matching lines...) Expand all Loading... |
172 | 179 |
173 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( | 180 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( |
174 const gfx::Display& display, | 181 const gfx::Display& display, |
175 uint32_t metrics) { | 182 uint32_t metrics) { |
176 UpdateShelf(); | 183 UpdateShelf(); |
177 if (shelf_ && GetCurrentDisplay().id() == display.id()) | 184 if (shelf_ && GetCurrentDisplay().id() == display.id()) |
178 UpdateWorkArea(display, shelf_->auto_hide_state()); | 185 UpdateWorkArea(display, shelf_->auto_hide_state()); |
179 } | 186 } |
180 | 187 |
181 } // namespace ash | 188 } // namespace ash |
OLD | NEW |