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 "extensions/browser/api/system_display/system_display_api.h" | 5 #include "extensions/browser/api/system_display/system_display_api.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
17 #include "extensions/browser/api/system_display/display_info_provider.h" | 17 #include "extensions/browser/api/system_display/display_info_provider.h" |
18 #include "extensions/common/api/system_display.h" | 18 #include "extensions/common/api/system_display.h" |
19 #include "extensions/common/permissions/permissions_data.h" | |
19 | 20 |
20 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
21 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" | 22 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" |
22 #endif | 23 #endif |
23 | 24 |
24 namespace extensions { | 25 namespace extensions { |
25 | 26 |
26 namespace display = api::system_display; | 27 namespace display = api::system_display; |
27 | 28 |
28 const char SystemDisplayFunction::kCrosOnlyError[] = | 29 const char SystemDisplayFunction::kCrosOnlyError[] = |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 if (source_context_type() == Feature::WEBUI_CONTEXT) | 169 if (source_context_type() == Feature::WEBUI_CONTEXT) |
169 return true; | 170 return true; |
170 if (KioskModeInfo::IsKioskEnabled(extension())) | 171 if (KioskModeInfo::IsKioskEnabled(extension())) |
171 return true; | 172 return true; |
172 *error = kKioskOnlyError; | 173 *error = kKioskOnlyError; |
173 return false; | 174 return false; |
174 #endif | 175 #endif |
175 } | 176 } |
176 | 177 |
177 bool SystemDisplayFunction::ShouldRestrictToKioskAndWebUI() { | 178 bool SystemDisplayFunction::ShouldRestrictToKioskAndWebUI() { |
179 // Allow autotest extension to access for Chrome OS testing. | |
180 if (extension()->permissions_data()->HasAPIPermission( | |
stevenjb
2017/05/10 16:15:08
Ugh, I should have noticed that this needs to be i
| |
181 APIPermission::kAutoTestPrivate)) { | |
182 return false; | |
183 } | |
178 return true; | 184 return true; |
179 } | 185 } |
180 | 186 |
181 ExtensionFunction::ResponseAction SystemDisplayGetInfoFunction::Run() { | 187 ExtensionFunction::ResponseAction SystemDisplayGetInfoFunction::Run() { |
182 std::unique_ptr<display::GetInfo::Params> params( | 188 std::unique_ptr<display::GetInfo::Params> params( |
183 display::GetInfo::Params::Create(*args_)); | 189 display::GetInfo::Params::Create(*args_)); |
184 bool single_unified = params->flags && params->flags->single_unified && | 190 bool single_unified = params->flags && params->flags->single_unified && |
185 *params->flags->single_unified; | 191 *params->flags->single_unified; |
186 DisplayInfoProvider::DisplayUnitInfoList all_displays_info = | 192 DisplayInfoProvider::DisplayUnitInfoList all_displays_info = |
187 DisplayInfoProvider::Get()->GetAllDisplaysInfo(single_unified); | 193 DisplayInfoProvider::Get()->GetAllDisplaysInfo(single_unified); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 std::string error; | 346 std::string error; |
341 if (DisplayInfoProvider::Get()->IsNativeTouchCalibrationActive(&error)) | 347 if (DisplayInfoProvider::Get()->IsNativeTouchCalibrationActive(&error)) |
342 return RespondNow(Error(error)); | 348 return RespondNow(Error(error)); |
343 | 349 |
344 if (!DisplayInfoProvider::Get()->ClearTouchCalibration(params->id, &error)) | 350 if (!DisplayInfoProvider::Get()->ClearTouchCalibration(params->id, &error)) |
345 return RespondNow(Error(error)); | 351 return RespondNow(Error(error)); |
346 return RespondNow(NoArguments()); | 352 return RespondNow(NoArguments()); |
347 } | 353 } |
348 | 354 |
349 } // namespace extensions | 355 } // namespace extensions |
OLD | NEW |