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

Side by Side Diff: ui/message_center/views/desktop_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 "ui/message_center/views/desktop_popup_alignment_delegate.h" 5 #include "ui/message_center/views/desktop_popup_alignment_delegate.h"
6 6
7 #include "ui/display/display.h" 7 #include "ui/display/display.h"
8 #include "ui/display/screen.h" 8 #include "ui/display/screen.h"
9 #include "ui/gfx/geometry/rect.h" 9 #include "ui/gfx/geometry/rect.h"
10 #include "ui/message_center/message_center_style.h" 10 #include "ui/message_center/message_center_style.h"
(...skipping 28 matching lines...) Expand all
39 return work_area_.x() + kMarginBetweenItems; 39 return work_area_.x() + kMarginBetweenItems;
40 return work_area_.right() - kMarginBetweenItems - toast_bounds.width(); 40 return work_area_.right() - kMarginBetweenItems - toast_bounds.width();
41 } 41 }
42 42
43 int DesktopPopupAlignmentDelegate::GetBaseLine() const { 43 int DesktopPopupAlignmentDelegate::GetBaseLine() const {
44 return IsTopDown() 44 return IsTopDown()
45 ? work_area_.y() + kMarginBetweenItems 45 ? work_area_.y() + kMarginBetweenItems
46 : work_area_.bottom() - kMarginBetweenItems; 46 : work_area_.bottom() - kMarginBetweenItems;
47 } 47 }
48 48
49 int DesktopPopupAlignmentDelegate::GetWorkAreaBottom() const { 49 gfx::Rect DesktopPopupAlignmentDelegate::GetWorkArea() const {
50 return work_area_.bottom(); 50 return work_area_;
51 } 51 }
52 52
53 bool DesktopPopupAlignmentDelegate::IsTopDown() const { 53 bool DesktopPopupAlignmentDelegate::IsTopDown() const {
54 return (alignment_ & POPUP_ALIGNMENT_TOP) != 0; 54 return (alignment_ & POPUP_ALIGNMENT_TOP) != 0;
55 } 55 }
56 56
57 bool DesktopPopupAlignmentDelegate::IsFromLeft() const { 57 bool DesktopPopupAlignmentDelegate::IsFromLeft() const {
58 return (alignment_ & POPUP_ALIGNMENT_LEFT) != 0; 58 return (alignment_ & POPUP_ALIGNMENT_LEFT) != 0;
59 } 59 }
60 60
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void DesktopPopupAlignmentDelegate::OnDisplayMetricsChanged( 119 void DesktopPopupAlignmentDelegate::OnDisplayMetricsChanged(
120 const display::Display& display, 120 const display::Display& display,
121 uint32_t metrics) { 121 uint32_t metrics) {
122 // Set to kInvalidDisplayID so the alignment is updated regardless of whether 122 // Set to kInvalidDisplayID so the alignment is updated regardless of whether
123 // the primary display actually changed. 123 // the primary display actually changed.
124 primary_display_id_ = display::Display::kInvalidDisplayID; 124 primary_display_id_ = display::Display::kInvalidDisplayID;
125 UpdatePrimaryDisplay(); 125 UpdatePrimaryDisplay();
126 } 126 }
127 127
128 } // namespace message_center 128 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/desktop_popup_alignment_delegate.h ('k') | ui/message_center/views/message_popup_collection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698