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

Unified Diff: chrome/browser/extensions/api/system_display/display_info_provider_linux.cc

Issue 22891026: [SystemInfo API] Implement DisplayInfoProvider::UpdateDisplayUnitInfoForPlatform for Linux GTK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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: chrome/browser/extensions/api/system_display/display_info_provider_linux.cc
diff --git a/chrome/browser/extensions/api/system_display/display_info_provider_x11.cc b/chrome/browser/extensions/api/system_display/display_info_provider_linux.cc
similarity index 58%
rename from chrome/browser/extensions/api/system_display/display_info_provider_x11.cc
rename to chrome/browser/extensions/api/system_display/display_info_provider_linux.cc
index 3776bf90bb496b07dfd5eb437a4dd5d98c7bfa41..f3b17ade0b43bebe8f50716d3dbb9c8bf4d0c208 100644
--- a/chrome/browser/extensions/api/system_display/display_info_provider_x11.cc
+++ b/chrome/browser/extensions/api/system_display/display_info_provider_linux.cc
@@ -4,6 +4,11 @@
#include "chrome/browser/extensions/api/system_display/display_info_provider.h"
Haojian Wu 2013/09/02 09:08:12 Refer to the linux_aura buildbot error stdio log,
oshima 2013/09/03 17:14:05 this should be renamed to dispaly_info_provider_gt
Haojian Wu 2013/09/04 15:02:56 Done.
+#include <gdk/gdk.h>
+
+#include "ui/gfx/display.h"
+#include "ui/gfx/screen.h"
+
namespace extensions {
void DisplayInfoProvider::SetInfo(
@@ -12,13 +17,19 @@ void DisplayInfoProvider::SetInfo(
const SetInfoCallback& callback) {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
- base::Bind(callback, false, "Not implemented"));
+ base::Bind(callback, false, "234 implemented"));
Hongbo Min 2013/09/04 01:46:04 what is the '234' meaning here?
Haojian Wu 2013/09/04 15:02:56 Just a typo error. Done.
}
void DisplayInfoProvider::UpdateDisplayUnitInfoForPlatform(
const gfx::Display& display,
extensions::api::system_display::DisplayUnitInfo* unit) {
- NOTIMPLEMENTED();
+ // TODO(Haojian): determine the DPI of the display
+ GdkScreen* screen = gdk_screen_get_default();
+ // The |id| in Display for GTK is the monitor index.
+ gint monitor_num = static_cast<gint>(display.id());
+ char* monitor_name = reinterpret_cast<char*>(gdk_screen_get_monitor_plug_name(
+ screen, monitor_num));
+ unit->name = std::string(monitor_name);
}
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698