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

Side by Side Diff: ui/message_center/views/desktop_popup_alignment_delegate.cc

Issue 2078773003: Realign message center popups when displays are added or removed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // Since on some platforms like Ubuntu Unity there's also a launcher along 77 // Since on some platforms like Ubuntu Unity there's also a launcher along
78 // with a taskbar (panel), we need to check that there is really nothing at 78 // with a taskbar (panel), we need to check that there is really nothing at
79 // the top before concluding that the taskbar is at the left. 79 // the top before concluding that the taskbar is at the left.
80 alignment_ |= (work_area_.x() > display.bounds().x() && 80 alignment_ |= (work_area_.x() > display.bounds().x() &&
81 work_area_.y() == display.bounds().y()) 81 work_area_.y() == display.bounds().y())
82 ? POPUP_ALIGNMENT_LEFT 82 ? POPUP_ALIGNMENT_LEFT
83 : POPUP_ALIGNMENT_RIGHT; 83 : POPUP_ALIGNMENT_RIGHT;
84 } 84 }
85 85
86 void DesktopPopupAlignmentDelegate::OnDisplayAdded( 86 void DesktopPopupAlignmentDelegate::OnDisplayAdded(
87 const display::Display& new_display) {} 87 const display::Display& new_display) {
dewittj 2016/06/20 17:06:00 rename to added_display
Jun Mukai 2016/06/20 20:28:54 Can you also leave a comment for why these are nec
osandov 2016/06/21 08:01:05 Done.
osandov 2016/06/21 08:01:06 Done.
88 display::Display display = screen_->GetPrimaryDisplay();
dewittj 2016/06/20 17:06:00 nit: rename to primary_display
osandov 2016/06/21 08:01:05 This moved after refactoring, but also done.
89 if (new_display.id() == display.id() && display.id() != display_id_) {
90 display_id_ = display.id();
91 RecomputeAlignment(display);
dewittj 2016/06/20 17:06:00 Lots of code duplication between these, could you
osandov 2016/06/21 08:01:06 Done.
92 DoUpdateIfPossible();
93 }
94 }
88 95
89 void DesktopPopupAlignmentDelegate::OnDisplayRemoved( 96 void DesktopPopupAlignmentDelegate::OnDisplayRemoved(
90 const display::Display& old_display) {} 97 const display::Display& old_display) {
dewittj 2016/06/20 17:06:00 rename to removed_display
osandov 2016/06/21 08:01:06 Done.
98 if (old_display.id() == display_id_) {
99 display::Display display = screen_->GetPrimaryDisplay();
dewittj 2016/06/20 17:05:59 primary_display
osandov 2016/06/21 08:01:06 Done, moved in the refactoring.
100 display_id_ = display.id();
101 RecomputeAlignment(display);
102 DoUpdateIfPossible();
103 }
104 }
91 105
92 void DesktopPopupAlignmentDelegate::OnDisplayMetricsChanged( 106 void DesktopPopupAlignmentDelegate::OnDisplayMetricsChanged(
93 const display::Display& display, 107 const display::Display& display,
94 uint32_t metrics) { 108 uint32_t metrics) {
95 if (display.id() == display_id_) { 109 if (display.id() == display_id_) {
Jun Mukai 2016/06/20 20:28:54 Can it be renamed as |primary_display_id_|? That's
osandov 2016/06/21 08:02:40 Done.
96 RecomputeAlignment(display); 110 RecomputeAlignment(display);
97 DoUpdateIfPossible(); 111 DoUpdateIfPossible();
98 } 112 }
99 } 113 }
100 114
101 } // namespace message_center 115 } // namespace message_center
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698