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

Side by Side Diff: chrome/browser/extensions/extension_assets_manager.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_assets_manager.h" 5 #include "chrome/browser/extensions/extension_assets_manager.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "extensions/common/extension.h" 8 #include "extensions/common/extension.h"
9 #include "extensions/common/file_util.h" 9 #include "extensions/common/file_util.h"
10 10
11 #if defined(OS_CHROMEOS) 11 #if defined(OS_CHROMEOS)
12 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h" 12 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h"
13 #endif 13 #endif
14 14
15 namespace extensions { 15 namespace extensions {
16 namespace { 16 namespace {
17 17
18 class ExtensionAssetsManagerImpl : public ExtensionAssetsManager { 18 class ExtensionAssetsManagerImpl : public ExtensionAssetsManager {
19 public: 19 public:
20 static ExtensionAssetsManagerImpl* GetInstance() { 20 static ExtensionAssetsManagerImpl* GetInstance() {
21 return Singleton<ExtensionAssetsManagerImpl>::get(); 21 return base::Singleton<ExtensionAssetsManagerImpl>::get();
22 } 22 }
23 23
24 // Override from ExtensionAssetsManager. 24 // Override from ExtensionAssetsManager.
25 void InstallExtension(const Extension* extension, 25 void InstallExtension(const Extension* extension,
26 const base::FilePath& unpacked_extension_root, 26 const base::FilePath& unpacked_extension_root,
27 const base::FilePath& local_install_dir, 27 const base::FilePath& local_install_dir,
28 Profile* profile, 28 Profile* profile,
29 InstallExtensionCallback callback) override { 29 InstallExtensionCallback callback) override {
30 callback.Run(file_util::InstallExtension( 30 callback.Run(file_util::InstallExtension(
31 unpacked_extension_root, 31 unpacked_extension_root,
32 extension->id(), 32 extension->id(),
33 extension->VersionString(), 33 extension->VersionString(),
34 local_install_dir)); 34 local_install_dir));
35 } 35 }
36 36
37 void UninstallExtension(const std::string& id, 37 void UninstallExtension(const std::string& id,
38 Profile* profile, 38 Profile* profile,
39 const base::FilePath& local_install_dir, 39 const base::FilePath& local_install_dir,
40 const base::FilePath& extension_root) override { 40 const base::FilePath& extension_root) override {
41 file_util::UninstallExtension(local_install_dir, id); 41 file_util::UninstallExtension(local_install_dir, id);
42 } 42 }
43 43
44 private: 44 private:
45 friend struct DefaultSingletonTraits<ExtensionAssetsManagerImpl>; 45 friend struct base::DefaultSingletonTraits<ExtensionAssetsManagerImpl>;
46 46
47 ExtensionAssetsManagerImpl() {} 47 ExtensionAssetsManagerImpl() {}
48 ~ExtensionAssetsManagerImpl() override {} 48 ~ExtensionAssetsManagerImpl() override {}
49 49
50 DISALLOW_COPY_AND_ASSIGN(ExtensionAssetsManagerImpl); 50 DISALLOW_COPY_AND_ASSIGN(ExtensionAssetsManagerImpl);
51 }; 51 };
52 52
53 } // namespace 53 } // namespace
54 54
55 // static 55 // static
56 ExtensionAssetsManager* ExtensionAssetsManager::GetInstance() { 56 ExtensionAssetsManager* ExtensionAssetsManager::GetInstance() {
57 #if defined(OS_CHROMEOS) 57 #if defined(OS_CHROMEOS)
58 return ExtensionAssetsManagerChromeOS::GetInstance(); 58 return ExtensionAssetsManagerChromeOS::GetInstance();
59 #else 59 #else
60 // If not Chrome OS, use trivial implementation that doesn't share anything. 60 // If not Chrome OS, use trivial implementation that doesn't share anything.
61 return ExtensionAssetsManagerImpl::GetInstance(); 61 return ExtensionAssetsManagerImpl::GetInstance();
62 #endif // OS_CHROMEOS 62 #endif // OS_CHROMEOS
63 } 63 }
64 64
65 } // namespace extensions 65 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_action_manager.cc ('k') | chrome/browser/extensions/extension_assets_manager_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698