Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / athena / extensions / shell / extensions_delegate_impl.cc
blob13161779e3f67852a7310498ea2d4471ddde70ad
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"
10 namespace athena {
11 namespace {
13 class ShellExtensionsDelegate : public ExtensionsDelegate {
14 public:
15 explicit ShellExtensionsDelegate(content::BrowserContext* context)
16 : context_(context),
17 extension_system_(static_cast<extensions::ShellExtensionSystem*>(
18 extensions::ExtensionSystem::Get(context))) {}
20 virtual ~ShellExtensionsDelegate() {}
22 private:
23 // ExtensionsDelegate:
24 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE {
25 return context_;
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();
35 return true;
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);
47 } // namespace
49 // static
50 void ExtensionsDelegate::CreateExtensionsDelegateForShell(
51 content::BrowserContext* context) {
52 new ShellExtensionsDelegate(context);
55 } // namespace athena