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

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

Issue 259253002: Add OnDisplayMetricsChanged in DisplayObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_orientation
Patch Set: Created 6 years, 7 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
OLDNEW
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
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
572 void MessagePopupCollection::OnDisplayAdded(const gfx::Display& new_display) { 564 void MessagePopupCollection::OnDisplayAdded(const gfx::Display& new_display) {
573 } 565 }
574 566
575 void MessagePopupCollection::OnDisplayRemoved(const gfx::Display& old_display) { 567 void MessagePopupCollection::OnDisplayRemoved(const gfx::Display& old_display) {
576 if (display_id_ == old_display.id() && !parent_) { 568 if (display_id_ == old_display.id() && !parent_) {
577 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); 569 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
578 display_id_ = display.id(); 570 display_id_ = display.id();
579 SetDisplayInfo(display.work_area(), display.bounds()); 571 SetDisplayInfo(display.work_area(), display.bounds());
580 } 572 }
581 } 573 }
582 574
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
583 views::Widget* MessagePopupCollection::GetWidgetForTest(const std::string& id) 584 views::Widget* MessagePopupCollection::GetWidgetForTest(const std::string& id)
584 const { 585 const {
585 for (Toasts::const_iterator iter = toasts_.begin(); iter != toasts_.end(); 586 for (Toasts::const_iterator iter = toasts_.begin(); iter != toasts_.end();
586 ++iter) { 587 ++iter) {
587 if ((*iter)->id() == id) 588 if ((*iter)->id() == id)
588 return (*iter)->GetWidget(); 589 return (*iter)->GetWidget();
589 } 590 }
590 return NULL; 591 return NULL;
591 } 592 }
592 593
(...skipping 15 matching lines...) Expand all
608 views::Widget* widget = (*iter)->GetWidget(); 609 views::Widget* widget = (*iter)->GetWidget();
609 if (widget) 610 if (widget)
610 return widget->GetWindowBoundsInScreen(); 611 return widget->GetWindowBoundsInScreen();
611 break; 612 break;
612 } 613 }
613 } 614 }
614 return gfx::Rect(); 615 return gfx::Rect();
615 } 616 }
616 617
617 } // namespace message_center 618 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/message_popup_collection.h ('k') | ui/message_center/views/toast_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698