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. 4 5 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSIONS_BROWSER_CLIENT_H_ 6 #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSIONS_BROWSER_CLIENT_H_ 7 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" 14 15 class CommandLine; 16 17 namespace content { 18 class BrowserContext; 19 } 20 21 namespace extensions { 22 23 // Implementation of extensions::BrowserClient for Chrome, which includes 24 // knowledge of Profiles, BrowserContexts and incognito. 25 // 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 { 30 public: 31 ChromeExtensionsBrowserClient(); 32 virtual ~ChromeExtensionsBrowserClient(); 33 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 PrefService* GetPrefServiceForContext( 48 content::BrowserContext* context) OVERRIDE; 49 virtual bool DeferLoadingBackgroundHosts( 50 content::BrowserContext* context) const OVERRIDE; 51 virtual bool IsBackgroundPageAllowed( 52 content::BrowserContext* context) const OVERRIDE; 53 virtual bool DidVersionUpdate(content::BrowserContext* context) OVERRIDE; 54 virtual scoped_ptr<AppSorting> CreateAppSorting() OVERRIDE; 55 virtual bool IsRunningInForcedAppMode() OVERRIDE; 56 virtual content::JavaScriptDialogManager* GetJavaScriptDialogManager() 57 OVERRIDE; 58 59 private: 60 friend struct base::DefaultLazyInstanceTraits<ChromeExtensionsBrowserClient>; 61 62 // Observer for Chrome-specific notifications. 63 ChromeNotificationObserver notification_observer_; 64 65 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsBrowserClient); 66 }; 67 68 } // namespace extensions 69 70 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSIONS_BROWSER_CLIENT_H_ 71