OLD | NEW |
---|---|
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 "chrome/common/mac/app_mode_common.h" | 5 #include "chrome/common/mac/app_mode_common.h" |
6 | 6 |
7 #include "base/base64.h" | |
8 #include "base/sha1.h" | |
9 #include "base/strings/string_util.h" | |
10 | |
7 namespace app_mode { | 11 namespace app_mode { |
8 | 12 |
9 const char kAppShimSocketName[] = "App Shim Socket"; | 13 const char kAppShimSocketName[] = "App Shim Socket"; |
10 | 14 |
11 const char kAppListModeId[] = "app_list"; | 15 const char kAppListModeId[] = "app_list"; |
12 | 16 |
13 const char kLaunchedByChromeProcessId[] = "launched-by-chrome-process-id"; | 17 const char kLaunchedByChromeProcessId[] = "launched-by-chrome-process-id"; |
14 | 18 |
15 NSString* const kCFBundleDisplayNameKey = @"CFBundleDisplayName"; | 19 NSString* const kCFBundleDisplayNameKey = @"CFBundleDisplayName"; |
16 NSString* const kLSHasLocalizedDisplayNameKey = @"LSHasLocalizedDisplayName"; | 20 NSString* const kLSHasLocalizedDisplayNameKey = @"LSHasLocalizedDisplayName"; |
(...skipping 16 matching lines...) Expand all Loading... | |
33 ChromeAppModeInfo::ChromeAppModeInfo() | 37 ChromeAppModeInfo::ChromeAppModeInfo() |
34 : major_version(0), | 38 : major_version(0), |
35 minor_version(0), | 39 minor_version(0), |
36 argc(0), | 40 argc(0), |
37 argv(0) { | 41 argv(0) { |
38 } | 42 } |
39 | 43 |
40 ChromeAppModeInfo::~ChromeAppModeInfo() { | 44 ChromeAppModeInfo::~ChromeAppModeInfo() { |
41 } | 45 } |
42 | 46 |
47 base::FilePath GetShortSocketPath(const base::FilePath& user_data_dir) { | |
48 std::string udd_hash; | |
49 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
| |
50 &udd_hash)) { | |
51 base::ReplaceChars(udd_hash, "/", "_", &udd_hash); | |
52 DCHECK_EQ(28u, udd_hash.length()); | |
53 return base::FilePath("/tmp") | |
54 .Append("chrome-" + udd_hash) | |
55 .Append(kAppShimSocketName); | |
56 } | |
57 | |
58 NOTREACHED(); | |
59 return base::FilePath(); | |
60 } | |
61 | |
43 } // namespace app_mode | 62 } // namespace app_mode |
OLD | NEW |