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"
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
{
21 // |context| is the single BrowserContext used for IsValidContext() below.
22 explicit ShellExtensionsBrowserClient(content::BrowserContext
* context
);
23 virtual ~ShellExtensionsBrowserClient();
25 // ExtensionsBrowserClient overrides:
26 virtual bool IsShuttingDown() override
;
27 virtual bool AreExtensionsDisabled(const base::CommandLine
& command_line
,
28 content::BrowserContext
* context
) override
;
29 virtual bool IsValidContext(content::BrowserContext
* context
) override
;
30 virtual bool IsSameContext(content::BrowserContext
* first
,
31 content::BrowserContext
* second
) override
;
32 virtual bool HasOffTheRecordContext(
33 content::BrowserContext
* context
) override
;
34 virtual content::BrowserContext
* GetOffTheRecordContext(
35 content::BrowserContext
* context
) override
;
36 virtual content::BrowserContext
* GetOriginalContext(
37 content::BrowserContext
* context
) override
;
38 virtual bool IsGuestSession(content::BrowserContext
* context
) const override
;
39 virtual bool IsExtensionIncognitoEnabled(
40 const std::string
& extension_id
,
41 content::BrowserContext
* context
) const override
;
42 virtual bool CanExtensionCrossIncognito(
43 const Extension
* extension
,
44 content::BrowserContext
* context
) const override
;
45 virtual net::URLRequestJob
* MaybeCreateResourceBundleRequestJob(
46 net::URLRequest
* request
,
47 net::NetworkDelegate
* network_delegate
,
48 const base::FilePath
& directory_path
,
49 const std::string
& content_security_policy
,
50 bool send_cors_header
) override
;
51 virtual bool AllowCrossRendererResourceLoad(
52 net::URLRequest
* request
,
54 const Extension
* extension
,
55 InfoMap
* extension_info_map
) override
;
56 virtual PrefService
* GetPrefServiceForContext(
57 content::BrowserContext
* context
) override
;
58 virtual void GetEarlyExtensionPrefsObservers(
59 content::BrowserContext
* context
,
60 std::vector
<ExtensionPrefsObserver
*>* observers
) const override
;
61 virtual ProcessManagerDelegate
* GetProcessManagerDelegate() const override
;
62 virtual scoped_ptr
<ExtensionHostDelegate
> CreateExtensionHostDelegate()
64 virtual bool DidVersionUpdate(content::BrowserContext
* context
) override
;
65 virtual void PermitExternalProtocolHandler() override
;
66 virtual scoped_ptr
<AppSorting
> CreateAppSorting() override
;
67 virtual bool IsRunningInForcedAppMode() override
;
68 virtual ApiActivityMonitor
* GetApiActivityMonitor(
69 content::BrowserContext
* context
) override
;
70 virtual ExtensionSystemProvider
* GetExtensionSystemFactory() override
;
71 virtual void RegisterExtensionFunctions(
72 ExtensionFunctionRegistry
* registry
) const override
;
73 virtual scoped_ptr
<RuntimeAPIDelegate
> CreateRuntimeAPIDelegate(
74 content::BrowserContext
* context
) const override
;
75 virtual ComponentExtensionResourceManager
*
76 GetComponentExtensionResourceManager() override
;
77 virtual void BroadcastEventToRenderers(
78 const std::string
& event_name
,
79 scoped_ptr
<base::ListValue
> args
) override
;
80 virtual net::NetLog
* GetNetLog() override
;
83 // The single BrowserContext for app_shell. Not owned.
84 content::BrowserContext
* browser_context_
;
86 // Support for extension APIs.
87 scoped_ptr
<ExtensionsAPIClient
> api_client_
;
89 // The PrefService for |browser_context_|.
90 scoped_ptr
<PrefService
> prefs_
;
92 DISALLOW_COPY_AND_ASSIGN(ShellExtensionsBrowserClient
);
95 } // namespace extensions
97 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSIONS_BROWSER_CLIENT_H_