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

Side by Side Diff: chrome/browser/extensions/extension_assets_manager_chromeos.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_chromeos.h" 5 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 struct PendingInstallInfo { 49 struct PendingInstallInfo {
50 base::FilePath unpacked_extension_root; 50 base::FilePath unpacked_extension_root;
51 base::FilePath local_install_dir; 51 base::FilePath local_install_dir;
52 Profile* profile; 52 Profile* profile;
53 ExtensionAssetsManager::InstallExtensionCallback callback; 53 ExtensionAssetsManager::InstallExtensionCallback callback;
54 }; 54 };
55 typedef std::vector<PendingInstallInfo> PendingInstallList; 55 typedef std::vector<PendingInstallInfo> PendingInstallList;
56 56
57 static ExtensionAssetsManagerHelper* GetInstance() { 57 static ExtensionAssetsManagerHelper* GetInstance() {
58 DCHECK_CURRENTLY_ON(BrowserThread::UI); 58 DCHECK_CURRENTLY_ON(BrowserThread::UI);
59 return Singleton<ExtensionAssetsManagerHelper>::get(); 59 return base::Singleton<ExtensionAssetsManagerHelper>::get();
60 } 60 }
61 61
62 // Remember that shared install is in progress. Return true if there is no 62 // Remember that shared install is in progress. Return true if there is no
63 // other installs for given id and version. 63 // other installs for given id and version.
64 bool RecordSharedInstall( 64 bool RecordSharedInstall(
65 const std::string& id, 65 const std::string& id,
66 const std::string& version, 66 const std::string& version,
67 const base::FilePath& unpacked_extension_root, 67 const base::FilePath& unpacked_extension_root,
68 const base::FilePath& local_install_dir, 68 const base::FilePath& local_install_dir,
69 Profile* profile, 69 Profile* profile,
(...skipping 17 matching lines...) Expand all
87 const std::string& version, 87 const std::string& version,
88 PendingInstallList* pending_installs) { 88 PendingInstallList* pending_installs) {
89 InstallQueue::iterator it = install_queue_.find( 89 InstallQueue::iterator it = install_queue_.find(
90 InstallQueue::key_type(id, version)); 90 InstallQueue::key_type(id, version));
91 DCHECK(it != install_queue_.end()); 91 DCHECK(it != install_queue_.end());
92 pending_installs->swap(it->second); 92 pending_installs->swap(it->second);
93 install_queue_.erase(it); 93 install_queue_.erase(it);
94 } 94 }
95 95
96 private: 96 private:
97 friend struct DefaultSingletonTraits<ExtensionAssetsManagerHelper>; 97 friend struct base::DefaultSingletonTraits<ExtensionAssetsManagerHelper>;
98 98
99 ExtensionAssetsManagerHelper() {} 99 ExtensionAssetsManagerHelper() {}
100 ~ExtensionAssetsManagerHelper() {} 100 ~ExtensionAssetsManagerHelper() {}
101 101
102 // Extension ID + version pair. 102 // Extension ID + version pair.
103 typedef std::pair<std::string, std::string> InstallItem; 103 typedef std::pair<std::string, std::string> InstallItem;
104 104
105 // Queue of pending installs in progress. 105 // Queue of pending installs in progress.
106 typedef std::map<InstallItem, std::vector<PendingInstallInfo> > InstallQueue; 106 typedef std::map<InstallItem, std::vector<PendingInstallInfo> > InstallQueue;
107 107
(...skipping 15 matching lines...) Expand all
123 123
124 ExtensionAssetsManagerChromeOS::~ExtensionAssetsManagerChromeOS() { 124 ExtensionAssetsManagerChromeOS::~ExtensionAssetsManagerChromeOS() {
125 if (g_shared_install_dir_override) { 125 if (g_shared_install_dir_override) {
126 delete g_shared_install_dir_override; 126 delete g_shared_install_dir_override;
127 g_shared_install_dir_override = NULL; 127 g_shared_install_dir_override = NULL;
128 } 128 }
129 } 129 }
130 130
131 // static 131 // static
132 ExtensionAssetsManagerChromeOS* ExtensionAssetsManagerChromeOS::GetInstance() { 132 ExtensionAssetsManagerChromeOS* ExtensionAssetsManagerChromeOS::GetInstance() {
133 return Singleton<ExtensionAssetsManagerChromeOS>::get(); 133 return base::Singleton<ExtensionAssetsManagerChromeOS>::get();
134 } 134 }
135 135
136 // static 136 // static
137 void ExtensionAssetsManagerChromeOS::RegisterPrefs( 137 void ExtensionAssetsManagerChromeOS::RegisterPrefs(
138 PrefRegistrySimple* registry) { 138 PrefRegistrySimple* registry) {
139 registry->RegisterDictionaryPref(kSharedExtensions); 139 registry->RegisterDictionaryPref(kSharedExtensions);
140 } 140 }
141 141
142 void ExtensionAssetsManagerChromeOS::InstallExtension( 142 void ExtensionAssetsManagerChromeOS::InstallExtension(
143 const Extension* extension, 143 const Extension* extension,
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 std::make_pair(id, base::FilePath(shared_path))); 566 std::make_pair(id, base::FilePath(shared_path)));
567 } else { 567 } else {
568 extension_info->RemoveWithoutPathExpansion(*it, NULL); 568 extension_info->RemoveWithoutPathExpansion(*it, NULL);
569 } 569 }
570 } 570 }
571 571
572 return true; 572 return true;
573 } 573 }
574 574
575 } // namespace extensions 575 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698