Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: athena/extensions/shell/extensions_delegate_impl.cc

Issue 642383003: Add the ability to load multiple apps into app_shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | athena/main/athena_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "athena/extensions/public/extensions_delegate.h" 5 #include "athena/extensions/public/extensions_delegate.h"
6 6
7 #include "athena/extensions/shell/athena_shell_app_window_client.h" 7 #include "athena/extensions/shell/athena_shell_app_window_client.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "extensions/browser/extension_registry.h"
9 #include "extensions/browser/install/extension_install_ui.h" 10 #include "extensions/browser/install/extension_install_ui.h"
10 #include "extensions/common/extension_set.h" 11 #include "extensions/common/extension_set.h"
11 #include "extensions/shell/browser/shell_extension_system.h" 12 #include "extensions/shell/browser/shell_extension_system.h"
12 13
13 namespace athena { 14 namespace athena {
14 namespace { 15 namespace {
15 16
16 class ShellExtensionsDelegate : public ExtensionsDelegate { 17 class ShellExtensionsDelegate : public ExtensionsDelegate {
17 public: 18 public:
18 explicit ShellExtensionsDelegate(content::BrowserContext* context) 19 explicit ShellExtensionsDelegate(content::BrowserContext* context)
19 : context_(context), 20 : context_(context),
20 extension_system_(static_cast<extensions::ShellExtensionSystem*>( 21 extension_system_(static_cast<extensions::ShellExtensionSystem*>(
21 extensions::ExtensionSystem::Get(context))) { 22 extensions::ExtensionSystem::Get(context))) {
22 extensions::AppWindowClient::Set(&app_window_client_); 23 extensions::AppWindowClient::Set(&app_window_client_);
23 } 24 }
24 25
25 virtual ~ShellExtensionsDelegate() { extensions::AppWindowClient::Set(NULL); } 26 virtual ~ShellExtensionsDelegate() { extensions::AppWindowClient::Set(NULL); }
26 27
27 private: 28 private:
28 // ExtensionsDelegate: 29 // ExtensionsDelegate:
29 virtual content::BrowserContext* GetBrowserContext() const override { 30 virtual content::BrowserContext* GetBrowserContext() const override {
30 return context_; 31 return context_;
31 } 32 }
32 virtual const extensions::ExtensionSet& GetInstalledExtensions() override { 33 virtual const extensions::ExtensionSet& GetInstalledExtensions() override {
33 shell_extensions_.Clear(); 34 return extensions::ExtensionRegistry::Get(context_)->enabled_extensions();
34 if (extension_system_->extension().get())
35 shell_extensions_.Insert(extension_system_->extension());
36 return shell_extensions_;
37 } 35 }
38 virtual bool LaunchApp(const std::string& app_id) override { 36 virtual bool LaunchApp(const std::string& app_id) override {
39 extension_system_->LaunchApp(); 37 extension_system_->LaunchApp(app_id);
40 return true; 38 return true;
41 } 39 }
42 40
43 virtual bool UnloadApp(const std::string& app_id) override { return false; } 41 virtual bool UnloadApp(const std::string& app_id) override { return false; }
44 42
45 virtual scoped_ptr<extensions::ExtensionInstallUI> CreateExtensionInstallUI() 43 virtual scoped_ptr<extensions::ExtensionInstallUI> CreateExtensionInstallUI()
46 override { 44 override {
47 return scoped_ptr<extensions::ExtensionInstallUI>(); 45 return scoped_ptr<extensions::ExtensionInstallUI>();
48 } 46 }
49 47
50 content::BrowserContext* context_; 48 content::BrowserContext* context_;
51 extensions::ShellExtensionSystem* extension_system_; 49 extensions::ShellExtensionSystem* extension_system_;
52 extensions::ExtensionSet shell_extensions_;
53 50
54 AthenaShellAppWindowClient app_window_client_; 51 AthenaShellAppWindowClient app_window_client_;
55 52
56 DISALLOW_COPY_AND_ASSIGN(ShellExtensionsDelegate); 53 DISALLOW_COPY_AND_ASSIGN(ShellExtensionsDelegate);
57 }; 54 };
58 55
59 } // namespace 56 } // namespace
60 57
61 // static 58 // static
62 void ExtensionsDelegate::CreateExtensionsDelegate( 59 void ExtensionsDelegate::CreateExtensionsDelegate(
63 content::BrowserContext* context) { 60 content::BrowserContext* context) {
64 new ShellExtensionsDelegate(context); 61 new ShellExtensionsDelegate(context);
65 } 62 }
66 63
67 } // namespace athena 64 } // namespace athena
OLDNEW
« no previous file with comments | « no previous file | athena/main/athena_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698