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

Unified Diff: services/ui/ws/user_display_manager.cc

Issue 2904993003: chromeos: changes how DisplayManagerObservers are notified (Closed)
Patch Set: cleanup Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/ws/user_display_manager.h ('k') | services/ui/ws/user_display_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/user_display_manager.cc
diff --git a/services/ui/ws/user_display_manager.cc b/services/ui/ws/user_display_manager.cc
index b32c5316764e8adc60eaad966dac01ed920aa8fc..f52663fbb4c1d4dc9f0b2ef080fd9e2bfb32a639 100644
--- a/services/ui/ws/user_display_manager.cc
+++ b/services/ui/ws/user_display_manager.cc
@@ -33,6 +33,18 @@ UserDisplayManager::UserDisplayManager(UserDisplayManagerDelegate* delegate,
UserDisplayManager::~UserDisplayManager() {}
+void UserDisplayManager::DisableAutomaticNotification() {
+ DCHECK(notify_automatically_);
+ notify_automatically_ = false;
+}
+
+void UserDisplayManager::CallOnDisplaysChanged() {
+ display_manager_observers_.ForAllPtrs(
+ [this](mojom::DisplayManagerObserver* observer) {
+ CallOnDisplaysChanged(observer);
+ });
+}
+
void UserDisplayManager::OnFrameDecorationValuesChanged() {
got_valid_frame_decorations_ = true;
CallOnDisplaysChangedIfNecessary();
@@ -100,13 +112,10 @@ bool UserDisplayManager::ShouldCallOnDisplaysChanged() const {
}
void UserDisplayManager::CallOnDisplaysChangedIfNecessary() {
- if (!ShouldCallOnDisplaysChanged())
+ if (!notify_automatically_ || !ShouldCallOnDisplaysChanged())
return;
- display_manager_observers_.ForAllPtrs(
- [this](mojom::DisplayManagerObserver* observer) {
- CallOnDisplaysChanged(observer);
- });
+ CallOnDisplaysChanged();
}
void UserDisplayManager::CallOnDisplaysChanged(
« no previous file with comments | « services/ui/ws/user_display_manager.h ('k') | services/ui/ws/user_display_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698