Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / api / system_display / display_info_provider_gtk.cc
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/api/system_display/display_info_provider.h"
6
7 #include <gdk/gdk.h>
8
9 #include "ui/gfx/display.h"
10 #include "ui/gfx/screen.h"
11
12 namespace extensions {
13
14 bool DisplayInfoProvider::SetInfo(const std::string& display_id,
15     const api::system_display::DisplayProperties& info,
16     std::string* error) {
17   *error = "Not Implemented";
18   return false;
19 }
20
21 void DisplayInfoProvider::UpdateDisplayUnitInfoForPlatform(
22     const gfx::Display& display,
23     extensions::api::system_display::DisplayUnitInfo* unit) {
24   // TODO(Haojian): determine the DPI of the display
25   GdkScreen* screen = gdk_screen_get_default();
26   // The |id| in Display for GTK is the monitor index.
27   gint monitor_num = static_cast<gint>(display.id());
28   char* monitor_name = reinterpret_cast<char*>(gdk_screen_get_monitor_plug_name(
29        screen, monitor_num));
30   if (monitor_name)
31     unit->name = std::string(monitor_name);
32 }
33
34 }  // namespace extensions