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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 void MessagePopupCollection::SetDisplayInfo(const gfx::Rect& work_area, | 552 void MessagePopupCollection::SetDisplayInfo(const gfx::Rect& work_area, |
553 const gfx::Rect& screen_bounds) { | 553 const gfx::Rect& screen_bounds) { |
554 if (work_area_ == work_area) | 554 if (work_area_ == work_area) |
555 return; | 555 return; |
556 | 556 |
557 work_area_ = work_area; | 557 work_area_ = work_area; |
558 ComputePopupAlignment(work_area, screen_bounds); | 558 ComputePopupAlignment(work_area, screen_bounds); |
559 RepositionWidgets(); | 559 RepositionWidgets(); |
560 } | 560 } |
561 | 561 |
562 void MessagePopupCollection::OnDisplayBoundsChanged( | |
563 const gfx::Display& display) { | |
564 if (display.id() != display_id_) | |
565 return; | |
566 | |
567 SetDisplayInfo(display.work_area(), display.bounds()); | |
568 } | |
569 | |
570 void MessagePopupCollection::OnDisplayAdded(const gfx::Display& new_display) { | 562 void MessagePopupCollection::OnDisplayAdded(const gfx::Display& new_display) { |
571 } | 563 } |
572 | 564 |
573 void MessagePopupCollection::OnDisplayRemoved(const gfx::Display& old_display) { | 565 void MessagePopupCollection::OnDisplayRemoved(const gfx::Display& old_display) { |
574 if (display_id_ == old_display.id() && !parent_) { | 566 if (display_id_ == old_display.id() && !parent_) { |
575 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 567 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
576 display_id_ = display.id(); | 568 display_id_ = display.id(); |
577 SetDisplayInfo(display.work_area(), display.bounds()); | 569 SetDisplayInfo(display.work_area(), display.bounds()); |
578 } | 570 } |
579 } | 571 } |
580 | 572 |
| 573 void MessagePopupCollection::OnDisplayMetricsChanged( |
| 574 const gfx::Display& display, DisplayObserver::DisplayMetrics metrics) { |
| 575 if (display.id() != display_id_) |
| 576 return; |
| 577 |
| 578 if (metrics & DISPLAY_METRICS_BOUNDS || metrics & DISPLAY_METRICS_WORK_AREA) |
| 579 SetDisplayInfo(display.work_area(), display.bounds()); |
| 580 } |
| 581 |
581 views::Widget* MessagePopupCollection::GetWidgetForTest(const std::string& id) | 582 views::Widget* MessagePopupCollection::GetWidgetForTest(const std::string& id) |
582 const { | 583 const { |
583 for (Toasts::const_iterator iter = toasts_.begin(); iter != toasts_.end(); | 584 for (Toasts::const_iterator iter = toasts_.begin(); iter != toasts_.end(); |
584 ++iter) { | 585 ++iter) { |
585 if ((*iter)->id() == id) | 586 if ((*iter)->id() == id) |
586 return (*iter)->GetWidget(); | 587 return (*iter)->GetWidget(); |
587 } | 588 } |
588 return NULL; | 589 return NULL; |
589 } | 590 } |
590 | 591 |
(...skipping 15 matching lines...) Expand all Loading... |
606 views::Widget* widget = (*iter)->GetWidget(); | 607 views::Widget* widget = (*iter)->GetWidget(); |
607 if (widget) | 608 if (widget) |
608 return widget->GetWindowBoundsInScreen(); | 609 return widget->GetWindowBoundsInScreen(); |
609 break; | 610 break; |
610 } | 611 } |
611 } | 612 } |
612 return gfx::Rect(); | 613 return gfx::Rect(); |
613 } | 614 } |
614 | 615 |
615 } // namespace message_center | 616 } // namespace message_center |
OLD | NEW |