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 "base/file_version_info_mac.h" | 5 #include "base/file_version_info_mac.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 return base::string16(); | 55 return base::string16(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 base::string16 FileVersionInfoMac::legal_copyright() { | 58 base::string16 FileVersionInfoMac::legal_copyright() { |
| 59 return GetString16Value(CFSTR("CFBundleGetInfoString")); | 59 return GetString16Value(CFSTR("CFBundleGetInfoString")); |
| 60 } | 60 } |
| 61 | 61 |
| 62 base::string16 FileVersionInfoMac::product_version() { | 62 base::string16 FileVersionInfoMac::product_version() { |
| 63 // On OS X, CFBundleVersion is used by LaunchServices, and must follow | 63 // On OS X, CFBundleVersion is used by LaunchServices, and must follow |
| 64 // specific formatting rules, so the four-part Chrome version is in | 64 // specific formatting rules, so the four-part Chrome version is in |
| 65 // CFBundleShortVersionString. On iOS, however, CFBundleVersion can be the | 65 // CFBundleShortVersionString. On iOS, both have a policy-enfoced limit |
| 66 // full version, but CFBundleShortVersionString has a policy-enfoced limit | 66 // of three version components, so the full version is stored in a custom |
| 67 // of three version components. | 67 // key (CrBundleVersion) falling back to CFBundleVersion if not present. |
| 68 #if defined(OS_IOS) | 68 #if defined(OS_IOS) |
| 69 base::string16 version(GetString16Value(CFSTR("CrBundleVersion"))); | |
|
rohitrao (ping after 24h)
2014/09/05 17:01:50
We can use whatever key we want without worrying a
stuartmorgan
2014/09/05 17:15:09
I can't imagine Apple would start using Cr as a pr
| |
| 70 if (version.length() > 0) | |
| 71 return version; | |
| 69 return GetString16Value(CFSTR("CFBundleVersion")); | 72 return GetString16Value(CFSTR("CFBundleVersion")); |
|
rohitrao (ping after 24h)
2014/09/05 17:01:50
Do you intend to remove the fallback code eventual
stuartmorgan
2014/09/05 17:15:09
Since this is in base/ I wasn't planning on it. Th
stuartmorgan
2014/09/05 17:24:54
Also, the fallback should make life easier for tes
| |
| 70 #else | 73 #else |
| 71 return GetString16Value(CFSTR("CFBundleShortVersionString")); | 74 return GetString16Value(CFSTR("CFBundleShortVersionString")); |
| 72 #endif // defined(OS_IOS) | 75 #endif // defined(OS_IOS) |
| 73 } | 76 } |
| 74 | 77 |
| 75 base::string16 FileVersionInfoMac::file_description() { | 78 base::string16 FileVersionInfoMac::file_description() { |
| 76 return base::string16(); | 79 return base::string16(); |
| 77 } | 80 } |
| 78 | 81 |
| 79 base::string16 FileVersionInfoMac::legal_trademarks() { | 82 base::string16 FileVersionInfoMac::legal_trademarks() { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 base::string16 FileVersionInfoMac::GetString16Value(CFStringRef name) { | 114 base::string16 FileVersionInfoMac::GetString16Value(CFStringRef name) { |
| 112 if (bundle_) { | 115 if (bundle_) { |
| 113 NSString *ns_name = base::mac::CFToNSCast(name); | 116 NSString *ns_name = base::mac::CFToNSCast(name); |
| 114 NSString* value = [bundle_ objectForInfoDictionaryKey:ns_name]; | 117 NSString* value = [bundle_ objectForInfoDictionaryKey:ns_name]; |
| 115 if (value) { | 118 if (value) { |
| 116 return base::SysNSStringToUTF16(value); | 119 return base::SysNSStringToUTF16(value); |
| 117 } | 120 } |
| 118 } | 121 } |
| 119 return base::string16(); | 122 return base::string16(); |
| 120 } | 123 } |
| OLD | NEW |