Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / extensions / extension_assets_manager.cc
blobbdb862da21680f33b89ecb0833f5beaa70b56fc7
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 #include "chrome/browser/extensions/extension_assets_manager.h"
7 #include "base/memory/singleton.h"
8 #include "extensions/common/extension.h"
9 #include "extensions/common/file_util.h"
11 #if defined(OS_CHROMEOS)
12 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h"
13 #endif
15 namespace extensions {
16 namespace {
18 class ExtensionAssetsManagerImpl : public ExtensionAssetsManager {
19 public:
20 static ExtensionAssetsManagerImpl* GetInstance() {
21 return Singleton<ExtensionAssetsManagerImpl>::get();
24 // Override from ExtensionAssetsManager.
25 void InstallExtension(const Extension* extension,
26 const base::FilePath& unpacked_extension_root,
27 const base::FilePath& local_install_dir,
28 Profile* profile,
29 InstallExtensionCallback callback) override {
30 callback.Run(file_util::InstallExtension(
31 unpacked_extension_root,
32 extension->id(),
33 extension->VersionString(),
34 local_install_dir));
37 void UninstallExtension(const std::string& id,
38 Profile* profile,
39 const base::FilePath& local_install_dir,
40 const base::FilePath& extension_root) override {
41 file_util::UninstallExtension(local_install_dir, id);
44 private:
45 friend struct DefaultSingletonTraits<ExtensionAssetsManagerImpl>;
47 ExtensionAssetsManagerImpl() {}
48 ~ExtensionAssetsManagerImpl() override {}
50 DISALLOW_COPY_AND_ASSIGN(ExtensionAssetsManagerImpl);
53 } // namespace
55 // static
56 ExtensionAssetsManager* ExtensionAssetsManager::GetInstance() {
57 #if defined(OS_CHROMEOS)
58 return ExtensionAssetsManagerChromeOS::GetInstance();
59 #else
60 // If not Chrome OS, use trivial implementation that doesn't share anything.
61 return ExtensionAssetsManagerImpl::GetInstance();
62 #endif // OS_CHROMEOS
65 } // namespace extensions