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

Side by Side Diff: chrome/browser/extensions/api/system_info_display/display_info_provider_chromeos.cc

Issue 11882009: Multi-monitor extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Leave a TODO for the hard-coded DPI value. Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
oshima 2013/01/25 17:28:41 2013
hshi1 2013/01/25 18:42:29 Done.
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_info_display/display_info_provide r.h"
6
7 #include "ash/display/display_manager.h"
8 #include "ash/shell.h"
9 #include "base/string_number_conversions.h"
10 #include "ui/gfx/display.h"
11 #include "ui/gfx/rect.h"
12
13 using ash::internal::DisplayManager;
14
15 namespace extensions {
16
17 namespace {
18 // TODO(hshi): determine the DPI of the screen.
19 const float kDpi96 = 96.0;
oshima 2013/01/25 17:28:41 no indent
hshi1 2013/01/25 18:42:29 Done.
20 } // namespace
21
22 using api::system_info_display::Bounds;
23 using api::system_info_display::DisplayUnitInfo;
24
25 bool DisplayInfoProvider::QueryInfo(DisplayInfo* info) {
26 DCHECK(info);
27 info->clear();
28
29 DisplayManager* display_manager =
30 ash::Shell::GetInstance()->display_manager();
31 DCHECK(display_manager);
32
33 int64 primary_id = ash::Shell::GetScreen()->GetPrimaryDisplay().id();
34 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) {
35 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo());
36 const gfx::Display* display = display_manager->GetDisplayAt(i);
37 const gfx::Rect& bounds = display->bounds();
38 unit->id = base::Int64ToString(display->id());
39 unit->name = display_manager->GetDisplayNameFor(*display);
40 unit->is_primary = (display->id() == primary_id);
41 unit->is_internal = display_manager->IsInternalDisplayId(display->id());
42 unit->is_enabled = true;
43 unit->dpi_x = kDpi96;
44 unit->dpi_y = kDpi96;
45 unit->bounds.left = bounds.x();
46 unit->bounds.top = bounds.y();
47 unit->bounds.width = bounds.width();
48 unit->bounds.height = bounds.height();
49 info->push_back(unit);
50 }
51
52 return true;
53 }
54
55 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698