Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / extensions / shell / browser / shell_extensions_browser_client.h
blob8b65ccfd144dccd5ce51f21e7b013dd6a043a213
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_SHELL_BROWSER_SHELL_EXTENSIONS_BROWSER_CLIENT_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSIONS_BROWSER_CLIENT_H_
8 #include "base/compiler_specific.h"
9 #include "extensions/browser/extensions_browser_client.h"
11 class PrefService;
13 namespace extensions {
15 class ExtensionsAPIClient;
17 // An ExtensionsBrowserClient that supports a single content::BrowserContent
18 // with no related incognito context.
19 class ShellExtensionsBrowserClient : public ExtensionsBrowserClient {
20 public:
21 // |context| is the single BrowserContext used for IsValidContext() below.
22 // |pref_service| is used for GetPrefServiceForContext() below.
23 ShellExtensionsBrowserClient(content::BrowserContext* context,
24 PrefService* pref_service);
25 ~ShellExtensionsBrowserClient() override;
27 // ExtensionsBrowserClient overrides:
28 bool IsShuttingDown() override;
29 bool AreExtensionsDisabled(const base::CommandLine& command_line,
30 content::BrowserContext* context) override;
31 bool IsValidContext(content::BrowserContext* context) override;
32 bool IsSameContext(content::BrowserContext* first,
33 content::BrowserContext* second) override;
34 bool HasOffTheRecordContext(content::BrowserContext* context) override;
35 content::BrowserContext* GetOffTheRecordContext(
36 content::BrowserContext* context) override;
37 content::BrowserContext* GetOriginalContext(
38 content::BrowserContext* context) override;
39 #if defined(OS_CHROMEOS)
40 std::string GetUserIdHashFromContext(
41 content::BrowserContext* context) override;
42 #endif
43 bool IsGuestSession(content::BrowserContext* context) const override;
44 bool IsExtensionIncognitoEnabled(
45 const std::string& extension_id,
46 content::BrowserContext* context) const override;
47 bool CanExtensionCrossIncognito(
48 const Extension* extension,
49 content::BrowserContext* context) const override;
50 net::URLRequestJob* MaybeCreateResourceBundleRequestJob(
51 net::URLRequest* request,
52 net::NetworkDelegate* network_delegate,
53 const base::FilePath& directory_path,
54 const std::string& content_security_policy,
55 bool send_cors_header) override;
56 bool AllowCrossRendererResourceLoad(net::URLRequest* request,
57 bool is_incognito,
58 const Extension* extension,
59 InfoMap* extension_info_map) override;
60 PrefService* GetPrefServiceForContext(
61 content::BrowserContext* context) override;
62 void GetEarlyExtensionPrefsObservers(
63 content::BrowserContext* context,
64 std::vector<ExtensionPrefsObserver*>* observers) const override;
65 ProcessManagerDelegate* GetProcessManagerDelegate() const override;
66 scoped_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() override;
67 bool DidVersionUpdate(content::BrowserContext* context) override;
68 void PermitExternalProtocolHandler() override;
69 bool IsRunningInForcedAppMode() override;
70 ApiActivityMonitor* GetApiActivityMonitor(
71 content::BrowserContext* context) override;
72 ExtensionSystemProvider* GetExtensionSystemFactory() override;
73 void RegisterExtensionFunctions(
74 ExtensionFunctionRegistry* registry) const override;
75 void RegisterMojoServices(content::RenderFrameHost* render_frame_host,
76 const Extension* extension) const override;
77 scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
78 content::BrowserContext* context) const override;
79 const ComponentExtensionResourceManager*
80 GetComponentExtensionResourceManager() override;
81 void BroadcastEventToRenderers(events::HistogramValue histogram_value,
82 const std::string& event_name,
83 scoped_ptr<base::ListValue> args) override;
84 net::NetLog* GetNetLog() override;
85 ExtensionCache* GetExtensionCache() override;
86 bool IsBackgroundUpdateAllowed() override;
87 bool IsMinBrowserVersionSupported(const std::string& min_version) override;
88 ExtensionWebContentsObserver* GetExtensionWebContentsObserver(
89 content::WebContents* web_contents) override;
91 // Sets the API client.
92 void SetAPIClientForTest(ExtensionsAPIClient* api_client);
94 private:
95 // The single BrowserContext for app_shell. Not owned.
96 content::BrowserContext* browser_context_;
98 // The PrefService for |browser_context_|. Not owned.
99 PrefService* pref_service_;
101 // Support for extension APIs.
102 scoped_ptr<ExtensionsAPIClient> api_client_;
104 // The extension cache used for download and installation.
105 scoped_ptr<ExtensionCache> extension_cache_;
107 DISALLOW_COPY_AND_ASSIGN(ShellExtensionsBrowserClient);
110 } // namespace extensions
112 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSIONS_BROWSER_CLIENT_H_