Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: base/file_version_info_mac.mm

Issue 243102: Convert base dependencies to use sys_string_conversions instead of the ICU... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/file_util_unittest.cc ('k') | base/i18n/icu_string_conversions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h"
12 13
13 FileVersionInfo::FileVersionInfo(NSBundle *bundle) : bundle_(bundle) { 14 FileVersionInfo::FileVersionInfo(NSBundle *bundle) : bundle_(bundle) {
14 [bundle_ retain]; 15 [bundle_ retain];
15 } 16 }
16 17
17 FileVersionInfo::~FileVersionInfo() { 18 FileVersionInfo::~FileVersionInfo() {
18 [bundle_ release]; 19 [bundle_ release];
19 } 20 }
20 21
21 // static 22 // static
(...skipping 14 matching lines...) Expand all
36 } 37 }
37 38
38 // static 39 // static
39 FileVersionInfo* FileVersionInfo::CreateFileVersionInfo( 40 FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
40 const FilePath& file_path) { 41 const FilePath& file_path) {
41 NSString* path = [NSString stringWithUTF8String:file_path.value().c_str()]; 42 NSString* path = [NSString stringWithUTF8String:file_path.value().c_str()];
42 return new FileVersionInfo([NSBundle bundleWithPath:path]); 43 return new FileVersionInfo([NSBundle bundleWithPath:path]);
43 } 44 }
44 45
45 std::wstring FileVersionInfo::company_name() { 46 std::wstring FileVersionInfo::company_name() {
46 return L""; 47 return std::wstring();
47 } 48 }
48 49
49 std::wstring FileVersionInfo::company_short_name() { 50 std::wstring FileVersionInfo::company_short_name() {
50 return L""; 51 return std::wstring();
51 } 52 }
52 53
53 std::wstring FileVersionInfo::internal_name() { 54 std::wstring FileVersionInfo::internal_name() {
54 return L""; 55 return std::wstring();
55 } 56 }
56 57
57 std::wstring FileVersionInfo::product_name() { 58 std::wstring FileVersionInfo::product_name() {
58 return GetStringValue(L"CFBundleName"); 59 return GetStringValue(L"CFBundleName");
59 } 60 }
60 61
61 std::wstring FileVersionInfo::product_short_name() { 62 std::wstring FileVersionInfo::product_short_name() {
62 return GetStringValue(L"CFBundleName"); 63 return GetStringValue(L"CFBundleName");
63 } 64 }
64 65
65 std::wstring FileVersionInfo::comments() { 66 std::wstring FileVersionInfo::comments() {
66 return L""; 67 return std::wstring();
67 } 68 }
68 69
69 std::wstring FileVersionInfo::legal_copyright() { 70 std::wstring FileVersionInfo::legal_copyright() {
70 return GetStringValue(L"CFBundleGetInfoString"); 71 return GetStringValue(L"CFBundleGetInfoString");
71 } 72 }
72 73
73 std::wstring FileVersionInfo::product_version() { 74 std::wstring FileVersionInfo::product_version() {
74 return GetStringValue(L"CFBundleShortVersionString"); 75 return GetStringValue(L"CFBundleShortVersionString");
75 } 76 }
76 77
77 std::wstring FileVersionInfo::file_description() { 78 std::wstring FileVersionInfo::file_description() {
78 return L""; 79 return std::wstring();
79 } 80 }
80 81
81 std::wstring FileVersionInfo::legal_trademarks() { 82 std::wstring FileVersionInfo::legal_trademarks() {
82 return L""; 83 return std::wstring();
83 } 84 }
84 85
85 std::wstring FileVersionInfo::private_build() { 86 std::wstring FileVersionInfo::private_build() {
86 return L""; 87 return std::wstring();
87 } 88 }
88 89
89 std::wstring FileVersionInfo::file_version() { 90 std::wstring FileVersionInfo::file_version() {
90 // CFBundleVersion has limitations that may not be honored by a 91 // CFBundleVersion has limitations that may not be honored by a
91 // proper Chromium version number, so try KSVersion first. 92 // proper Chromium version number, so try KSVersion first.
92 std::wstring version = GetStringValue(L"KSVersion"); 93 std::wstring version = GetStringValue(L"KSVersion");
93 if (version == L"") 94 if (version.empty())
94 version = GetStringValue(L"CFBundleVersion"); 95 version = GetStringValue(L"CFBundleVersion");
95 return version; 96 return version;
96 } 97 }
97 98
98 std::wstring FileVersionInfo::original_filename() { 99 std::wstring FileVersionInfo::original_filename() {
99 return GetStringValue(L"CFBundleName"); 100 return GetStringValue(L"CFBundleName");
100 } 101 }
101 102
102 std::wstring FileVersionInfo::special_build() { 103 std::wstring FileVersionInfo::special_build() {
103 return L""; 104 return std::wstring();
104 } 105 }
105 106
106 std::wstring FileVersionInfo::last_change() { 107 std::wstring FileVersionInfo::last_change() {
107 return GetStringValue(L"SVNRevision"); 108 return GetStringValue(L"SVNRevision");
108 } 109 }
109 110
110 bool FileVersionInfo::is_official_build() { 111 bool FileVersionInfo::is_official_build() {
111 #if defined (GOOGLE_CHROME_BUILD) 112 #if defined (GOOGLE_CHROME_BUILD)
112 return true; 113 return true;
113 #else 114 #else
(...skipping 11 matching lines...) Expand all
125 return true; 126 return true;
126 } 127 }
127 } 128 }
128 return false; 129 return false;
129 } 130 }
130 131
131 std::wstring FileVersionInfo::GetStringValue(const wchar_t* name) { 132 std::wstring FileVersionInfo::GetStringValue(const wchar_t* name) {
132 std::wstring str; 133 std::wstring str;
133 if (GetValue(name, &str)) 134 if (GetValue(name, &str))
134 return str; 135 return str;
135 return L""; 136 return std::wstring();
136 } 137 }
OLDNEW
« no previous file with comments | « base/file_util_unittest.cc ('k') | base/i18n/icu_string_conversions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698