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