| 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 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_PUBLIC_SESSION_PERMISSION_HELPER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_PUBLIC_SESSION_PERMISSION_HELPER_H_ |
| 7 |
| 8 #include <set> |
| 9 |
| 10 #include "base/callback_forward.h" |
| 11 #include "extensions/common/permissions/api_permission.h" |
| 12 #include "extensions/common/permissions/api_permission_set.h" |
| 13 |
| 14 namespace content { |
| 15 class WebContents; |
| 16 } |
| 17 |
| 18 namespace extensions { |
| 19 |
| 20 class Extension; |
| 21 |
| 22 namespace permission_helper { |
| 23 |
| 24 using RequestResolvedCallback = base::Callback<void(PermissionIDSet)>; |
| 25 |
| 26 // In Public Sessions, extensions (and apps) are force-installed by admin policy |
| 27 // so the user does not get a chance to review the permissions for these |
| 28 // extensions. This is not acceptable from a security/privacy standpoint, so |
| 29 // when an extension uses one of the sensitive APIs for the first time, we show |
| 30 // the user a dialog where they can choose whether to allow the extension access |
| 31 // to the API. |
| 32 // |
| 33 // This function sets up the prompt asking the user for additional |
| 34 // permission(s), handles the result, caches it, and then runs the callback with |
| 35 // the allowed permissions as the argument. |
| 36 // |
| 37 // The user will be prompted about a certain permission only once, and that |
| 38 // choice will be cached and used in any subsequent requests that use the same |
| 39 // permission. If a request comes for a permission that is currently being |
| 40 // prompted, its callback will be queued up to be invoked when the prompt is |
| 41 // resolved. |
| 42 // |
| 43 // Caller must ensure that web_contents is valid. Must be called on UI thread. |
| 44 void HandlePermissionRequest(const Extension& extension, |
| 45 PermissionIDSet requested_permissions, |
| 46 content::WebContents* web_contents, |
| 47 const RequestResolvedCallback& callback); |
| 48 |
| 49 } // namespace permission_helper |
| 50 } // namespace extensions |
| 51 |
| 52 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_PUBLIC_SESSION_PERMISSION_HELPER_H
_ |
| OLD | NEW |