| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #include "chrome/browser/chromeos/extensions/permissions_updater_delegate_chrome
os.h" |
| 6 |
| 7 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol
icy_provider.h" |
| 8 #include "chrome/browser/profiles/profiles_state.h" |
| 9 #include "extensions/common/permissions/api_permission.h" |
| 10 #include "extensions/common/permissions/api_permission_set.h" |
| 11 #include "extensions/common/permissions/manifest_permission_set.h" |
| 12 #include "extensions/common/permissions/permission_set.h" |
| 13 #include "extensions/common/url_pattern_set.h" |
| 14 |
| 15 namespace extensions { |
| 16 |
| 17 PermissionsUpdaterDelegateChromeOS::PermissionsUpdaterDelegateChromeOS() {} |
| 18 |
| 19 PermissionsUpdaterDelegateChromeOS::~PermissionsUpdaterDelegateChromeOS() {} |
| 20 |
| 21 void PermissionsUpdaterDelegateChromeOS::InitializePermissions( |
| 22 const Extension* extension, |
| 23 std::unique_ptr<const PermissionSet>* granted_permissions) { |
| 24 if (!profiles::IsPublicSession() || |
| 25 chromeos::DeviceLocalAccountManagementPolicyProvider::IsWhitelisted( |
| 26 extension) || |
| 27 !(*granted_permissions) |
| 28 ->HasAPIPermission(APIPermission::kClipboardRead)) { |
| 29 return; |
| 30 } |
| 31 // Revoke kClipboardRead permission (used in Public Sessions to secure |
| 32 // clipboard read functionality). This forceful removal of permission is safe |
| 33 // since the clipboard pasting code checks for this permission before doing |
| 34 // the paste (the end result is just an empty paste). |
| 35 APIPermissionSet api_permission_set((*granted_permissions)->apis()); |
| 36 api_permission_set.erase(APIPermission::kClipboardRead); |
| 37 granted_permissions->reset( |
| 38 new PermissionSet(api_permission_set, ManifestPermissionSet(), |
| 39 URLPatternSet(), URLPatternSet())); |
| 40 } |
| 41 |
| 42 } // namespace extensions |
| OLD | NEW |