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

Side by Side Diff: services/file/user_id_map.cc

Issue 2398783002: Rename a bunch of Mojo Application stuff to reference Services. (Closed)
Patch Set: . Created 4 years, 2 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
« no previous file with comments | « services/file/user_id_map.h ('k') | services/navigation/content_client/browser_main_parts.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/file/user_id_map.h" 5 #include "services/file/user_id_map.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 10
11 namespace file { 11 namespace file {
12 12
13 namespace { 13 namespace {
14 base::LazyInstance<std::map<std::string, base::FilePath>> 14 base::LazyInstance<std::map<std::string, base::FilePath>>
15 g_user_id_to_data_dir = LAZY_INSTANCE_INITIALIZER; 15 g_user_id_to_data_dir = LAZY_INSTANCE_INITIALIZER;
16 } // namespace 16 } // namespace
17 17
18 void AssociateShellUserIdWithUserDir(const std::string& user_id, 18 void AssociateServiceUserIdWithUserDir(const std::string& user_id,
19 const base::FilePath& user_dir) { 19 const base::FilePath& user_dir) {
20 g_user_id_to_data_dir.Get()[user_id] = user_dir; 20 g_user_id_to_data_dir.Get()[user_id] = user_dir;
21 } 21 }
22 22
23 void ForgetShellUserIdUserDirAssociation(const std::string& user_id) { 23 void ForgetServiceUserIdUserDirAssociation(const std::string& user_id) {
24 auto it = g_user_id_to_data_dir.Get().find(user_id); 24 auto it = g_user_id_to_data_dir.Get().find(user_id);
25 if (it != g_user_id_to_data_dir.Get().end()) 25 if (it != g_user_id_to_data_dir.Get().end())
26 g_user_id_to_data_dir.Get().erase(it); 26 g_user_id_to_data_dir.Get().erase(it);
27 } 27 }
28 28
29 base::FilePath GetUserDirForUserId(const std::string& user_id) { 29 base::FilePath GetUserDirForUserId(const std::string& user_id) {
30 auto it = g_user_id_to_data_dir.Get().find(user_id); 30 auto it = g_user_id_to_data_dir.Get().find(user_id);
31 DCHECK(it != g_user_id_to_data_dir.Get().end()); 31 DCHECK(it != g_user_id_to_data_dir.Get().end());
32 return it->second; 32 return it->second;
33 } 33 }
34 34
35 } // namespace file 35 } // namespace file
OLDNEW
« no previous file with comments | « services/file/user_id_map.h ('k') | services/navigation/content_client/browser_main_parts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698