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

Side by Side Diff: extensions/browser/api/system_display/display_info_provider.cc

Issue 2802603005: MD Settings: Display: Add unified desktop control and modify api (Closed)
Patch Set: Fix closure and tests Created 3 years, 8 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
OLDNEW
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 "extensions/browser/api/system_display/display_info_provider.h" 5 #include "extensions/browser/api/system_display/display_info_provider.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "extensions/common/api/system_display.h" 8 #include "extensions/common/api/system_display.h"
9 #include "ui/display/display.h" 9 #include "ui/display/display.h"
10 #include "ui/display/screen.h" 10 #include "ui/display/screen.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 api::system_display::DisplayUnitInfo DisplayInfoProvider::CreateDisplayUnitInfo( 54 api::system_display::DisplayUnitInfo DisplayInfoProvider::CreateDisplayUnitInfo(
55 const display::Display& display, 55 const display::Display& display,
56 int64_t primary_display_id) { 56 int64_t primary_display_id) {
57 api::system_display::DisplayUnitInfo unit; 57 api::system_display::DisplayUnitInfo unit;
58 const gfx::Rect& bounds = display.bounds(); 58 const gfx::Rect& bounds = display.bounds();
59 const gfx::Rect& work_area = display.work_area(); 59 const gfx::Rect& work_area = display.work_area();
60 unit.id = base::Int64ToString(display.id()); 60 unit.id = base::Int64ToString(display.id());
61 unit.is_primary = (display.id() == primary_display_id); 61 unit.is_primary = (display.id() == primary_display_id);
62 unit.is_internal = display.IsInternal(); 62 unit.is_internal = display.IsInternal();
63 unit.is_enabled = true; 63 unit.is_enabled = true;
64 unit.is_unified = false;
64 unit.rotation = RotationToDegrees(display.rotation()); 65 unit.rotation = RotationToDegrees(display.rotation());
65 unit.bounds.left = bounds.x(); 66 unit.bounds.left = bounds.x();
66 unit.bounds.top = bounds.y(); 67 unit.bounds.top = bounds.y();
67 unit.bounds.width = bounds.width(); 68 unit.bounds.width = bounds.width();
68 unit.bounds.height = bounds.height(); 69 unit.bounds.height = bounds.height();
69 unit.work_area.left = work_area.x(); 70 unit.work_area.left = work_area.x();
70 unit.work_area.top = work_area.y(); 71 unit.work_area.top = work_area.y();
71 unit.work_area.width = work_area.width(); 72 unit.work_area.width = work_area.width();
72 unit.work_area.height = work_area.height(); 73 unit.work_area.height = work_area.height();
73 unit.has_touch_support = 74 unit.has_touch_support =
74 display.touch_support() == display::Display::TOUCH_SUPPORT_AVAILABLE; 75 display.touch_support() == display::Display::TOUCH_SUPPORT_AVAILABLE;
75 return unit; 76 return unit;
76 } 77 }
77 78
78 bool DisplayInfoProvider::SetDisplayLayout(const DisplayLayoutList& layout) { 79 bool DisplayInfoProvider::SetDisplayLayout(const DisplayLayoutList& layout) {
79 NOTREACHED(); // Implemented on Chrome OS only in override. 80 NOTREACHED(); // Implemented on Chrome OS only in override.
80 return false; 81 return false;
81 } 82 }
82 83
83 void DisplayInfoProvider::EnableUnifiedDesktop(bool enable) {} 84 void DisplayInfoProvider::EnableUnifiedDesktop(bool enable) {}
84 85
85 DisplayInfoProvider::DisplayUnitInfoList 86 DisplayInfoProvider::DisplayUnitInfoList
86 DisplayInfoProvider::GetAllDisplaysInfo() { 87 DisplayInfoProvider::GetAllDisplaysInfo(bool /* single_unified*/) {
87 display::Screen* screen = display::Screen::GetScreen(); 88 display::Screen* screen = display::Screen::GetScreen();
88 int64_t primary_id = screen->GetPrimaryDisplay().id(); 89 int64_t primary_id = screen->GetPrimaryDisplay().id();
89 std::vector<display::Display> displays = screen->GetAllDisplays(); 90 std::vector<display::Display> displays = screen->GetAllDisplays();
90 DisplayUnitInfoList all_displays; 91 DisplayUnitInfoList all_displays;
91 for (const display::Display& display : displays) { 92 for (const display::Display& display : displays) {
92 api::system_display::DisplayUnitInfo unit = 93 api::system_display::DisplayUnitInfo unit =
93 CreateDisplayUnitInfo(display, primary_id); 94 CreateDisplayUnitInfo(display, primary_id);
94 UpdateDisplayUnitInfoForPlatform(display, &unit); 95 UpdateDisplayUnitInfoForPlatform(display, &unit);
95 all_displays.push_back(std::move(unit)); 96 all_displays.push_back(std::move(unit));
96 } 97 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 151
151 bool DisplayInfoProvider::IsNativeTouchCalibrationActive(std::string* error) { 152 bool DisplayInfoProvider::IsNativeTouchCalibrationActive(std::string* error) {
152 NOTREACHED(); // Implemented on Chrome OS only in override. 153 NOTREACHED(); // Implemented on Chrome OS only in override.
153 return true; 154 return true;
154 } 155 }
155 156
156 DisplayInfoProvider::DisplayInfoProvider() { 157 DisplayInfoProvider::DisplayInfoProvider() {
157 } 158 }
158 159
159 } // namespace extensions 160 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698