Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: ash/common/system/web_notification/ash_popup_alignment_delegate.cc

Issue 2472233002: Fix a bug of PopupAlignmentDelegate on non-primary display (Closed)
Patch Set: Addressed comment: returning a rect instead of top Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/system/web_notification/ash_popup_alignment_delegate.h" 5 #include "ash/common/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/wm_shelf.h" 8 #include "ash/common/shelf/wm_shelf.h"
9 #include "ash/common/wm_root_window_controller.h" 9 #include "ash/common/wm_root_window_controller.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (IsFromLeft()) 83 if (IsFromLeft())
84 return work_area_.x() + kToastMarginX; 84 return work_area_.x() + kToastMarginX;
85 return work_area_.right() - kToastMarginX - toast_bounds.width(); 85 return work_area_.right() - kToastMarginX - toast_bounds.width();
86 } 86 }
87 87
88 int AshPopupAlignmentDelegate::GetBaseLine() const { 88 int AshPopupAlignmentDelegate::GetBaseLine() const {
89 return work_area_.bottom() - kNoToastMarginBorderAndShadowOffset - 89 return work_area_.bottom() - kNoToastMarginBorderAndShadowOffset -
90 tray_bubble_height_; 90 tray_bubble_height_;
91 } 91 }
92 92
93 int AshPopupAlignmentDelegate::GetWorkAreaBottom() const { 93 gfx::Rect AshPopupAlignmentDelegate::GetWorkArea() const {
94 return work_area_.bottom() - tray_bubble_height_; 94 gfx::Rect work_area_without_tray_bubble = work_area_;
95 work_area_without_tray_bubble.set_height(
96 work_area_without_tray_bubble.height() - tray_bubble_height_);
97 return work_area_without_tray_bubble;
95 } 98 }
96 99
97 bool AshPopupAlignmentDelegate::IsTopDown() const { 100 bool AshPopupAlignmentDelegate::IsTopDown() const {
98 return false; 101 return false;
99 } 102 }
100 103
101 bool AshPopupAlignmentDelegate::IsFromLeft() const { 104 bool AshPopupAlignmentDelegate::IsFromLeft() const {
102 return GetAlignment() == SHELF_ALIGNMENT_LEFT; 105 return GetAlignment() == SHELF_ALIGNMENT_LEFT;
103 } 106 }
104 107
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 const display::Display& old_display) {} 156 const display::Display& old_display) {}
154 157
155 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged( 158 void AshPopupAlignmentDelegate::OnDisplayMetricsChanged(
156 const display::Display& display, 159 const display::Display& display,
157 uint32_t metrics) { 160 uint32_t metrics) {
158 if (GetCurrentDisplay().id() == display.id()) 161 if (GetCurrentDisplay().id() == display.id())
159 UpdateWorkArea(); 162 UpdateWorkArea();
160 } 163 }
161 164
162 } // namespace ash 165 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698