| 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" | |
| 20 | 19 |
| 21 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
| 22 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" | 21 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" |
| 23 #endif | 22 #endif |
| 24 | 23 |
| 25 namespace extensions { | 24 namespace extensions { |
| 26 | 25 |
| 27 namespace display = api::system_display; | 26 namespace display = api::system_display; |
| 28 | 27 |
| 29 const char SystemDisplayFunction::kCrosOnlyError[] = | 28 const char SystemDisplayFunction::kCrosOnlyError[] = |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 if (source_context_type() == Feature::WEBUI_CONTEXT) | 168 if (source_context_type() == Feature::WEBUI_CONTEXT) |
| 170 return true; | 169 return true; |
| 171 if (KioskModeInfo::IsKioskEnabled(extension())) | 170 if (KioskModeInfo::IsKioskEnabled(extension())) |
| 172 return true; | 171 return true; |
| 173 *error = kKioskOnlyError; | 172 *error = kKioskOnlyError; |
| 174 return false; | 173 return false; |
| 175 #endif | 174 #endif |
| 176 } | 175 } |
| 177 | 176 |
| 178 bool SystemDisplayFunction::ShouldRestrictToKioskAndWebUI() { | 177 bool SystemDisplayFunction::ShouldRestrictToKioskAndWebUI() { |
| 179 // Allow autotest extension to access for Chrome OS testing. | |
| 180 if (extension()->permissions_data()->HasAPIPermission( | |
| 181 APIPermission::kAutoTestPrivate)) { | |
| 182 return false; | |
| 183 } | |
| 184 return true; | 178 return true; |
| 185 } | 179 } |
| 186 | 180 |
| 187 ExtensionFunction::ResponseAction SystemDisplayGetInfoFunction::Run() { | 181 ExtensionFunction::ResponseAction SystemDisplayGetInfoFunction::Run() { |
| 188 std::unique_ptr<display::GetInfo::Params> params( | 182 std::unique_ptr<display::GetInfo::Params> params( |
| 189 display::GetInfo::Params::Create(*args_)); | 183 display::GetInfo::Params::Create(*args_)); |
| 190 bool single_unified = params->flags && params->flags->single_unified && | 184 bool single_unified = params->flags && params->flags->single_unified && |
| 191 *params->flags->single_unified; | 185 *params->flags->single_unified; |
| 192 DisplayInfoProvider::DisplayUnitInfoList all_displays_info = | 186 DisplayInfoProvider::DisplayUnitInfoList all_displays_info = |
| 193 DisplayInfoProvider::Get()->GetAllDisplaysInfo(single_unified); | 187 DisplayInfoProvider::Get()->GetAllDisplaysInfo(single_unified); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 std::string error; | 340 std::string error; |
| 347 if (DisplayInfoProvider::Get()->IsNativeTouchCalibrationActive(&error)) | 341 if (DisplayInfoProvider::Get()->IsNativeTouchCalibrationActive(&error)) |
| 348 return RespondNow(Error(error)); | 342 return RespondNow(Error(error)); |
| 349 | 343 |
| 350 if (!DisplayInfoProvider::Get()->ClearTouchCalibration(params->id, &error)) | 344 if (!DisplayInfoProvider::Get()->ClearTouchCalibration(params->id, &error)) |
| 351 return RespondNow(Error(error)); | 345 return RespondNow(Error(error)); |
| 352 return RespondNow(NoArguments()); | 346 return RespondNow(NoArguments()); |
| 353 } | 347 } |
| 354 | 348 |
| 355 } // namespace extensions | 349 } // namespace extensions |
| OLD | NEW |