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

Unified Diff: ash/display/display_change_observer_x11.cc

Issue 15830003: Manual Merge 201756 "Changes how to compute the id of a display." (2nd) (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1500/src/
Patch Set: Created 7 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 | « no previous file | ui/gfx/display.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_change_observer_x11.cc
===================================================================
--- ash/display/display_change_observer_x11.cc (revision 202214)
+++ ash/display/display_change_observer_x11.cc (working copy)
@@ -15,6 +15,7 @@
#include "ash/display/display_info.h"
#include "ash/display/display_manager.h"
#include "ash/shell.h"
+#include "base/hash.h"
#include "base/message_pump_aurax11.h"
#include "grit/ash_strings.h"
#include "ui/base/l10n/l10n_util.h"
@@ -84,13 +85,20 @@
int64 GetDisplayId(XID output_id, int output_index) {
uint16 manufacturer_id = 0;
- uint16 product_code = 0;
- if (ui::GetOutputDeviceData(
- output_id, &manufacturer_id, &product_code, NULL) &&
- manufacturer_id != 0) {
+ std::string product_name;
+
+ // ui::GetOutputDeviceData fails if it doesn't have product_name.
+ ui::GetOutputDeviceData(output_id, &manufacturer_id, NULL, &product_name);
+
+ // Generates product specific value from product_name instead of product code.
+ // See crbug.com/240341
+ uint32 product_code_hash = product_name.empty() ?
+ 0 : base::Hash(product_name);
+ if (manufacturer_id != 0) {
// An ID based on display's index will be assigned later if this call
// fails.
- return gfx::Display::GetID(manufacturer_id, product_code, output_index);
+ return gfx::Display::GetID(
+ manufacturer_id, product_code_hash, output_index);
}
return gfx::Display::kInvalidDisplayID;
}
« no previous file with comments | « no previous file | ui/gfx/display.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698