Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / extensions / shell / browser / shell_extensions_browser_client.h
blobcd79e9d5c65fa7f36a9f51d813caf4e79cc040fa
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 scoped_ptr<AppSorting> CreateAppSorting(
70 content::BrowserContext* context) override;
71 bool IsRunningInForcedAppMode() override;
72 ApiActivityMonitor* GetApiActivityMonitor(
73 content::BrowserContext* context) override;
74 ExtensionSystemProvider* GetExtensionSystemFactory() override;
75 void RegisterExtensionFunctions(
76 ExtensionFunctionRegistry* registry) const override;
77 void RegisterMojoServices(content::RenderFrameHost* render_frame_host,
78 const Extension* extension) const override;
79 scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
80 content::BrowserContext* context) const override;
81 const ComponentExtensionResourceManager*
82 GetComponentExtensionResourceManager() override;
83 void BroadcastEventToRenderers(events::HistogramValue histogram_value,
84 const std::string& event_name,
85 scoped_ptr<base::ListValue> args) override;
86 net::NetLog* GetNetLog() override;
87 ExtensionCache* GetExtensionCache() override;
88 bool IsBackgroundUpdateAllowed() override;
89 bool IsMinBrowserVersionSupported(const std::string& min_version) override;
90 ExtensionWebContentsObserver* GetExtensionWebContentsObserver(
91 content::WebContents* web_contents) override;
93 // Sets the API client.
94 void SetAPIClientForTest(ExtensionsAPIClient* api_client);
96 private:
97 // The single BrowserContext for app_shell. Not owned.
98 content::BrowserContext* browser_context_;
100 // The PrefService for |browser_context_|. Not owned.
101 PrefService* pref_service_;
103 // Support for extension APIs.
104 scoped_ptr<ExtensionsAPIClient> api_client_;
106 // The extension cache used for download and installation.
107 scoped_ptr<ExtensionCache> extension_cache_;
109 DISALLOW_COPY_AND_ASSIGN(ShellExtensionsBrowserClient);
112 } // namespace extensions
114 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSIONS_BROWSER_CLIENT_H_