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. 4 5 #ifndef ATHENA_EXTENSIONS_PUBLIC_EXTENSIONS_DELEGATE_H_ 6 #define ATHENA_EXTENSIONS_PUBLIC_EXTENSIONS_DELEGATE_H_ 7 8 #include <string> 9 10 #include "athena/athena_export.h" 11 12 namespace content { 13 class BrowserContext; 14 class WebContents; 15 } 16 17 namespace extensions { 18 class ExtensionSet; 19 } 20 21 namespace athena { 22 23 // A delegate interface to extension implentation. 24 class ATHENA_EXPORT ExtensionsDelegate { 25 public: 26 static ExtensionsDelegate* Get(content::BrowserContext* context); 27 28 // Creates the extension delegate for app shell environment. 29 static void CreateExtensionsDelegateForShell( 30 content::BrowserContext* context); 31 32 // Creates the extension delegate for chrome environment. 33 static void CreateExtensionsDelegateForChrome( 34 content::BrowserContext* context); 35 36 // Creates the extension delegate for test environment. 37 static void CreateExtensionsDelegateForTest(); 38 39 // Deletes the singleton instance. This must be called in the reverse 40 // order of the initialization. 41 static void Shutdown(); 42 43 ExtensionsDelegate(); 44 virtual ~ExtensionsDelegate(); 45 46 virtual content::BrowserContext* GetBrowserContext() const = 0; 47 48 // Returns the set of extensions that are currently installed. 49 virtual const extensions::ExtensionSet& GetInstalledExtensions() = 0; 50 51 // Starts an application. Returns true if the application was 52 // successfully started. 53 // TODO(oshima): Add launcher source type. (see chrome_launcher_types.h) 54 virtual bool LaunchApp(const std::string& app_id) = 0; 55 56 // Unload an application. Returns true if the application was 57 // successfully unloaded. 58 virtual bool UnloadApp(const std::string& app_id) = 0; 59 }; 60 61 } // namespace athena 62 63 #endif // ATHENA_EXTENSIONS_PUBLIC_EXTENSIONS_DELEGATE_H_ 64