Index: chrome/common/mac/app_mode_common.mm |
diff --git a/chrome/common/mac/app_mode_common.mm b/chrome/common/mac/app_mode_common.mm |
index 317dec3b6331e32aa8ae332f02d4c4d9b74708f8..35ec523443cc2c6e769ac78bfb9ac11d5a52b9f6 100644 |
--- a/chrome/common/mac/app_mode_common.mm |
+++ b/chrome/common/mac/app_mode_common.mm |
@@ -4,6 +4,10 @@ |
#include "chrome/common/mac/app_mode_common.h" |
+#include "base/base64.h" |
+#include "base/sha1.h" |
+#include "base/strings/string_util.h" |
+ |
namespace app_mode { |
const char kAppShimSocketName[] = "App Shim Socket"; |
@@ -40,4 +44,19 @@ ChromeAppModeInfo::ChromeAppModeInfo() |
ChromeAppModeInfo::~ChromeAppModeInfo() { |
} |
+base::FilePath GetShortSocketPath(const base::FilePath& user_data_dir) { |
+ std::string udd_hash; |
+ if (base::Base64Encode(base::SHA1HashString(user_data_dir.value()), |
palmer
2013/12/10 20:04:23
A cryptographic hash of a predictable input is sti
jackhou1
2014/01/06 05:29:52
The new implementation no longer requires it to be
|
+ &udd_hash)) { |
+ base::ReplaceChars(udd_hash, "/", "_", &udd_hash); |
+ DCHECK_EQ(28u, udd_hash.length()); |
+ return base::FilePath("/tmp") |
+ .Append("chrome-" + udd_hash) |
+ .Append(kAppShimSocketName); |
+ } |
+ |
+ NOTREACHED(); |
+ return base::FilePath(); |
+} |
+ |
} // namespace app_mode |