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

Side by Side Diff: chrome/common/service_process_util.cc

Issue 12314090: Add utf_string_conversions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
« no previous file with comments | « chrome/common/logging_chrome.cc ('k') | chrome/common/service_process_util_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 } // namespace 101 } // namespace
102 102
103 // Return a name that is scoped to this instance of the service process. We 103 // Return a name that is scoped to this instance of the service process. We
104 // use the hash of the user-data-dir as a scoping prefix. We can't use 104 // use the hash of the user-data-dir as a scoping prefix. We can't use
105 // the user-data-dir itself as we have limits on the size of the lock names. 105 // the user-data-dir itself as we have limits on the size of the lock names.
106 std::string GetServiceProcessScopedName(const std::string& append_str) { 106 std::string GetServiceProcessScopedName(const std::string& append_str) {
107 base::FilePath user_data_dir; 107 base::FilePath user_data_dir;
108 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); 108 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
109 #if defined(OS_WIN) 109 #if defined(OS_WIN)
110 std::string user_data_dir_path = WideToUTF8(user_data_dir.value()); 110 std::string user_data_dir_path = base::WideToUTF8(user_data_dir.value());
111 #elif defined(OS_POSIX) 111 #elif defined(OS_POSIX)
112 std::string user_data_dir_path = user_data_dir.value(); 112 std::string user_data_dir_path = user_data_dir.value();
113 #endif // defined(OS_WIN) 113 #endif // defined(OS_WIN)
114 std::string hash = base::SHA1HashString(user_data_dir_path); 114 std::string hash = base::SHA1HashString(user_data_dir_path);
115 std::string hex_hash = base::HexEncode(hash.c_str(), hash.length()); 115 std::string hex_hash = base::HexEncode(hash.c_str(), hash.length());
116 return hex_hash + "." + append_str; 116 return hex_hash + "." + append_str;
117 } 117 }
118 118
119 // Return a name that is scoped to this instance of the service process. We 119 // Return a name that is scoped to this instance of the service process. We
120 // use the user-data-dir and the version as a scoping prefix. 120 // use the user-data-dir and the version as a scoping prefix.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 // The user data directory is the only other flag we currently want to 260 // The user data directory is the only other flag we currently want to
261 // possibly store. 261 // possibly store.
262 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 262 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
263 base::FilePath user_data_dir = 263 base::FilePath user_data_dir =
264 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); 264 browser_command_line.GetSwitchValuePath(switches::kUserDataDir);
265 if (!user_data_dir.empty()) 265 if (!user_data_dir.empty())
266 autorun_command_line_->AppendSwitchPath(switches::kUserDataDir, 266 autorun_command_line_->AppendSwitchPath(switches::kUserDataDir,
267 user_data_dir); 267 user_data_dir);
268 } 268 }
OLDNEW
« no previous file with comments | « chrome/common/logging_chrome.cc ('k') | chrome/common/service_process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698