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 "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/lazy_instance.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/extensions/chrome_notification_observer.h"
13 #include "extensions/browser/extensions_browser_client.h"
21 namespace extensions
{
23 // Implementation of extensions::BrowserClient for Chrome, which includes
24 // knowledge of Profiles, BrowserContexts and incognito.
26 // NOTE: Methods that do not require knowledge of browser concepts should be
27 // implemented in ChromeExtensionsClient even if they are only used in the
28 // browser process (see chrome/common/extensions/chrome_extensions_client.h).
29 class ChromeExtensionsBrowserClient
: public ExtensionsBrowserClient
{
31 ChromeExtensionsBrowserClient();
32 virtual ~ChromeExtensionsBrowserClient();
34 // BrowserClient overrides:
35 virtual bool IsShuttingDown() OVERRIDE
;
36 virtual bool AreExtensionsDisabled(const CommandLine
& command_line
,
37 content::BrowserContext
* context
) OVERRIDE
;
38 virtual bool IsValidContext(content::BrowserContext
* context
) OVERRIDE
;
39 virtual bool IsSameContext(content::BrowserContext
* first
,
40 content::BrowserContext
* second
) OVERRIDE
;
41 virtual bool HasOffTheRecordContext(
42 content::BrowserContext
* context
) OVERRIDE
;
43 virtual content::BrowserContext
* GetOffTheRecordContext(
44 content::BrowserContext
* context
) OVERRIDE
;
45 virtual content::BrowserContext
* GetOriginalContext(
46 content::BrowserContext
* context
) OVERRIDE
;
47 virtual bool IsGuestSession(content::BrowserContext
* context
) OVERRIDE
;
48 virtual bool IsExtensionIncognitoEnabled(
49 const std::string
& extension_id
,
50 content::BrowserContext
* context
) const OVERRIDE
;
51 virtual bool CanExtensionCrossIncognito(
52 const extensions::Extension
* extension
,
53 content::BrowserContext
* context
) const OVERRIDE
;
54 virtual PrefService
* GetPrefServiceForContext(
55 content::BrowserContext
* context
) OVERRIDE
;
56 virtual bool DeferLoadingBackgroundHosts(
57 content::BrowserContext
* context
) const OVERRIDE
;
58 virtual bool IsBackgroundPageAllowed(
59 content::BrowserContext
* context
) const OVERRIDE
;
60 virtual void OnExtensionHostCreated(content::WebContents
* web_contents
)
62 virtual void OnRenderViewCreatedForBackgroundPage(ExtensionHost
* host
)
64 virtual bool DidVersionUpdate(content::BrowserContext
* context
) OVERRIDE
;
65 virtual scoped_ptr
<AppSorting
> CreateAppSorting() OVERRIDE
;
66 virtual bool IsRunningInForcedAppMode() OVERRIDE
;
67 virtual content::JavaScriptDialogManager
* GetJavaScriptDialogManager()
69 virtual ApiActivityMonitor
* GetApiActivityMonitor(
70 content::BrowserContext
* context
) OVERRIDE
;
71 virtual ExtensionSystemProvider
* GetExtensionSystemFactory() OVERRIDE
;
74 friend struct base::DefaultLazyInstanceTraits
<ChromeExtensionsBrowserClient
>;
76 // Observer for Chrome-specific notifications.
77 ChromeNotificationObserver notification_observer_
;
79 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsBrowserClient
);
82 } // namespace extensions
84 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSIONS_BROWSER_CLIENT_H_