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 #include "athena/extensions/public/extensions_delegate.h"
6 #include "base/macros.h"
7 #include "extensions/common/extension_set.h"
8 #include "extensions/shell/browser/shell_extension_system.h"
13 class ShellExtensionsDelegate
: public ExtensionsDelegate
{
15 explicit ShellExtensionsDelegate(content::BrowserContext
* context
)
17 extension_system_(static_cast<extensions::ShellExtensionSystem
*>(
18 extensions::ExtensionSystem::Get(context
))) {}
20 virtual ~ShellExtensionsDelegate() {}
23 // ExtensionsDelegate:
24 virtual content::BrowserContext
* GetBrowserContext() const OVERRIDE
{
27 virtual const extensions::ExtensionSet
& GetInstalledExtensions() OVERRIDE
{
28 shell_extensions_
.Clear();
29 if (extension_system_
->extension())
30 shell_extensions_
.Insert(extension_system_
->extension());
31 return shell_extensions_
;
33 virtual bool LaunchApp(const std::string
& app_id
) OVERRIDE
{
34 extension_system_
->LaunchApp();
38 virtual bool UnloadApp(const std::string
& app_id
) OVERRIDE
{ return false; }
40 content::BrowserContext
* context_
;
41 extensions::ShellExtensionSystem
* extension_system_
;
42 extensions::ExtensionSet shell_extensions_
;
44 DISALLOW_COPY_AND_ASSIGN(ShellExtensionsDelegate
);
50 void ExtensionsDelegate::CreateExtensionsDelegateForShell(
51 content::BrowserContext
* context
) {
52 new ShellExtensionsDelegate(context
);