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

Unified Diff: content/browser/gpu/gpu_internals_ui.cc

Issue 1563183008: Added capability on Windows to get the physical dimensions of your attached monitors. Also added th… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 11 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/BUILD.gn » ('j') | ui/gfx/display.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/gpu_internals_ui.cc
diff --git a/content/browser/gpu/gpu_internals_ui.cc b/content/browser/gpu/gpu_internals_ui.cc
index e93c9015202ee9fd528180814c4897c98cb52c15..816fce42b80fbda594b79a81bf3213c6e14e96d0 100644
--- a/content/browser/gpu/gpu_internals_ui.cc
+++ b/content/browser/gpu/gpu_internals_ui.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include <sstream>
#include <string>
#include "base/bind.h"
@@ -42,6 +43,7 @@
#endif
#if defined(OS_WIN)
#include "ui/base/win/shell.h"
+#include "ui/gfx/win/physical_size.h"
#endif
#if defined(OS_LINUX) && defined(USE_X11)
@@ -148,6 +150,24 @@ base::DictionaryValue* GpuInfoAsDictionaryValue() {
basic_info->Append(NewDescriptionValuePair("Using WARP",
new base::FundamentalValue(true)));
}
+
+ std::vector<gfx::DisplaySize> display_sizes;
+ gfx::GetPhysicalSizeForDisplays(&display_sizes);
+ for (size_t i = 0; i < display_sizes.size(); ++i) {
robliao 2016/01/11 18:42:20 Could probably use the C++11 foreach here too. for
Bret 2016/01/12 00:23:46 Done.
+ const gfx::DisplaySize& display_size = display_sizes[i];
+ int w = display_size.width_mm;
+ int h = display_size.height_mm;
+ double size_mm = sqrt(w * w + h * h);
+ double size_inches = 0.0393701 * size_mm;
+ double rounded_size_inches = floor(10.0 * size_inches) / 10.0;
+ std::ostringstream size_stream;
scottmg 2016/01/09 01:00:05 I see we've recently changed the style guide to al
Bret 2016/01/12 00:23:46 Done.
+ size_stream << rounded_size_inches << "\"";
+ std::ostringstream description_stream;
+ description_stream << "Diagonal Monitor Size of "
+ << display_size.display_name;
+ basic_info->Append(
+ NewDescriptionValuePair(description_stream.str(), size_stream.str()));
+ }
#endif
std::string disabled_extensions;
« no previous file with comments | « no previous file | ui/gfx/BUILD.gn » ('j') | ui/gfx/display.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698