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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 "base/memory/singleton.h"
8 #include "extensions/common/extension.h"
9 #include "extensions/common/file_util.h"
10
11 #if defined(OS_CHROMEOS)
12 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h"
13 #endif
14
15 namespace extensions {
16 namespace {
17
18 class ExtensionAssetsManagerImpl : public ExtensionAssetsManager {
19 public:
20 // Copy extension assets to final location. This location could be under
21 // |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.
22 virtual void InstallExtension(const Extension* extension,
23 const base::FilePath& unpacked_extension_root,
24 const base::FilePath& local_install_dir,
25 Profile* profile,
26 InstallExtensionCallback callback) OVERRIDE {
27 callback.Run(file_util::InstallExtension(
28 unpacked_extension_root,
29 extension->id(),
30 extension->VersionString(),
31 local_install_dir));
32 }
33
34 // Remove extension assets if it is not used by anyone else.
35 virtual void UninstallExtension(
36 const std::string& id,
37 Profile* profile,
38 const base::FilePath& local_install_dir,
39 const base::FilePath& extension_root) OVERRIDE {
40 file_util::UninstallExtension(local_install_dir, id);
41 }
42
43 private:
44 friend struct DefaultSingletonTraits<ExtensionAssetsManagerImpl>;
45
46 ExtensionAssetsManagerImpl() {}
47 virtual ~ExtensionAssetsManagerImpl() {}
48
49 DISALLOW_COPY_AND_ASSIGN(ExtensionAssetsManagerImpl);
50 };
51
52 } // namespace
53
54 // static
55 ExtensionAssetsManager* ExtensionAssetsManager::GetInstance() {
56 #if defined(OS_CHROMEOS)
57 return ExtensionAssetsManagerChromeOS::GetInstance();
58 #else
59 // If not Chrome OS, use trivial implementation that doesn't share anything.
60 return ExtensionAssetsManagerImpl::GetInstance();
61 #endif // OS_CHROMEOS
62 }
63
64 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698