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.
5 #include "chrome/browser/extensions/api/system_display/system_display_api.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_number_conversions.h"
11 #include "chrome/browser/extensions/api/system_display/display_info_provider.h"
12 #include "chrome/common/extensions/api/system_display.h"
13 #include "chrome/common/extensions/manifest_handlers/kiosk_mode_info.h"
14 #include "ui/gfx/display.h"
15 #include "ui/gfx/screen.h"
17 namespace extensions {
19 using api::system_display::DisplayUnitInfo;
21 namespace SetDisplayProperties = api::system_display::SetDisplayProperties;
23 typedef std::vector<linked_ptr<
24 api::system_display::DisplayUnitInfo> > DisplayInfo;
26 bool SystemDisplayGetInfoFunction::RunImpl() {
27 DisplayInfo all_displays_info =
28 DisplayInfoProvider::Get()->GetAllDisplaysInfo();
29 results_ = api::system_display::GetInfo::Results::Create(all_displays_info);
33 bool SystemDisplaySetDisplayPropertiesFunction::RunImpl() {
34 #if !defined(OS_CHROMEOS)
35 SetError("Function available only on ChromeOS.");
38 if (!KioskModeInfo::IsKioskEnabled(GetExtension())) {
39 SetError("The extension needs to be kiosk enabled to use the function.");
43 scoped_ptr<SetDisplayProperties::Params> params(
44 SetDisplayProperties::Params::Create(*args_));
45 bool success = DisplayInfoProvider::Get()->SetInfo(params->id,
54 } // namespace extensions