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_ACTIVE_TAB_PERMISSION_GRANTER_DELEGATE_CHROMEOS_H_ 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_ACTIVE_TAB_PERMISSION_GRANTER_DELEGATE_CHROMEOS_H_ 7 8 #include "base/macros.h" 9 #include "chrome/browser/chromeos/extensions/public_session_permission_helper.h" 10 #include "chrome/browser/extensions/active_tab_permission_granter.h" 11 12 namespace content { 13 class WebContents; 14 } 15 16 namespace extensions { 17 class Extension; 18 19 // In Public Sessions, apps and extensions are force-installed by admin policy 20 // so the user does not get a chance to review the permissions for these apps. 21 // This is not acceptable from a security standpoint, so we show a permission 22 // prompt the first time an extension tries to use activeTab permission (unless 23 // the extension is whitelisted). 24 class ActiveTabPermissionGranterDelegateChromeOS 25 : public ActiveTabPermissionGranter::Delegate { 26 public: 27 ActiveTabPermissionGranterDelegateChromeOS(); 28 ~ActiveTabPermissionGranterDelegateChromeOS() override; 29 30 static void SetRequestResolvedCallbackForTesting( 31 permission_helper::RequestResolvedCallback* callback); 32 33 // ActiveTabPermissionGranter::Delegate 34 bool ShouldGrantActiveTabOrPrompt( 35 const Extension* extension, 36 content::WebContents* web_contents) override; 37 38 private: 39 DISALLOW_COPY_AND_ASSIGN(ActiveTabPermissionGranterDelegateChromeOS); 40 }; 41 42 } // namespace extensions 43 44 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_ACTIVE_TAB_PERMISSION_GRANTER_DELEGATE_CHROMEOS_H_ 45