Roll src/third_party/WebKit 6b63e20:35e1984 (svn 201060:201061)
[chromium-blink-merge.git] / extensions / test / test_extensions_client.h
blobcce385466de639ae7cbce5bfa622de528c876d0c
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.
5 #ifndef EXTENSIONS_TEST_TEST_EXTENSIONS_CLIENT_H_
6 #define EXTENSIONS_TEST_TEST_EXTENSIONS_CLIENT_H_
8 #include "base/macros.h"
9 #include "extensions/common/extensions_client.h"
11 namespace extensions {
13 class TestExtensionsClient : public ExtensionsClient {
14 public:
15 // An interface that lets tests change the set of image paths before they are
16 // returned by TestExtensionClient::GetBrowserImagePaths.
17 class BrowserImagePathsFilter {
18 public:
19 virtual void Filter(const Extension* extension,
20 std::set<base::FilePath>* paths) = 0;
23 TestExtensionsClient();
24 ~TestExtensionsClient() override;
26 void AddBrowserImagePathsFilter(BrowserImagePathsFilter* filter);
27 void RemoveBrowserImagePathsFilter(BrowserImagePathsFilter* filter);
29 private:
30 void Initialize() override;
31 const PermissionMessageProvider& GetPermissionMessageProvider()
32 const override;
33 const std::string GetProductName() override;
34 scoped_ptr<FeatureProvider> CreateFeatureProvider(
35 const std::string& name) const override;
36 scoped_ptr<JSONFeatureProviderSource> CreateFeatureProviderSource(
37 const std::string& name) const override;
38 void FilterHostPermissions(const URLPatternSet& hosts,
39 URLPatternSet* new_hosts,
40 PermissionIDSet* permissions) const override;
41 void SetScriptingWhitelist(const ScriptingWhitelist& whitelist) override;
42 const ScriptingWhitelist& GetScriptingWhitelist() const override;
43 URLPatternSet GetPermittedChromeSchemeHosts(
44 const Extension* extension,
45 const APIPermissionSet& api_permissions) const override;
46 bool IsScriptableURL(const GURL& url, std::string* error) const override;
47 bool IsAPISchemaGenerated(const std::string& name) const override;
48 base::StringPiece GetAPISchema(const std::string& name) const override;
49 void RegisterAPISchemaResources(ExtensionAPI* api) const override;
50 bool ShouldSuppressFatalErrors() const override;
51 void RecordDidSuppressFatalError() override;
52 std::string GetWebstoreBaseURL() const override;
53 std::string GetWebstoreUpdateURL() const override;
54 bool IsBlacklistUpdateURL(const GURL& url) const override;
55 std::set<base::FilePath> GetBrowserImagePaths(
56 const Extension* extension) override;
58 // A whitelist of extensions that can script anywhere. Do not add to this
59 // list (except in tests) without consulting the Extensions team first.
60 // Note: Component extensions have this right implicitly and do not need to be
61 // added to this list.
62 ScriptingWhitelist scripting_whitelist_;
64 std::set<BrowserImagePathsFilter*> browser_image_filters_;
66 DISALLOW_COPY_AND_ASSIGN(TestExtensionsClient);
69 } // namespace extensions
71 #endif // EXTENSIONS_TEST_TEST_EXTENSIONS_CLIENT_H_