| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/browser/extensions/extension_assets_manager.h" |
| 6 |
| 7 #include "extensions/common/extension.h" |
| 8 #include "extensions/common/file_util.h" |
| 9 |
| 10 #if defined(OS_CHROMEOS) |
| 11 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h" |
| 12 #endif |
| 13 |
| 14 namespace extensions { |
| 15 |
| 16 // static |
| 17 ExtensionAssetsManager* ExtensionAssetsManager::GetInstance() { |
| 18 #if defined(OS_CHROMEOS) |
| 19 return ExtensionAssetsManagerChromeOS::GetInstance(); |
| 20 #else |
| 21 // If not Chrome OS, use trivial implementation that doesn't share anything. |
| 22 static ExtensionAssetsManager manager; |
| 23 return &manager; |
| 24 #endif // OS_CHROMEOS |
| 25 } |
| 26 |
| 27 void ExtensionAssetsManager::InstallExtension( |
| 28 const Extension* extension, |
| 29 const base::FilePath& unpacked_extension_root, |
| 30 const base::FilePath& local_install_dir, |
| 31 Profile* profile, |
| 32 InstallExtensionCallback callback) { |
| 33 callback.Run(file_util::InstallExtension( |
| 34 unpacked_extension_root, |
| 35 extension->id(), |
| 36 extension->VersionString(), |
| 37 local_install_dir)); |
| 38 } |
| 39 |
| 40 void ExtensionAssetsManager::UninstallExtension( |
| 41 const std::string& id, |
| 42 Profile* profile, |
| 43 const base::FilePath& local_install_dir, |
| 44 const base::FilePath& extension_root) { |
| 45 DCHECK(local_install_dir.IsParent(extension_root)); |
| 46 file_util::UninstallExtension(local_install_dir, id); |
| 47 } |
| 48 |
| 49 } // namespace extensions |
| OLD | NEW |