| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_EXTENSIONS_CHROME_EXTENSIONS_CLIENT_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_CHROME_EXTENSIONS_CLIENT_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_CHROME_EXTENSIONS_CLIENT_H_ | 6 #define CHROME_COMMON_EXTENSIONS_CHROME_EXTENSIONS_CLIENT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" | 13 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" |
| 14 #include "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" | 14 #include "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" |
| 15 #include "extensions/common/extensions_client.h" | 15 #include "extensions/common/extensions_client.h" |
| 16 #include "extensions/common/permissions/extensions_api_permissions.h" | 16 #include "extensions/common/permissions/extensions_api_permissions.h" |
| 17 #include "url/gurl.h" |
| 17 | 18 |
| 18 namespace extensions { | 19 namespace extensions { |
| 19 | 20 |
| 20 // The implementation of ExtensionsClient for Chrome, which encapsulates the | 21 // The implementation of ExtensionsClient for Chrome, which encapsulates the |
| 21 // global knowledge of features, permissions, and manifest fields. | 22 // global knowledge of features, permissions, and manifest fields. |
| 22 class ChromeExtensionsClient : public ExtensionsClient { | 23 class ChromeExtensionsClient : public ExtensionsClient { |
| 23 public: | 24 public: |
| 24 ChromeExtensionsClient(); | 25 ChromeExtensionsClient(); |
| 25 ~ChromeExtensionsClient() override; | 26 ~ChromeExtensionsClient() override; |
| 26 | 27 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 const ScriptingWhitelist& GetScriptingWhitelist() const override; | 41 const ScriptingWhitelist& GetScriptingWhitelist() const override; |
| 41 URLPatternSet GetPermittedChromeSchemeHosts( | 42 URLPatternSet GetPermittedChromeSchemeHosts( |
| 42 const Extension* extension, | 43 const Extension* extension, |
| 43 const APIPermissionSet& api_permissions) const override; | 44 const APIPermissionSet& api_permissions) const override; |
| 44 bool IsScriptableURL(const GURL& url, std::string* error) const override; | 45 bool IsScriptableURL(const GURL& url, std::string* error) const override; |
| 45 bool IsAPISchemaGenerated(const std::string& name) const override; | 46 bool IsAPISchemaGenerated(const std::string& name) const override; |
| 46 base::StringPiece GetAPISchema(const std::string& name) const override; | 47 base::StringPiece GetAPISchema(const std::string& name) const override; |
| 47 bool ShouldSuppressFatalErrors() const override; | 48 bool ShouldSuppressFatalErrors() const override; |
| 48 void RecordDidSuppressFatalError() override; | 49 void RecordDidSuppressFatalError() override; |
| 49 std::string GetWebstoreBaseURL() const override; | 50 std::string GetWebstoreBaseURL() const override; |
| 50 std::string GetWebstoreUpdateURL() const override; | 51 const GURL& GetWebstoreUpdateURL() const override; |
| 51 bool IsBlacklistUpdateURL(const GURL& url) const override; | 52 bool IsBlacklistUpdateURL(const GURL& url) const override; |
| 52 std::set<base::FilePath> GetBrowserImagePaths( | 53 std::set<base::FilePath> GetBrowserImagePaths( |
| 53 const Extension* extension) override; | 54 const Extension* extension) override; |
| 54 bool ExtensionAPIEnabledInExtensionServiceWorkers() const override; | 55 bool ExtensionAPIEnabledInExtensionServiceWorkers() const override; |
| 55 | 56 |
| 56 // Get the LazyInstance for ChromeExtensionsClient. | 57 // Get the LazyInstance for ChromeExtensionsClient. |
| 57 static ChromeExtensionsClient* GetInstance(); | 58 static ChromeExtensionsClient* GetInstance(); |
| 58 | 59 |
| 59 private: | 60 private: |
| 60 const ChromeAPIPermissions chrome_api_permissions_; | 61 const ChromeAPIPermissions chrome_api_permissions_; |
| 61 const ExtensionsAPIPermissions extensions_api_permissions_; | 62 const ExtensionsAPIPermissions extensions_api_permissions_; |
| 62 const ChromePermissionMessageProvider permission_message_provider_; | 63 const ChromePermissionMessageProvider permission_message_provider_; |
| 63 | 64 |
| 64 // A whitelist of extensions that can script anywhere. Do not add to this | 65 // A whitelist of extensions that can script anywhere. Do not add to this |
| 65 // list (except in tests) without consulting the Extensions team first. | 66 // list (except in tests) without consulting the Extensions team first. |
| 66 // Note: Component extensions have this right implicitly and do not need to be | 67 // Note: Component extensions have this right implicitly and do not need to be |
| 67 // added to this list. | 68 // added to this list. |
| 68 ScriptingWhitelist scripting_whitelist_; | 69 ScriptingWhitelist scripting_whitelist_; |
| 69 | 70 |
| 71 // Mutable to allow caching in a const method. |
| 72 mutable GURL webstore_update_url_; |
| 73 |
| 70 friend struct base::DefaultLazyInstanceTraits<ChromeExtensionsClient>; | 74 friend struct base::DefaultLazyInstanceTraits<ChromeExtensionsClient>; |
| 71 | 75 |
| 72 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsClient); | 76 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsClient); |
| 73 }; | 77 }; |
| 74 | 78 |
| 75 } // namespace extensions | 79 } // namespace extensions |
| 76 | 80 |
| 77 #endif // CHROME_COMMON_EXTENSIONS_CHROME_EXTENSIONS_CLIENT_H_ | 81 #endif // CHROME_COMMON_EXTENSIONS_CHROME_EXTENSIONS_CLIENT_H_ |
| OLD | NEW |