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..e0333ef2630905870e4d57817f8c97021c86c7ba 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,15 @@ ChromeAppModeInfo::ChromeAppModeInfo() |
ChromeAppModeInfo::~ChromeAppModeInfo() { |
} |
+base::FilePath GetShortSocketPath(const base::FilePath& full_path) { |
+ std::string short_path; |
+ if (base::Base64Encode(base::SHA1HashString(full_path.value()), |
tapted
2013/11/21 11:12:05
under what cases can it return false?
I got curio
jackhou1
2013/11/22 00:20:40
Done.
|
+ &short_path)) { |
+ ReplaceChars(short_path, "/", "_", &short_path); |
tapted
2013/11/21 11:12:05
I think short_path will have a guaranteed length -
jackhou1
2013/11/22 00:20:40
Done.
|
+ return base::FilePath("/tmp").Append(short_path); |
+ } |
+ |
+ return base::FilePath(); |
+} |
+ |
} // namespace app_mode |