| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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.h" | 5 #include "base/file_version_info.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 std::wstring FileVersionInfo::original_filename() { | 97 std::wstring FileVersionInfo::original_filename() { |
| 98 return GetStringValue(L"CFBundleName"); | 98 return GetStringValue(L"CFBundleName"); |
| 99 } | 99 } |
| 100 | 100 |
| 101 std::wstring FileVersionInfo::special_build() { | 101 std::wstring FileVersionInfo::special_build() { |
| 102 return L""; | 102 return L""; |
| 103 } | 103 } |
| 104 | 104 |
| 105 std::wstring FileVersionInfo::last_change() { | 105 std::wstring FileVersionInfo::last_change() { |
| 106 return L""; | 106 return GetStringValue(L"SVNRevision"); |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool FileVersionInfo::is_official_build() { | 109 bool FileVersionInfo::is_official_build() { |
| 110 #if defined (GOOGLE_CHROME_BUILD) |
| 111 return true; |
| 112 #else |
| 110 return false; | 113 return false; |
| 114 #endif |
| 111 } | 115 } |
| 112 | 116 |
| 113 bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) { | 117 bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) { |
| 114 if (bundle_) { | 118 if (bundle_) { |
| 115 NSString* value = [bundle_ objectForInfoDictionaryKey: | 119 NSString* value = [bundle_ objectForInfoDictionaryKey: |
| 116 [NSString stringWithUTF8String:WideToUTF8(name).c_str()]]; | 120 [NSString stringWithUTF8String:WideToUTF8(name).c_str()]]; |
| 117 if (value) { | 121 if (value) { |
| 118 *value_str = reinterpret_cast<const wchar_t*>( | 122 *value_str = reinterpret_cast<const wchar_t*>( |
| 119 [value cStringUsingEncoding:NSUTF32StringEncoding]); | 123 [value cStringUsingEncoding:NSUTF32StringEncoding]); |
| 120 return true; | 124 return true; |
| 121 } | 125 } |
| 122 } | 126 } |
| 123 return false; | 127 return false; |
| 124 } | 128 } |
| 125 | 129 |
| 126 std::wstring FileVersionInfo::GetStringValue(const wchar_t* name) { | 130 std::wstring FileVersionInfo::GetStringValue(const wchar_t* name) { |
| 127 std::wstring str; | 131 std::wstring str; |
| 128 if (GetValue(name, &str)) | 132 if (GetValue(name, &str)) |
| 129 return str; | 133 return str; |
| 130 return L""; | 134 return L""; |
| 131 } | 135 } |
| OLD | NEW |