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

Unified Diff: base/file_version_info_mac.mm

Issue 1560027: Refactor FileVersionInfo into an interface with platform implementations. (Closed)
Patch Set: comments Created 10 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_version_info_mac.h ('k') | base/file_version_info_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_version_info_mac.mm
diff --git a/base/file_version_info_mac.mm b/base/file_version_info_mac.mm
index c1395dffa228739f1763b25d4e263a4e2beafcdf..2218226e4466399693f6aaaeb4e89f245e2fd785 100644
--- a/base/file_version_info_mac.mm
+++ b/base/file_version_info_mac.mm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/file_version_info.h"
+#include "base/file_version_info_mac.h"
#import <Cocoa/Cocoa.h>
@@ -11,11 +11,11 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-FileVersionInfo::FileVersionInfo(NSBundle *bundle) : bundle_(bundle) {
+FileVersionInfoMac::FileVersionInfoMac(NSBundle *bundle) : bundle_(bundle) {
[bundle_ retain];
}
-FileVersionInfo::~FileVersionInfo() {
+FileVersionInfoMac::~FileVersionInfoMac() {
[bundle_ release];
}
@@ -24,7 +24,7 @@ FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
// TODO(erikkay): this should really use bundleForClass, but we don't have
// a class to hang onto yet.
NSBundle* bundle = [NSBundle mainBundle];
- return new FileVersionInfo(bundle);
+ return new FileVersionInfoMac(bundle);
}
// static
@@ -33,77 +33,77 @@ FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
NSString* path = [NSString stringWithCString:
reinterpret_cast<const char*>(file_path.c_str())
encoding:NSUTF32StringEncoding];
- return new FileVersionInfo([NSBundle bundleWithPath:path]);
+ return new FileVersionInfoMac([NSBundle bundleWithPath:path]);
}
// static
FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
const FilePath& file_path) {
NSString* path = [NSString stringWithUTF8String:file_path.value().c_str()];
- return new FileVersionInfo([NSBundle bundleWithPath:path]);
+ return new FileVersionInfoMac([NSBundle bundleWithPath:path]);
}
-std::wstring FileVersionInfo::company_name() {
+std::wstring FileVersionInfoMac::company_name() {
return std::wstring();
}
-std::wstring FileVersionInfo::company_short_name() {
+std::wstring FileVersionInfoMac::company_short_name() {
return std::wstring();
}
-std::wstring FileVersionInfo::internal_name() {
+std::wstring FileVersionInfoMac::internal_name() {
return std::wstring();
}
-std::wstring FileVersionInfo::product_name() {
+std::wstring FileVersionInfoMac::product_name() {
return GetStringValue(L"CFBundleName");
}
-std::wstring FileVersionInfo::product_short_name() {
+std::wstring FileVersionInfoMac::product_short_name() {
return GetStringValue(L"CFBundleName");
}
-std::wstring FileVersionInfo::comments() {
+std::wstring FileVersionInfoMac::comments() {
return std::wstring();
}
-std::wstring FileVersionInfo::legal_copyright() {
+std::wstring FileVersionInfoMac::legal_copyright() {
return GetStringValue(L"CFBundleGetInfoString");
}
-std::wstring FileVersionInfo::product_version() {
+std::wstring FileVersionInfoMac::product_version() {
return GetStringValue(L"CFBundleShortVersionString");
}
-std::wstring FileVersionInfo::file_description() {
+std::wstring FileVersionInfoMac::file_description() {
return std::wstring();
}
-std::wstring FileVersionInfo::legal_trademarks() {
+std::wstring FileVersionInfoMac::legal_trademarks() {
return std::wstring();
}
-std::wstring FileVersionInfo::private_build() {
+std::wstring FileVersionInfoMac::private_build() {
return std::wstring();
}
-std::wstring FileVersionInfo::file_version() {
+std::wstring FileVersionInfoMac::file_version() {
return product_version();
}
-std::wstring FileVersionInfo::original_filename() {
+std::wstring FileVersionInfoMac::original_filename() {
return GetStringValue(L"CFBundleName");
}
-std::wstring FileVersionInfo::special_build() {
+std::wstring FileVersionInfoMac::special_build() {
return std::wstring();
}
-std::wstring FileVersionInfo::last_change() {
+std::wstring FileVersionInfoMac::last_change() {
return GetStringValue(L"SVNRevision");
}
-bool FileVersionInfo::is_official_build() {
+bool FileVersionInfoMac::is_official_build() {
#if defined (GOOGLE_CHROME_BUILD)
return true;
#else
@@ -111,7 +111,8 @@ bool FileVersionInfo::is_official_build() {
#endif
}
-bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) {
+bool FileVersionInfoMac::GetValue(const wchar_t* name,
+ std::wstring* value_str) {
if (bundle_) {
NSString* value = [bundle_ objectForInfoDictionaryKey:
[NSString stringWithUTF8String:WideToUTF8(name).c_str()]];
@@ -124,7 +125,7 @@ bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) {
return false;
}
-std::wstring FileVersionInfo::GetStringValue(const wchar_t* name) {
+std::wstring FileVersionInfoMac::GetStringValue(const wchar_t* name) {
std::wstring str;
if (GetValue(name, &str))
return str;
« no previous file with comments | « base/file_version_info_mac.h ('k') | base/file_version_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698