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/active_tab_permission_granter_deleg ate_chromeos.h" | |
6 | |
7 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol icy_provider.h" | |
8 #include "chrome/browser/chromeos/extensions/public_session_permission_helper.h" | |
9 #include "chrome/browser/profiles/profiles_state.h" | |
10 #include "extensions/common/extension.h" | |
11 #include "extensions/common/permissions/api_permission.h" | |
12 | |
13 namespace extensions { | |
14 | |
15 ActiveTabPermissionGranterDelegateChromeOS:: | |
16 ActiveTabPermissionGranterDelegateChromeOS() {} | |
17 | |
18 ActiveTabPermissionGranterDelegateChromeOS:: | |
19 ~ActiveTabPermissionGranterDelegateChromeOS() {} | |
20 | |
21 bool ActiveTabPermissionGranterDelegateChromeOS::ActiveTabPermissionGranted( | |
22 const Extension* extension, | |
23 content::WebContents* web_contents) { | |
24 if (!profiles::IsPublicSession() || | |
Devlin
2017/05/12 14:56:45
Do we set the delegate if it's not a public sessio
Ivan Šandrk
2017/05/12 18:27:44
Nope. I guess I'm the kind of person that likes re
Devlin
2017/05/15 20:51:12
We should be careful with redundancy when it means
| |
25 chromeos::DeviceLocalAccountManagementPolicyProvider::IsWhitelisted( | |
Devlin
2017/05/12 14:56:45
Would it make sense to put this check in the permi
Ivan Šandrk
2017/05/12 18:27:44
Whitelisted extensions should have unlimited acces
| |
26 extension->id())) { | |
27 return true; | |
28 } | |
29 | |
30 bool already_handled = permission_helper::HandlePermissionRequest( | |
31 *extension, {APIPermission::kActiveTab}, web_contents, | |
32 permission_helper::RequestResolvedCallback(), | |
33 permission_helper::PromptFactory()); | |
34 | |
35 if (already_handled) { | |
36 return permission_helper::PermissionAllowed( | |
37 extension, APIPermission::kActiveTab); | |
38 } | |
39 | |
40 return false; | |
41 } | |
42 | |
43 } // namespace extensions | |
OLD | NEW |