OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/mac/mac_util.h" |
11 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
12 #include "base/mac_util.h" | |
13 | 13 |
14 FileVersionInfoMac::FileVersionInfoMac(NSBundle *bundle) : bundle_(bundle) { | 14 FileVersionInfoMac::FileVersionInfoMac(NSBundle *bundle) : bundle_(bundle) { |
15 } | 15 } |
16 | 16 |
17 // static | 17 // static |
18 FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() { | 18 FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() { |
19 return CreateFileVersionInfo(mac_util::MainAppBundlePath()); | 19 return CreateFileVersionInfo(base::mac::MainAppBundlePath()); |
20 } | 20 } |
21 | 21 |
22 // static | 22 // static |
23 FileVersionInfo* FileVersionInfo::CreateFileVersionInfo( | 23 FileVersionInfo* FileVersionInfo::CreateFileVersionInfo( |
24 const FilePath& file_path) { | 24 const FilePath& file_path) { |
25 NSString* path = base::SysUTF8ToNSString(file_path.value()); | 25 NSString* path = base::SysUTF8ToNSString(file_path.value()); |
26 NSBundle* bundle = [NSBundle bundleWithPath:path]; | 26 NSBundle* bundle = [NSBundle bundleWithPath:path]; |
27 return new FileVersionInfoMac(bundle); | 27 return new FileVersionInfoMac(bundle); |
28 } | 28 } |
29 | 29 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 bool FileVersionInfoMac::is_official_build() { | 90 bool FileVersionInfoMac::is_official_build() { |
91 #if defined (GOOGLE_CHROME_BUILD) | 91 #if defined (GOOGLE_CHROME_BUILD) |
92 return true; | 92 return true; |
93 #else | 93 #else |
94 return false; | 94 return false; |
95 #endif | 95 #endif |
96 } | 96 } |
97 | 97 |
98 string16 FileVersionInfoMac::GetString16Value(CFStringRef name) { | 98 string16 FileVersionInfoMac::GetString16Value(CFStringRef name) { |
99 if (bundle_) { | 99 if (bundle_) { |
100 NSString *ns_name = mac_util::CFToNSCast(name); | 100 NSString *ns_name = base::mac::CFToNSCast(name); |
101 NSString* value = [bundle_ objectForInfoDictionaryKey:ns_name]; | 101 NSString* value = [bundle_ objectForInfoDictionaryKey:ns_name]; |
102 if (value) { | 102 if (value) { |
103 return base::SysNSStringToUTF16(value); | 103 return base::SysNSStringToUTF16(value); |
104 } | 104 } |
105 } | 105 } |
106 return string16(); | 106 return string16(); |
107 } | 107 } |
OLD | NEW |