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 "base/macros.h" 11 #include "chrome/common/extensions/permissions/chrome_permission_message_provider.h" 12 #include "extensions/common/extensions_client.h" 13 #include "url/gurl.h" 14 15 namespace extensions { 16 17 // The CEF implementation of ExtensionsClient. 18 class CefExtensionsClient : public ExtensionsClient { 19 public: 20 CefExtensionsClient(); 21 ~CefExtensionsClient() override; 22 23 // ExtensionsClient overrides: 24 void Initialize() override; 25 void InitializeWebStoreUrls(base::CommandLine* command_line) override; 26 const PermissionMessageProvider& GetPermissionMessageProvider() 27 const override; 28 const std::string GetProductName() override; 29 void FilterHostPermissions(const URLPatternSet& hosts, 30 URLPatternSet* new_hosts, 31 PermissionIDSet* permissions) const override; 32 void SetScriptingAllowlist(const ScriptingAllowlist& allowlist) override; 33 const ScriptingAllowlist& GetScriptingAllowlist() const override; 34 URLPatternSet GetPermittedChromeSchemeHosts( 35 const Extension* extension, 36 const APIPermissionSet& api_permissions) const override; 37 bool IsScriptableURL(const GURL& url, std::string* error) const override; 38 const GURL& GetWebstoreBaseURL() const override; 39 const GURL& GetWebstoreUpdateURL() const override; 40 bool IsBlacklistUpdateURL(const GURL& url) const override; 41 42 private: 43 const ChromePermissionMessageProvider permission_message_provider_; 44 45 ScriptingAllowlist scripting_allowlist_; 46 47 // Mutable to allow caching in a const method. 48 const GURL webstore_base_url_; 49 const GURL webstore_update_url_; 50 51 DISALLOW_COPY_AND_ASSIGN(CefExtensionsClient); 52 }; 53 54 } // namespace extensions 55 56 #endif // CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_CLIENT_H_ 57