• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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 EXTENSIONS_TEST_TEST_EXTENSIONS_CLIENT_H_
6 #define EXTENSIONS_TEST_TEST_EXTENSIONS_CLIENT_H_
7 
8 #include "base/macros.h"
9 #include "extensions/common/extensions_client.h"
10 
11 namespace extensions {
12 
13 class TestExtensionsClient : public ExtensionsClient {
14  public:
15   TestExtensionsClient();
16   virtual ~TestExtensionsClient();
17 
18  private:
19   virtual void Initialize() OVERRIDE;
20   virtual const PermissionMessageProvider& GetPermissionMessageProvider() const
21       OVERRIDE;
22   virtual const std::string GetProductName() OVERRIDE;
23   virtual scoped_ptr<FeatureProvider> CreateFeatureProvider(
24       const std::string& name) const OVERRIDE;
25   virtual scoped_ptr<JSONFeatureProviderSource> CreateFeatureProviderSource(
26       const std::string& name) const OVERRIDE;
27   virtual void FilterHostPermissions(
28       const URLPatternSet& hosts,
29       URLPatternSet* new_hosts,
30       std::set<PermissionMessage>* messages) const OVERRIDE;
31   virtual void SetScriptingWhitelist(
32       const ScriptingWhitelist& whitelist) OVERRIDE;
33   virtual const ScriptingWhitelist& GetScriptingWhitelist() const OVERRIDE;
34   virtual URLPatternSet GetPermittedChromeSchemeHosts(
35       const Extension* extension,
36       const APIPermissionSet& api_permissions) const OVERRIDE;
37   virtual bool IsScriptableURL(const GURL& url,
38                                std::string* error) const OVERRIDE;
39   virtual bool IsAPISchemaGenerated(const std::string& name) const OVERRIDE;
40   virtual base::StringPiece GetAPISchema(
41       const std::string& name) const OVERRIDE;
42   virtual void RegisterAPISchemaResources(ExtensionAPI* api) const OVERRIDE;
43   virtual bool ShouldSuppressFatalErrors() const OVERRIDE;
44   virtual std::string GetWebstoreBaseURL() const OVERRIDE;
45   virtual std::string GetWebstoreUpdateURL() const OVERRIDE;
46   virtual bool IsBlacklistUpdateURL(const GURL& url) const OVERRIDE;
47 
48   // A whitelist of extensions that can script anywhere. Do not add to this
49   // list (except in tests) without consulting the Extensions team first.
50   // Note: Component extensions have this right implicitly and do not need to be
51   // added to this list.
52   ScriptingWhitelist scripting_whitelist_;
53 
54   DISALLOW_COPY_AND_ASSIGN(TestExtensionsClient);
55 };
56 
57 }  // namespace extensions
58 
59 #endif  // EXTENSIONS_TEST_TEST_EXTENSIONS_CLIENT_H_
60