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

Unified Diff: ash/system/chromeos/tray_display.cc

Issue 22908004: Updates the list of display info in TrayDisplay even if notification is prevented. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
Index: ash/system/chromeos/tray_display.cc
diff --git a/ash/system/chromeos/tray_display.cc b/ash/system/chromeos/tray_display.cc
index ebafa37158f4c88df647ca5fbf3b7ef3507ba0fa..f8f25f0783b0c6d01ae0d39ccb8f39a140375f97 100644
--- a/ash/system/chromeos/tray_display.cc
+++ b/ash/system/chromeos/tray_display.cc
@@ -326,21 +326,30 @@ TrayDisplay::TrayDisplay(SystemTray* system_tray)
: SystemTrayItem(system_tray),
default_(NULL) {
Shell::GetInstance()->display_controller()->AddObserver(this);
+ UpdateDisplayInfo(NULL);
}
TrayDisplay::~TrayDisplay() {
Shell::GetInstance()->display_controller()->RemoveObserver(this);
}
-bool TrayDisplay::GetDisplayMessageForNotification(base::string16* message) {
+void TrayDisplay::UpdateDisplayInfo(TrayDisplay::DisplayInfoMap* old_info) {
+ if (old_info) {
+ old_info->clear();
+ old_info->swap(display_info_);
+ } else {
+ display_info_.clear();
+ }
stevenjb 2013/08/12 21:52:07 Isn't this the same as: if (old_info) old_info-
Jun Mukai 2013/08/12 22:07:49 good catch. fixed as you suggested.
+
DisplayManager* display_manager = GetDisplayManager();
- DisplayInfoMap old_info;
- old_info.swap(display_info_);
for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) {
int64 id = display_manager->GetDisplayAt(i).id();
display_info_[id] = display_manager->GetDisplayInfo(id);
}
+}
+bool TrayDisplay::GetDisplayMessageForNotification(
+ base::string16* message, const TrayDisplay::DisplayInfoMap& old_info) {
stevenjb 2013/08/12 21:52:07 one arg per line
Jun Mukai 2013/08/12 22:07:49 Done.
// Display is added or removed. Use the same message as the one in
// the system tray.
if (display_info_.size() != old_info.size()) {
@@ -405,13 +414,16 @@ void TrayDisplay::DestroyDefaultView() {
}
void TrayDisplay::OnDisplayConfigurationChanged() {
+ DisplayInfoMap old_info;
+ UpdateDisplayInfo(&old_info);
+
if (!Shell::GetInstance()->system_tray_delegate()->
ShouldShowDisplayNotification()) {
return;
}
base::string16 message;
- if (GetDisplayMessageForNotification(&message))
+ if (GetDisplayMessageForNotification(&message, old_info))
UpdateDisplayNotification(message);
}

Powered by Google App Engine
This is Rietveld 408576698