1 // Copyright (c) 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ASSETS_MANAGER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ASSETS_MANAGER_H_
10 #include "base/callback.h"
11 #include "base/files/file_path.h"
15 namespace extensions
{
19 // Assets manager for installed extensions. Some extensions can be installed in
20 // a shared place for multiple profiles (users). This class manages install and
21 // uninstall. At the time being shared location is used for default apps on
22 // Chrome OS only. This class must be used only from the extension file task
24 class ExtensionAssetsManager
{
26 // Callback that is invoked when the extension assets are installed.
27 // |file_path| is destination directory on success or empty in case of error.
28 typedef base::Callback
<void(const base::FilePath
& file_path
)>
29 InstallExtensionCallback
;
31 static ExtensionAssetsManager
* GetInstance();
33 // Copy extension assets to final location. This location could be under
34 // |local_install_dir| or some common location shared for multiple users.
35 virtual void InstallExtension(const Extension
* extension
,
36 const base::FilePath
& unpacked_extension_root
,
37 const base::FilePath
& local_install_dir
,
39 InstallExtensionCallback callback
) = 0;
41 // Remove extension assets if it is not used by anyone else.
42 virtual void UninstallExtension(const std::string
& id
,
44 const base::FilePath
& local_install_dir
,
45 const base::FilePath
& extension_root
) = 0;
48 virtual ~ExtensionAssetsManager() {}
51 } // namespace extensions
53 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ASSETS_MANAGER_H_