| 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/window_tree_host_manager.h" | 7 #include "ash/display/window_tree_host_manager.h" |
| 8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
| 9 #include "ash/shelf/shelf_constants.h" | 9 #include "ash/shelf/shelf_constants.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // widgets should be at the bottom-left instead of bottom right. | 78 // widgets should be at the bottom-left instead of bottom right. |
| 79 if (base::i18n::IsRTL()) | 79 if (base::i18n::IsRTL()) |
| 80 return work_area_.x() + kToastMarginX; | 80 return work_area_.x() + kToastMarginX; |
| 81 | 81 |
| 82 if (IsFromLeft()) | 82 if (IsFromLeft()) |
| 83 return work_area_.x() + kToastMarginX; | 83 return work_area_.x() + kToastMarginX; |
| 84 return work_area_.right() - kToastMarginX - toast_bounds.width(); | 84 return work_area_.right() - kToastMarginX - toast_bounds.width(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 int AshPopupAlignmentDelegate::GetBaseLine() const { | 87 int AshPopupAlignmentDelegate::GetBaseLine() const { |
| 88 return IsTopDown() | 88 return work_area_.bottom() - kNoToastMarginBorderAndShadowOffset - |
| 89 ? work_area_.y() + kNoToastMarginBorderAndShadowOffset + | 89 system_tray_height_; |
| 90 system_tray_height_ | |
| 91 : work_area_.bottom() - kNoToastMarginBorderAndShadowOffset - | |
| 92 system_tray_height_; | |
| 93 } | 90 } |
| 94 | 91 |
| 95 int AshPopupAlignmentDelegate::GetWorkAreaBottom() const { | 92 int AshPopupAlignmentDelegate::GetWorkAreaBottom() const { |
| 96 return work_area_.bottom() - system_tray_height_; | 93 return work_area_.bottom() - system_tray_height_; |
| 97 } | 94 } |
| 98 | 95 |
| 99 bool AshPopupAlignmentDelegate::IsTopDown() const { | 96 bool AshPopupAlignmentDelegate::IsTopDown() const { |
| 100 return GetAlignment() == SHELF_ALIGNMENT_TOP; | 97 return false; |
| 101 } | 98 } |
| 102 | 99 |
| 103 bool AshPopupAlignmentDelegate::IsFromLeft() const { | 100 bool AshPopupAlignmentDelegate::IsFromLeft() const { |
| 104 return GetAlignment() == SHELF_ALIGNMENT_LEFT; | 101 return GetAlignment() == SHELF_ALIGNMENT_LEFT; |
| 105 } | 102 } |
| 106 | 103 |
| 107 void AshPopupAlignmentDelegate::RecomputeAlignment( | 104 void AshPopupAlignmentDelegate::RecomputeAlignment( |
| 108 const gfx::Display& display) { | 105 const gfx::Display& display) { |
| 109 // Nothing needs to be done. | 106 // Nothing needs to be done. |
| 110 } | 107 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 143 } |
| 147 | 144 |
| 148 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( | 145 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( |
| 149 const gfx::Display& display, | 146 const gfx::Display& display, |
| 150 uint32_t metrics) { | 147 uint32_t metrics) { |
| 151 if (GetCurrentDisplay().id() == display.id()) | 148 if (GetCurrentDisplay().id() == display.id()) |
| 152 UpdateWorkArea(); | 149 UpdateWorkArea(); |
| 153 } | 150 } |
| 154 | 151 |
| 155 } // namespace ash | 152 } // namespace ash |
| OLD | NEW |