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

Unified Diff: ash/display/display_manager.cc

Issue 11411291: Fixes wrong logic for display names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_manager.cc
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index cda6ffce840bb1333b21d88f30ec3df200365c66..6b1dbbed784284e556ef61b969a1c320bfa89661 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -390,7 +390,7 @@ std::string DisplayManager::GetDisplayNameFor(
std::map<int64, DisplayInfo>::const_iterator iter =
display_info_.find(display.id());
- if (iter != display_info_.end())
+ if (iter != display_info_.end() && !iter->second.name.empty())
return iter->second.name;
return base::StringPrintf("Display %d", static_cast<int>(display.id()));
@@ -558,15 +558,16 @@ void DisplayManager::RefreshDisplayNames() {
uint16 manufacturer_id = 0;
uint32 serial_number = 0;
std::string name;
- if (ui::GetOutputDeviceData(
- outputs[i], &manufacturer_id, &serial_number, &name)) {
- int64 id = gfx::Display::GetID(manufacturer_id, serial_number);
- if (IsInternalDisplayId(id)) {
- display_info_[id].name =
- l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME);
- } else {
- display_info_[id].name = name;
- }
+ ui::GetOutputDeviceData(
+ outputs[i], &manufacturer_id, &serial_number, &name);
+ if (manufacturer_id == 0 && serial_number == 0)
+ continue;
oshima 2012/11/30 20:28:59 so we don't have to create the entry for all outpu
Jun Mukai 2012/11/30 20:46:28 Good point. Removed this if. Sometimes the device
+ int64 id = gfx::Display::GetID(manufacturer_id, serial_number);
+ if (IsInternalDisplayId(id)) {
+ display_info_[id].name =
+ l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME);
+ } else if (!name.empty()) {
+ display_info_[id].name = name;
}
}
#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698