OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/api/system_display/display_info_provider.h" | 5 #include "chrome/browser/extensions/api/system_display/display_info_provider.h" |
6 | 6 |
| 7 #include <gdk/gdk.h> |
| 8 |
| 9 #include "ui/gfx/display.h" |
| 10 #include "ui/gfx/screen.h" |
| 11 |
7 namespace extensions { | 12 namespace extensions { |
8 | 13 |
9 void DisplayInfoProvider::SetInfo( | 14 void DisplayInfoProvider::SetInfo( |
10 const std::string& display_id, | 15 const std::string& display_id, |
11 const api::system_display::DisplayProperties& info, | 16 const api::system_display::DisplayProperties& info, |
12 const SetInfoCallback& callback) { | 17 const SetInfoCallback& callback) { |
13 base::MessageLoopProxy::current()->PostTask( | 18 base::MessageLoopProxy::current()->PostTask( |
14 FROM_HERE, | 19 FROM_HERE, |
15 base::Bind(callback, false, "Not implemented")); | 20 base::Bind(callback, false, "Not implemented")); |
16 } | 21 } |
17 | 22 |
18 void DisplayInfoProvider::UpdateDisplayUnitInfoForPlatform( | 23 void DisplayInfoProvider::UpdateDisplayUnitInfoForPlatform( |
19 const gfx::Display& display, | 24 const gfx::Display& display, |
20 extensions::api::system_display::DisplayUnitInfo* unit) { | 25 extensions::api::system_display::DisplayUnitInfo* unit) { |
21 NOTIMPLEMENTED(); | 26 // TODO(Haojian): determine the DPI of the display |
| 27 GdkScreen* screen = gdk_screen_get_default(); |
| 28 // The |id| in Display for GTK is the monitor index. |
| 29 gint monitor_num = static_cast<gint>(display.id()); |
| 30 char* monitor_name = reinterpret_cast<char*>(gdk_screen_get_monitor_plug_name( |
| 31 screen, monitor_num)); |
| 32 unit->name = std::string(monitor_name); |
22 } | 33 } |
23 | 34 |
24 } // namespace extensions | 35 } // namespace extensions |
OLD | NEW |