Chromium Code Reviews| 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& full_path) { | |
| 48 std::string short_path; | |
| 49 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.
| |
| 50 &short_path)) { | |
| 51 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.
| |
| 52 return base::FilePath("/tmp").Append(short_path); | |
| 53 } | |
| 54 | |
| 55 return base::FilePath(); | |
| 56 } | |
| 57 | |
| 43 } // namespace app_mode | 58 } // namespace app_mode |
| OLD | NEW |