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

Unified Diff: chrome/browser/extensions/extension_assets_manager.cc

Issue 273193006: Install Chrome OS apps to shared location (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added multi-profile support Created 6 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_assets_manager.cc
diff --git a/chrome/browser/extensions/extension_assets_manager.cc b/chrome/browser/extensions/extension_assets_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ad3271087636791e49ef29421a61af180ef465bb
--- /dev/null
+++ b/chrome/browser/extensions/extension_assets_manager.cc
@@ -0,0 +1,64 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/extension_assets_manager.h"
+
+#include "base/memory/singleton.h"
+#include "extensions/common/extension.h"
+#include "extensions/common/file_util.h"
+
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/extensions/extension_assets_manager_chromeos.h"
+#endif
+
+namespace extensions {
+namespace {
+
+class ExtensionAssetsManagerImpl : public ExtensionAssetsManager {
+ public:
+ // Copy extension assets to final location. This location could be under
+ // |local_install_dir| or some common location shared for multiple users.
asargent_no_longer_on_chrome 2014/05/20 21:20:25 looks like this comment is out of date?
Dmitry Polukhin 2014/05/20 23:42:16 Done.
+ virtual void InstallExtension(const Extension* extension,
+ const base::FilePath& unpacked_extension_root,
+ const base::FilePath& local_install_dir,
+ Profile* profile,
+ InstallExtensionCallback callback) OVERRIDE {
+ callback.Run(file_util::InstallExtension(
+ unpacked_extension_root,
+ extension->id(),
+ extension->VersionString(),
+ local_install_dir));
+ }
+
+ // Remove extension assets if it is not used by anyone else.
+ virtual void UninstallExtension(
+ const std::string& id,
+ Profile* profile,
+ const base::FilePath& local_install_dir,
+ const base::FilePath& extension_root) OVERRIDE {
+ file_util::UninstallExtension(local_install_dir, id);
+ }
+
+ private:
+ friend struct DefaultSingletonTraits<ExtensionAssetsManagerImpl>;
+
+ ExtensionAssetsManagerImpl() {}
+ virtual ~ExtensionAssetsManagerImpl() {}
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionAssetsManagerImpl);
+};
+
+} // namespace
+
+// static
+ExtensionAssetsManager* ExtensionAssetsManager::GetInstance() {
+#if defined(OS_CHROMEOS)
+ return ExtensionAssetsManagerChromeOS::GetInstance();
+#else
+ // If not Chrome OS, use trivial implementation that doesn't share anything.
+ return ExtensionAssetsManagerImpl::GetInstance();
+#endif // OS_CHROMEOS
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698