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

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: fix 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
« no previous file with comments | « ash/system/chromeos/tray_display.h ('k') | ash/system/chromeos/tray_display_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1f81f77670c2b6e9577bbca69f9237943e332e65 100644
--- a/ash/system/chromeos/tray_display.cc
+++ b/ash/system/chromeos/tray_display.cc
@@ -326,21 +326,28 @@ 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->swap(display_info_);
+ display_info_.clear();
+
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) {
// 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 +412,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);
}
« no previous file with comments | « ash/system/chromeos/tray_display.h ('k') | ash/system/chromeos/tray_display_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698