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/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/mac/bundle_locations.h" | 11 #include "base/mac/bundle_locations.h" |
12 #include "base/mac/foundation_util.h" | 12 #include "base/mac/foundation_util.h" |
13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
14 | 14 |
15 FileVersionInfoMac::FileVersionInfoMac(NSBundle *bundle) | 15 FileVersionInfoMac::FileVersionInfoMac(NSBundle *bundle) |
16 : bundle_([bundle retain]) { | 16 : bundle_([bundle retain]) { |
17 } | 17 } |
18 | 18 |
19 FileVersionInfoMac::~FileVersionInfoMac() {} | 19 FileVersionInfoMac::~FileVersionInfoMac() {} |
20 | 20 |
21 // static | 21 // static |
22 FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() { | 22 FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() { |
23 return CreateFileVersionInfo(base::mac::FrameworkBundlePath()); | 23 return CreateFileVersionInfo(base::mac::FrameworkBundlePath()); |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 FileVersionInfo* FileVersionInfo::CreateFileVersionInfo( | 27 FileVersionInfo* FileVersionInfo::CreateFileVersionInfo( |
28 const FilePath& file_path) { | 28 const base::FilePath& file_path) { |
29 NSString* path = base::SysUTF8ToNSString(file_path.value()); | 29 NSString* path = base::SysUTF8ToNSString(file_path.value()); |
30 NSBundle* bundle = [NSBundle bundleWithPath:path]; | 30 NSBundle* bundle = [NSBundle bundleWithPath:path]; |
31 return new FileVersionInfoMac(bundle); | 31 return new FileVersionInfoMac(bundle); |
32 } | 32 } |
33 | 33 |
34 string16 FileVersionInfoMac::company_name() { | 34 string16 FileVersionInfoMac::company_name() { |
35 return string16(); | 35 return string16(); |
36 } | 36 } |
37 | 37 |
38 string16 FileVersionInfoMac::company_short_name() { | 38 string16 FileVersionInfoMac::company_short_name() { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 string16 FileVersionInfoMac::GetString16Value(CFStringRef name) { | 111 string16 FileVersionInfoMac::GetString16Value(CFStringRef name) { |
112 if (bundle_) { | 112 if (bundle_) { |
113 NSString *ns_name = base::mac::CFToNSCast(name); | 113 NSString *ns_name = base::mac::CFToNSCast(name); |
114 NSString* value = [bundle_ objectForInfoDictionaryKey:ns_name]; | 114 NSString* value = [bundle_ objectForInfoDictionaryKey:ns_name]; |
115 if (value) { | 115 if (value) { |
116 return base::SysNSStringToUTF16(value); | 116 return base::SysNSStringToUTF16(value); |
117 } | 117 } |
118 } | 118 } |
119 return string16(); | 119 return string16(); |
120 } | 120 } |
OLD | NEW |