MacViews: Get c/b/ui/views/tabs to build on Mac
[chromium-blink-merge.git] / chrome / browser / extensions / chrome_extensions_browser_client.h
blob6f43013e493095a9b4ab3b4d215f002e4daa841b
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 bool IsGuestSession(content::BrowserContext* context) const override;
56 bool IsExtensionIncognitoEnabled(
57 const std::string& extension_id,
58 content::BrowserContext* context) const override;
59 bool CanExtensionCrossIncognito(
60 const extensions::Extension* extension,
61 content::BrowserContext* context) const override;
62 net::URLRequestJob* MaybeCreateResourceBundleRequestJob(
63 net::URLRequest* request,
64 net::NetworkDelegate* network_delegate,
65 const base::FilePath& directory_path,
66 const std::string& content_security_policy,
67 bool send_cors_header) override;
68 bool AllowCrossRendererResourceLoad(net::URLRequest* request,
69 bool is_incognito,
70 const Extension* extension,
71 InfoMap* extension_info_map) override;
72 PrefService* GetPrefServiceForContext(
73 content::BrowserContext* context) override;
74 void GetEarlyExtensionPrefsObservers(
75 content::BrowserContext* context,
76 std::vector<ExtensionPrefsObserver*>* observers) const override;
77 ProcessManagerDelegate* GetProcessManagerDelegate() const override;
78 scoped_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() override;
79 bool DidVersionUpdate(content::BrowserContext* context) override;
80 void PermitExternalProtocolHandler() override;
81 scoped_ptr<AppSorting> CreateAppSorting() override;
82 bool IsRunningInForcedAppMode() override;
83 ApiActivityMonitor* GetApiActivityMonitor(
84 content::BrowserContext* context) override;
85 ExtensionSystemProvider* GetExtensionSystemFactory() override;
86 void RegisterExtensionFunctions(
87 ExtensionFunctionRegistry* registry) const override;
88 scoped_ptr<extensions::RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
89 content::BrowserContext* context) const override;
90 ComponentExtensionResourceManager* GetComponentExtensionResourceManager()
91 override;
92 void BroadcastEventToRenderers(const std::string& event_name,
93 scoped_ptr<base::ListValue> args) override;
94 net::NetLog* GetNetLog() override;
95 ExtensionCache* GetExtensionCache() override;
96 bool IsBackgroundUpdateAllowed() override;
97 bool IsMinBrowserVersionSupported(const std::string& min_version) override;
99 private:
100 friend struct base::DefaultLazyInstanceTraits<ChromeExtensionsBrowserClient>;
102 // Observer for Chrome-specific notifications.
103 ChromeNotificationObserver notification_observer_;
105 // Support for ProcessManager.
106 scoped_ptr<ChromeProcessManagerDelegate> process_manager_delegate_;
108 // Client for API implementations.
109 scoped_ptr<ChromeExtensionsAPIClient> api_client_;
111 scoped_ptr<ChromeComponentExtensionResourceManager> resource_manager_;
113 scoped_ptr<ExtensionCache> extension_cache_;
115 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsBrowserClient);
118 } // namespace extensions
120 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSIONS_BROWSER_CLIENT_H_