1 // Copyright 2015 The Chromium Embedded Framework Authors. 2 // Portions copyright 2014 The Chromium Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 6 #ifndef CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_CLIENT_H_ 7 #define CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_CLIENT_H_ 8 9 #include "base/compiler_specific.h" 10 #include "chrome/common/extensions/permissions/chrome_permission_message_provider.h" 11 #include "extensions/common/extensions_client.h" 12 #include "url/gurl.h" 13 14 namespace extensions { 15 16 // The CEF implementation of ExtensionsClient. 17 class CefExtensionsClient : public ExtensionsClient { 18 public: 19 CefExtensionsClient(); 20 21 CefExtensionsClient(const CefExtensionsClient&) = delete; 22 CefExtensionsClient& operator=(const CefExtensionsClient&) = delete; 23 24 ~CefExtensionsClient() override; 25 26 // ExtensionsClient overrides: 27 void Initialize() override; 28 void InitializeWebStoreUrls(base::CommandLine* command_line) override; 29 const PermissionMessageProvider& GetPermissionMessageProvider() 30 const override; 31 const std::string GetProductName() override; 32 void FilterHostPermissions(const URLPatternSet& hosts, 33 URLPatternSet* new_hosts, 34 PermissionIDSet* permissions) const override; 35 void SetScriptingAllowlist(const ScriptingAllowlist& allowlist) override; 36 const ScriptingAllowlist& GetScriptingAllowlist() const override; 37 URLPatternSet GetPermittedChromeSchemeHosts( 38 const Extension* extension, 39 const APIPermissionSet& api_permissions) const override; 40 bool IsScriptableURL(const GURL& url, std::string* error) const override; 41 const GURL& GetWebstoreBaseURL() const override; 42 const GURL& GetWebstoreUpdateURL() const override; 43 bool IsBlocklistUpdateURL(const GURL& url) const override; 44 45 private: 46 const ChromePermissionMessageProvider permission_message_provider_; 47 48 ScriptingAllowlist scripting_allowlist_; 49 50 // Mutable to allow caching in a const method. 51 const GURL webstore_base_url_; 52 const GURL webstore_update_url_; 53 }; 54 55 } // namespace extensions 56 57 #endif // CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_CLIENT_H_ 58