| 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 "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" |
| 11 #include "ui/message_center/views/message_popup_collection.h" | 11 #include "ui/message_center/views/message_popup_collection.h" |
| 12 | 12 |
| 13 namespace message_center { | 13 namespace message_center { |
| 14 | 14 |
| 15 DesktopPopupAlignmentDelegate::DesktopPopupAlignmentDelegate() | 15 DesktopPopupAlignmentDelegate::DesktopPopupAlignmentDelegate() |
| 16 : alignment_(POPUP_ALIGNMENT_BOTTOM | POPUP_ALIGNMENT_RIGHT), | 16 : alignment_(POPUP_ALIGNMENT_BOTTOM | POPUP_ALIGNMENT_RIGHT), |
| 17 primary_display_id_(display::Display::kInvalidDisplayID), | 17 primary_display_id_(display::kInvalidDisplayId), |
| 18 screen_(NULL) {} | 18 screen_(NULL) {} |
| 19 | 19 |
| 20 DesktopPopupAlignmentDelegate::~DesktopPopupAlignmentDelegate() { | 20 DesktopPopupAlignmentDelegate::~DesktopPopupAlignmentDelegate() { |
| 21 if (screen_) | 21 if (screen_) |
| 22 screen_->RemoveObserver(this); | 22 screen_->RemoveObserver(this); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void DesktopPopupAlignmentDelegate::StartObserving(display::Screen* screen) { | 25 void DesktopPopupAlignmentDelegate::StartObserving(display::Screen* screen) { |
| 26 if (screen_ || !screen) | 26 if (screen_ || !screen) |
| 27 return; | 27 return; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 void DesktopPopupAlignmentDelegate::OnDisplayRemoved( | 113 void DesktopPopupAlignmentDelegate::OnDisplayRemoved( |
| 114 const display::Display& removed_display) { | 114 const display::Display& removed_display) { |
| 115 // The removed display may have been the primary display. | 115 // The removed display may have been the primary display. |
| 116 UpdatePrimaryDisplay(); | 116 UpdatePrimaryDisplay(); |
| 117 } | 117 } |
| 118 | 118 |
| 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::kInvalidDisplayId; |
| 125 UpdatePrimaryDisplay(); | 125 UpdatePrimaryDisplay(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace message_center | 128 } // namespace message_center |
| OLD | NEW |