OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/message_popup_collection.h" | 5 #include "ui/message_center/views/message_popup_collection.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 void MessagePopupCollection::SetDisplayInfo(const gfx::Rect& work_area, | 554 void MessagePopupCollection::SetDisplayInfo(const gfx::Rect& work_area, |
555 const gfx::Rect& screen_bounds) { | 555 const gfx::Rect& screen_bounds) { |
556 if (work_area_ == work_area) | 556 if (work_area_ == work_area) |
557 return; | 557 return; |
558 | 558 |
559 work_area_ = work_area; | 559 work_area_ = work_area; |
560 ComputePopupAlignment(work_area, screen_bounds); | 560 ComputePopupAlignment(work_area, screen_bounds); |
561 RepositionWidgets(); | 561 RepositionWidgets(); |
562 } | 562 } |
563 | 563 |
| 564 void MessagePopupCollection::OnDisplayBoundsChanged( |
| 565 const gfx::Display& display) { |
| 566 if (display.id() != display_id_) |
| 567 return; |
| 568 |
| 569 SetDisplayInfo(display.work_area(), display.bounds()); |
| 570 } |
| 571 |
564 void MessagePopupCollection::OnDisplayAdded(const gfx::Display& new_display) { | 572 void MessagePopupCollection::OnDisplayAdded(const gfx::Display& new_display) { |
565 } | 573 } |
566 | 574 |
567 void MessagePopupCollection::OnDisplayRemoved(const gfx::Display& old_display) { | 575 void MessagePopupCollection::OnDisplayRemoved(const gfx::Display& old_display) { |
568 if (display_id_ == old_display.id() && !parent_) { | 576 if (display_id_ == old_display.id() && !parent_) { |
569 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 577 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
570 display_id_ = display.id(); | 578 display_id_ = display.id(); |
571 SetDisplayInfo(display.work_area(), display.bounds()); | 579 SetDisplayInfo(display.work_area(), display.bounds()); |
572 } | 580 } |
573 } | 581 } |
574 | 582 |
575 void MessagePopupCollection::OnDisplayMetricsChanged( | |
576 const gfx::Display& display, uint32_t metrics) { | |
577 if (display.id() != display_id_) | |
578 return; | |
579 | |
580 if (metrics & DISPLAY_METRIC_BOUNDS || metrics & DISPLAY_METRIC_WORK_AREA) | |
581 SetDisplayInfo(display.work_area(), display.bounds()); | |
582 } | |
583 | |
584 views::Widget* MessagePopupCollection::GetWidgetForTest(const std::string& id) | 583 views::Widget* MessagePopupCollection::GetWidgetForTest(const std::string& id) |
585 const { | 584 const { |
586 for (Toasts::const_iterator iter = toasts_.begin(); iter != toasts_.end(); | 585 for (Toasts::const_iterator iter = toasts_.begin(); iter != toasts_.end(); |
587 ++iter) { | 586 ++iter) { |
588 if ((*iter)->id() == id) | 587 if ((*iter)->id() == id) |
589 return (*iter)->GetWidget(); | 588 return (*iter)->GetWidget(); |
590 } | 589 } |
591 return NULL; | 590 return NULL; |
592 } | 591 } |
593 | 592 |
(...skipping 15 matching lines...) Expand all Loading... |
609 views::Widget* widget = (*iter)->GetWidget(); | 608 views::Widget* widget = (*iter)->GetWidget(); |
610 if (widget) | 609 if (widget) |
611 return widget->GetWindowBoundsInScreen(); | 610 return widget->GetWindowBoundsInScreen(); |
612 break; | 611 break; |
613 } | 612 } |
614 } | 613 } |
615 return gfx::Rect(); | 614 return gfx::Rect(); |
616 } | 615 } |
617 | 616 |
618 } // namespace message_center | 617 } // namespace message_center |
OLD | NEW |