[Easy Unlock] Fix a DCHECK: Load localized string correctly.
[chromium-blink-merge.git] / chrome / common / extensions / chrome_extensions_client.h
blobb68b1c52acf19b48ee7063c311d70d673c083cce
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
3 // found in the LICENSE file.
5 #ifndef CHROME_COMMON_EXTENSIONS_CHROME_EXTENSIONS_CLIENT_H_
6 #define CHROME_COMMON_EXTENSIONS_CHROME_EXTENSIONS_CLIENT_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/lazy_instance.h"
11 #include "chrome/common/extensions/permissions/chrome_api_permissions.h"
12 #include "chrome/common/extensions/permissions/chrome_permission_message_provider.h"
13 #include "extensions/common/extensions_client.h"
14 #include "extensions/common/permissions/extensions_api_permissions.h"
16 namespace extensions {
18 // The implementation of ExtensionsClient for Chrome, which encapsulates the
19 // global knowledge of features, permissions, and manifest fields.
20 class ChromeExtensionsClient : public ExtensionsClient {
21 public:
22 ChromeExtensionsClient();
23 virtual ~ChromeExtensionsClient();
25 virtual void Initialize() OVERRIDE;
27 virtual const PermissionMessageProvider& GetPermissionMessageProvider() const
28 OVERRIDE;
29 virtual const std::string GetProductName() OVERRIDE;
30 virtual scoped_ptr<FeatureProvider> CreateFeatureProvider(
31 const std::string& name) const OVERRIDE;
32 virtual scoped_ptr<JSONFeatureProviderSource> CreateFeatureProviderSource(
33 const std::string& name) const OVERRIDE;
34 virtual void FilterHostPermissions(
35 const URLPatternSet& hosts,
36 URLPatternSet* new_hosts,
37 std::set<PermissionMessage>* messages) const OVERRIDE;
38 virtual void SetScriptingWhitelist(const ScriptingWhitelist& whitelist)
39 OVERRIDE;
40 virtual const ScriptingWhitelist& GetScriptingWhitelist() const OVERRIDE;
41 virtual URLPatternSet GetPermittedChromeSchemeHosts(
42 const Extension* extension,
43 const APIPermissionSet& api_permissions) const OVERRIDE;
44 virtual bool IsScriptableURL(const GURL& url, std::string* error) const
45 OVERRIDE;
46 virtual bool IsAPISchemaGenerated(const std::string& name) const OVERRIDE;
47 virtual base::StringPiece GetAPISchema(const std::string& name) const
48 OVERRIDE;
49 virtual void RegisterAPISchemaResources(ExtensionAPI* api) const OVERRIDE;
50 virtual bool ShouldSuppressFatalErrors() const OVERRIDE;
51 virtual std::string GetWebstoreBaseURL() const OVERRIDE;
52 virtual std::string GetWebstoreUpdateURL() const OVERRIDE;
53 virtual bool IsBlacklistUpdateURL(const GURL& url) const OVERRIDE;
55 // Get the LazyInstance for ChromeExtensionsClient.
56 static ChromeExtensionsClient* GetInstance();
58 private:
59 const ChromeAPIPermissions chrome_api_permissions_;
60 const ExtensionsAPIPermissions extensions_api_permissions_;
61 const ChromePermissionMessageProvider permission_message_provider_;
63 // A whitelist of extensions that can script anywhere. Do not add to this
64 // list (except in tests) without consulting the Extensions team first.
65 // Note: Component extensions have this right implicitly and do not need to be
66 // added to this list.
67 ScriptingWhitelist scripting_whitelist_;
69 friend struct base::DefaultLazyInstanceTraits<ChromeExtensionsClient>;
71 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsClient);
74 } // namespace extensions
76 #endif // CHROME_COMMON_EXTENSIONS_CHROME_EXTENSIONS_CLIENT_H_