Add a webstorePrivate API to show a permission prompt for delegated bundle installs
[chromium-blink-merge.git] / chrome / browser / extensions / chrome_extensions_browser_client.h
blob10e0d714ea1f84f68c7141d50d0b5e069b666fef
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_BROWSER_EXTENSIONS_CHROME_EXTENSIONS_BROWSER_CLIENT_H_
6 #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSIONS_BROWSER_CLIENT_H_
8 #include <map>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/lazy_instance.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/extensions/chrome_notification_observer.h"
15 #include "extensions/browser/extensions_browser_client.h"
17 namespace base {
18 class CommandLine;
21 namespace content {
22 class BrowserContext;
25 namespace extensions {
27 class ChromeComponentExtensionResourceManager;
28 class ChromeExtensionsAPIClient;
29 class ChromeProcessManagerDelegate;
30 class ContentSettingsPrefsObserver;
32 // Implementation of extensions::BrowserClient for Chrome, which includes
33 // knowledge of Profiles, BrowserContexts and incognito.
35 // NOTE: Methods that do not require knowledge of browser concepts should be
36 // implemented in ChromeExtensionsClient even if they are only used in the
37 // browser process (see chrome/common/extensions/chrome_extensions_client.h).
38 class ChromeExtensionsBrowserClient : public ExtensionsBrowserClient {
39 public:
40 ChromeExtensionsBrowserClient();
41 ~ChromeExtensionsBrowserClient() override;
43 // BrowserClient overrides:
44 bool IsShuttingDown() override;
45 bool AreExtensionsDisabled(const base::CommandLine& command_line,
46 content::BrowserContext* context) override;
47 bool IsValidContext(content::BrowserContext* context) override;
48 bool IsSameContext(content::BrowserContext* first,
49 content::BrowserContext* second) override;
50 bool HasOffTheRecordContext(content::BrowserContext* context) override;
51 content::BrowserContext* GetOffTheRecordContext(
52 content::BrowserContext* context) override;
53 content::BrowserContext* GetOriginalContext(
54 content::BrowserContext* context) override;
55 #if defined(OS_CHROMEOS)
56 std::string GetUserIdHashFromContext(
57 content::BrowserContext* context) override;
58 #endif
59 bool IsGuestSession(content::BrowserContext* context) const override;
60 bool IsExtensionIncognitoEnabled(
61 const std::string& extension_id,
62 content::BrowserContext* context) const override;
63 bool CanExtensionCrossIncognito(
64 const extensions::Extension* extension,
65 content::BrowserContext* context) const override;
66 net::URLRequestJob* MaybeCreateResourceBundleRequestJob(
67 net::URLRequest* request,
68 net::NetworkDelegate* network_delegate,
69 const base::FilePath& directory_path,
70 const std::string& content_security_policy,
71 bool send_cors_header) override;
72 bool AllowCrossRendererResourceLoad(net::URLRequest* request,
73 bool is_incognito,
74 const Extension* extension,
75 InfoMap* extension_info_map) override;
76 PrefService* GetPrefServiceForContext(
77 content::BrowserContext* context) override;
78 void GetEarlyExtensionPrefsObservers(
79 content::BrowserContext* context,
80 std::vector<ExtensionPrefsObserver*>* observers) const override;
81 ProcessManagerDelegate* GetProcessManagerDelegate() const override;
82 scoped_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() override;
83 bool DidVersionUpdate(content::BrowserContext* context) override;
84 void PermitExternalProtocolHandler() override;
85 scoped_ptr<AppSorting> CreateAppSorting() override;
86 bool IsRunningInForcedAppMode() override;
87 ApiActivityMonitor* GetApiActivityMonitor(
88 content::BrowserContext* context) override;
89 ExtensionSystemProvider* GetExtensionSystemFactory() override;
90 void RegisterExtensionFunctions(
91 ExtensionFunctionRegistry* registry) const override;
92 void RegisterMojoServices(content::RenderFrameHost* render_frame_host,
93 const Extension* extension) const override;
94 scoped_ptr<extensions::RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
95 content::BrowserContext* context) const override;
96 const ComponentExtensionResourceManager*
97 GetComponentExtensionResourceManager() override;
98 void BroadcastEventToRenderers(const std::string& event_name,
99 scoped_ptr<base::ListValue> args) override;
100 net::NetLog* GetNetLog() override;
101 ExtensionCache* GetExtensionCache() override;
102 bool IsBackgroundUpdateAllowed() override;
103 bool IsMinBrowserVersionSupported(const std::string& min_version) override;
104 ExtensionWebContentsObserver* GetExtensionWebContentsObserver(
105 content::WebContents* web_contents) override;
107 private:
108 friend struct base::DefaultLazyInstanceTraits<ChromeExtensionsBrowserClient>;
110 // Observer for Chrome-specific notifications.
111 ChromeNotificationObserver notification_observer_;
113 // Support for ProcessManager.
114 scoped_ptr<ChromeProcessManagerDelegate> process_manager_delegate_;
116 // Client for API implementations.
117 scoped_ptr<ChromeExtensionsAPIClient> api_client_;
119 scoped_ptr<ChromeComponentExtensionResourceManager> resource_manager_;
121 scoped_ptr<ExtensionCache> extension_cache_;
123 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsBrowserClient);
126 } // namespace extensions
128 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSIONS_BROWSER_CLIENT_H_