diff options
26 files changed, 91 insertions, 199 deletions
diff --git a/base/file_version_info.h b/base/file_version_info.h index 19407d2..41a97fa 100644 --- a/base/file_version_info.h +++ b/base/file_version_info.h @@ -24,10 +24,13 @@ class FileVersionInfo { // goes wrong (typically the file does not exit or cannot be opened). The // returned object should be deleted when you are done with it. static FileVersionInfo* CreateFileVersionInfo(const FilePath& file_path); +#endif // OS_WIN || OS_MACOSX + +#if defined(OS_WIN) // This version, taking a wstring, is deprecated and only kept around // until we can fix all callers. static FileVersionInfo* CreateFileVersionInfo(const std::wstring& file_path); -#endif +#endif // OS_WIN // Creates a FileVersionInfo for the current module. Returns NULL in case // of error. The returned object should be deleted when you are done with it. diff --git a/base/file_version_info_mac.h b/base/file_version_info_mac.h index d66c4e6..36cb538 100644 --- a/base/file_version_info_mac.h +++ b/base/file_version_info_mac.h @@ -8,9 +8,8 @@ #include <string> -#include "base/basictypes.h" #include "base/file_version_info.h" -#include "base/scoped_ptr.h" +#include "base/scoped_nsobject.h" #ifdef __OBJC__ @class NSBundle; @@ -25,7 +24,6 @@ class NSBundle; class FileVersionInfoMac : public FileVersionInfo { public: explicit FileVersionInfoMac(NSBundle *bundle); - ~FileVersionInfoMac(); // Accessors to the different version properties. // Returns an empty string if the property is not found. @@ -47,14 +45,13 @@ class FileVersionInfoMac : public FileVersionInfo { virtual bool is_official_build(); private: - // Lets you access other properties not covered above. - bool GetValue(const wchar_t* name, std::wstring* value); - // Similar to GetValue but returns a wstring (empty string if the property - // does not exist). - std::wstring GetStringValue(const wchar_t* name); - NSBundle *bundle_; + // Returns a wstring value for a property name. + // Returns the empty string if the property does not exist. + std::wstring GetWStringValue(CFStringRef name); + + scoped_nsobject<NSBundle> bundle_; DISALLOW_COPY_AND_ASSIGN(FileVersionInfoMac); }; diff --git a/base/file_version_info_mac.mm b/base/file_version_info_mac.mm index 57be79a..7b1ac54 100644 --- a/base/file_version_info_mac.mm +++ b/base/file_version_info_mac.mm @@ -4,43 +4,33 @@ #include "base/file_version_info_mac.h" -#import <Cocoa/Cocoa.h> +#import <Foundation/Foundation.h> -#include "base/basictypes.h" #include "base/file_path.h" -#include "base/string_util.h" -#include "base/utf_string_conversions.h" +#include "base/logging.h" +#include "base/sys_string_conversions.h" +#include "base/mac_util.h" FileVersionInfoMac::FileVersionInfoMac(NSBundle *bundle) : bundle_(bundle) { - [bundle_ retain]; -} - -FileVersionInfoMac::~FileVersionInfoMac() { - [bundle_ release]; } // static 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 FileVersionInfoMac(bundle); -} - -// static -FileVersionInfo* FileVersionInfo::CreateFileVersionInfo( - const std::wstring& file_path) { - NSString* path = [NSString stringWithCString: - reinterpret_cast<const char*>(file_path.c_str()) - encoding:NSUTF32StringEncoding]; - return new FileVersionInfoMac([NSBundle bundleWithPath:path]); + return CreateFileVersionInfo(mac_util::MainAppBundlePath()); } // static FileVersionInfo* FileVersionInfo::CreateFileVersionInfo( const FilePath& file_path) { - NSString* path = [NSString stringWithUTF8String:file_path.value().c_str()]; - return new FileVersionInfoMac([NSBundle bundleWithPath:path]); + NSString* path = base::SysUTF8ToNSString(file_path.value()); + NSBundle *bundle = [NSBundle bundleWithPath:path]; + NSString *identifier = [bundle bundleIdentifier]; + if (!identifier) { + NOTREACHED() << "Unable to create file version for " << file_path.value(); + return NULL; + } else { + return new FileVersionInfoMac(bundle); + } } std::wstring FileVersionInfoMac::company_name() { @@ -56,11 +46,11 @@ std::wstring FileVersionInfoMac::internal_name() { } std::wstring FileVersionInfoMac::product_name() { - return GetStringValue(L"CFBundleName"); + return GetWStringValue(kCFBundleNameKey); } std::wstring FileVersionInfoMac::product_short_name() { - return GetStringValue(L"CFBundleName"); + return GetWStringValue(kCFBundleNameKey); } std::wstring FileVersionInfoMac::comments() { @@ -68,11 +58,11 @@ std::wstring FileVersionInfoMac::comments() { } std::wstring FileVersionInfoMac::legal_copyright() { - return GetStringValue(L"CFBundleGetInfoString"); + return GetWStringValue(CFSTR("CFBundleGetInfoString")); } std::wstring FileVersionInfoMac::product_version() { - return GetStringValue(L"CFBundleShortVersionString"); + return GetWStringValue(CFSTR("CFBundleShortVersionString")); } std::wstring FileVersionInfoMac::file_description() { @@ -92,7 +82,7 @@ std::wstring FileVersionInfoMac::file_version() { } std::wstring FileVersionInfoMac::original_filename() { - return GetStringValue(L"CFBundleName"); + return GetWStringValue(kCFBundleNameKey); } std::wstring FileVersionInfoMac::special_build() { @@ -100,7 +90,7 @@ std::wstring FileVersionInfoMac::special_build() { } std::wstring FileVersionInfoMac::last_change() { - return GetStringValue(L"SVNRevision"); + return GetWStringValue(CFSTR("SVNRevision")); } bool FileVersionInfoMac::is_official_build() { @@ -111,23 +101,13 @@ bool FileVersionInfoMac::is_official_build() { #endif } -bool FileVersionInfoMac::GetValue(const wchar_t* name, - std::wstring* value_str) { +std::wstring FileVersionInfoMac::GetWStringValue(CFStringRef name) { if (bundle_) { - NSString* value = [bundle_ objectForInfoDictionaryKey: - [NSString stringWithUTF8String:WideToUTF8(name).c_str()]]; + NSString *ns_name = mac_util::CFToNSCast(name); + NSString* value = [bundle_ objectForInfoDictionaryKey:ns_name]; if (value) { - *value_str = reinterpret_cast<const wchar_t*>( - [value cStringUsingEncoding:NSUTF32StringEncoding]); - return true; + return base::SysNSStringToWide(value); } } - return false; -} - -std::wstring FileVersionInfoMac::GetStringValue(const wchar_t* name) { - std::wstring str; - if (GetValue(name, &str)) - return str; return std::wstring(); } diff --git a/chrome/browser/bug_report_util.cc b/chrome/browser/bug_report_util.cc index 28cc685..b89d742 100644 --- a/chrome/browser/bug_report_util.cc +++ b/chrome/browser/bug_report_util.cc @@ -309,13 +309,11 @@ void BugReportUtil::SendReport(Profile* profile, // Add the Chrome version chrome::VersionInfo version_info; - if (version_info.is_valid()) { - std::string chrome_version = version_info.Name() + " - " + - version_info.Version() + - " (" + version_info.LastChange() + ")"; - AddFeedbackData(&feedback_data, std::string(kChromeVersionTag), - chrome_version); - } + std::string chrome_version = version_info.Name() + " - " + + version_info.Version() + + " (" + version_info.LastChange() + ")"; + AddFeedbackData(&feedback_data, std::string(kChromeVersionTag), + chrome_version); // Add OS version (eg, for WinXP SP2: "5.1.2600 Service Pack 2"). std::string os_version = ""; diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index f657fef..0a572f3 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc @@ -117,10 +117,6 @@ class VersionTest : public DiagnosticTest { virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) { chrome::VersionInfo version_info; - if (!version_info.is_valid()) { - RecordFailure(ASCIIToUTF16("No Version")); - return true; - } std::string current_version = version_info.Version(); if (current_version.empty()) { RecordFailure(ASCIIToUTF16("Empty Version")); diff --git a/chrome/browser/dom_ui/gpu_internals_ui.cc b/chrome/browser/dom_ui/gpu_internals_ui.cc index 9b93bfb..9b2b58f 100644 --- a/chrome/browser/dom_ui/gpu_internals_ui.cc +++ b/chrome/browser/dom_ui/gpu_internals_ui.cc @@ -206,23 +206,19 @@ Value* GpuMessageHandler::OnRequestClientInfo(const ListValue* list) { chrome::VersionInfo version_info; - if (!version_info.is_valid()) { - DLOG(ERROR) << "Unable to create chrome::VersionInfo"; - } else { - // We have everything we need to send the right values. - dict->SetString("version", version_info.Version()); - dict->SetString("cl", version_info.LastChange()); - dict->SetString("version_mod", - platform_util::GetVersionStringModifier()); - dict->SetString("official", - l10n_util::GetStringUTF16( - version_info.IsOfficialBuild() ? - IDS_ABOUT_VERSION_OFFICIAL - : IDS_ABOUT_VERSION_UNOFFICIAL)); - - dict->SetString("command_line", - CommandLine::ForCurrentProcess()->command_line_string()); - } + // We have everything we need to send the right values. + dict->SetString("version", version_info.Version()); + dict->SetString("cl", version_info.LastChange()); + dict->SetString("version_mod", + platform_util::GetVersionStringModifier()); + dict->SetString("official", + l10n_util::GetStringUTF16( + version_info.IsOfficialBuild() ? + IDS_ABOUT_VERSION_OFFICIAL + : IDS_ABOUT_VERSION_UNOFFICIAL)); + + dict->SetString("command_line", + CommandLine::ForCurrentProcess()->command_line_string()); return dict; } diff --git a/chrome/browser/dom_ui/net_internals_ui.cc b/chrome/browser/dom_ui/net_internals_ui.cc index f44ac9e..1f81022 100644 --- a/chrome/browser/dom_ui/net_internals_ui.cc +++ b/chrome/browser/dom_ui/net_internals_ui.cc @@ -537,23 +537,19 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( chrome::VersionInfo version_info; - if (!version_info.is_valid()) { - DLOG(ERROR) << "Unable to create chrome::VersionInfo"; - } else { - // We have everything we need to send the right values. - dict->SetString("version", version_info.Version()); - dict->SetString("cl", version_info.LastChange()); - dict->SetString("version_mod", - platform_util::GetVersionStringModifier()); - dict->SetString("official", - l10n_util::GetStringUTF16( - version_info.IsOfficialBuild() ? - IDS_ABOUT_VERSION_OFFICIAL - : IDS_ABOUT_VERSION_UNOFFICIAL)); - - dict->SetString("command_line", - CommandLine::ForCurrentProcess()->command_line_string()); - } + // We have everything we need to send the right values. + dict->SetString("version", version_info.Version()); + dict->SetString("cl", version_info.LastChange()); + dict->SetString("version_mod", + platform_util::GetVersionStringModifier()); + dict->SetString("official", + l10n_util::GetStringUTF16( + version_info.IsOfficialBuild() ? + IDS_ABOUT_VERSION_OFFICIAL + : IDS_ABOUT_VERSION_UNOFFICIAL)); + + dict->SetString("command_line", + CommandLine::ForCurrentProcess()->command_line_string()); CallJavascriptFunction(L"g_browser.receivedClientInfo", dict); diff --git a/chrome/browser/dom_ui/options/about_page_handler.cc b/chrome/browser/dom_ui/options/about_page_handler.cc index 71f994f7..66420be 100644 --- a/chrome/browser/dom_ui/options/about_page_handler.cc +++ b/chrome/browser/dom_ui/options/about_page_handler.cc @@ -143,7 +143,6 @@ void AboutPageHandler::GetLocalizedValues(DictionaryValue* localized_strings) { // browser version chrome::VersionInfo version_info; - DCHECK(version_info.is_valid()); std::string browser_version = version_info.Version(); std::string version_modifier = platform_util::GetVersionStringModifier(); diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index d143052..1ebf65b 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -827,10 +827,8 @@ std::vector<int> ExtensionUpdater::DetermineUpdates( // First determine the browser version if we haven't already. if (!browser_version.get()) { chrome::VersionInfo version_info; - if (version_info.is_valid()) { - browser_version.reset(Version::GetVersionFromString( - version_info.Version())); - } + browser_version.reset(Version::GetVersionFromString( + version_info.Version())); } scoped_ptr<Version> browser_min_version( Version::GetVersionFromString(update->browser_min_version)); diff --git a/chrome/browser/memory_details_mac.cc b/chrome/browser/memory_details_mac.cc index b17d25f..08fced1 100644 --- a/chrome/browser/memory_details_mac.cc +++ b/chrome/browser/memory_details_mac.cc @@ -201,13 +201,8 @@ void MemoryDetails::CollectProcessDataChrome( info.type = ChildProcessInfo::UNKNOWN_PROCESS; chrome::VersionInfo version_info; - if (version_info.is_valid()) { - info.product_name = ASCIIToWide(version_info.Name()); - info.version = ASCIIToWide(version_info.Version()); - } else { - info.product_name = process_data_[CHROME_BROWSER].name; - info.version = L""; - } + info.product_name = ASCIIToWide(version_info.Name()); + info.version = ASCIIToWide(version_info.Version()); // Check if this is one of the child processes whose data we collected // on the IO thread, and if so copy over that data. diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc index 959cebd..a3ea337 100644 --- a/chrome/browser/memory_details_win.cc +++ b/chrome/browser/memory_details_win.cc @@ -121,8 +121,7 @@ void MemoryDetails::CollectProcessData( TCHAR name[MAX_PATH]; if (index2 == CHROME_BROWSER || index2 == CHROME_NACL_PROCESS) { chrome::VersionInfo version_info; - if (version_info.is_valid()) - info.version = ASCIIToWide(version_info.Version()); + info.version = ASCIIToWide(version_info.Version()); // Check if this is one of the child processes whose data we collected // on the IO thread, and if so copy over that data. for (size_t child = 0; child < child_info.size(); child++) { diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index d0a1f01..14f6ba9 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -71,11 +71,6 @@ std::string MetricsLog::GetInstallDate() const { // static std::string MetricsLog::GetVersionString() { chrome::VersionInfo version_info; - if (!version_info.is_valid()) { - NOTREACHED() << "Unable to retrieve version info."; - return std::string(); - } - std::string version = version_info.Version(); if (!version_extension_.empty()) version += version_extension_; diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index 8e29489..e620c11 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -119,7 +119,7 @@ SafeBrowsingProtocolManager::SafeBrowsingProtocolManager( next_update_sec_ = base::RandInt(60, kSbTimerStartIntervalSec); chrome::VersionInfo version_info; - if (!version_info.is_valid() || version_info.Version().empty()) + if (version_info.Version().empty()) version_ = "0.1"; else version_ = version_info.Version(); diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index 4dafe24..b34943b33 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -547,11 +547,6 @@ std::string MakeUserAgentForSyncapi() { user_agent += "MAC "; #endif chrome::VersionInfo version_info; - if (!version_info.is_valid()) { - DLOG(ERROR) << "Unable to create chrome::VersionInfo object"; - return user_agent; - } - user_agent += version_info.Version(); user_agent += " (" + version_info.LastChange() + ")"; if (!version_info.IsOfficialBuild()) diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc index 9e58f04..7d53af6 100644 --- a/chrome/browser/ui/views/about_chrome_view.cc +++ b/chrome/browser/ui/views/about_chrome_view.cc @@ -151,11 +151,6 @@ void AboutChromeView::Init() { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); chrome::VersionInfo version_info; - if (!version_info.is_valid()) { - NOTREACHED() << L"Failed to initialize about window"; - return; - } - current_version_ = ASCIIToWide(version_info.Version()); std::string version_modifier = platform_util::GetVersionStringModifier(); diff --git a/chrome/browser/upgrade_detector.cc b/chrome/browser/upgrade_detector.cc index 7f3161d..2e0eeed 100644 --- a/chrome/browser/upgrade_detector.cc +++ b/chrome/browser/upgrade_detector.cc @@ -113,10 +113,6 @@ class DetectUpgradeTask : public Task { // Get the version of the currently *running* instance of Chrome. chrome::VersionInfo version_info; - if (!version_info.is_valid()) { - NOTREACHED() << "Failed to get current file version"; - return; - } scoped_ptr<Version> running_version( Version::GetVersionFromString(version_info.Version())); if (running_version.get() == NULL) { diff --git a/chrome/common/chrome_version_info.cc b/chrome/common/chrome_version_info.cc index 5157c4a..70e8cb24 100644 --- a/chrome/common/chrome_version_info.cc +++ b/chrome/common/chrome_version_info.cc @@ -9,47 +9,38 @@ #include "base/string_util.h" #include "base/thread_restrictions.h" #include "build/build_config.h" +#include "chrome/common/chrome_constants.h" namespace chrome { #if defined(OS_WIN) || defined(OS_MACOSX) -// On Windows and Mac, we get the Chrome version info by querying -// FileVersionInfo for the current module. +// On Windows and Mac we get the Chrome version info by querying FileVersionInfo +// for the current module. VersionInfo::VersionInfo() { // The current module is already loaded in memory, so this will be cheap. base::ThreadRestrictions::ScopedAllowIO allow_io; version_info_.reset(FileVersionInfo::CreateFileVersionInfoForCurrentModule()); + DCHECK(version_info_.get()); } VersionInfo::~VersionInfo() { } -bool VersionInfo::is_valid() const { - return version_info_.get() != NULL; -} - std::string VersionInfo::Name() const { - if (!is_valid()) - return std::string(); - return WideToASCII(version_info_->product_name()); + std::wstring name = version_info_->product_name(); + return WideToASCII(name); } std::string VersionInfo::Version() const { - if (!is_valid()) - return std::string(); return WideToASCII(version_info_->product_version()); } std::string VersionInfo::LastChange() const { - if (!is_valid()) - return std::string(); return WideToASCII(version_info_->last_change()); } bool VersionInfo::IsOfficialBuild() const { - if (!is_valid()) - return false; return version_info_->is_official_build(); } @@ -65,10 +56,6 @@ VersionInfo::VersionInfo() { VersionInfo::~VersionInfo() { } -bool VersionInfo::is_valid() const { - return true; -} - std::string VersionInfo::Name() const { return PRODUCT_NAME; } diff --git a/chrome/common/chrome_version_info.h b/chrome/common/chrome_version_info.h index 0ec911e..b785249 100644 --- a/chrome/common/chrome_version_info.h +++ b/chrome/common/chrome_version_info.h @@ -22,12 +22,6 @@ class VersionInfo { VersionInfo(); ~VersionInfo(); - // In the rare case where we fail to get the version info, - // is_valid() will return false. The other functions will return - // the empty string in this case, so it's not harmful if you don't - // check is_valid(). - bool is_valid() const; - // E.g. "Chromium" or "Google Chrome". std::string Name() const; diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 56e0683..3cbe44d 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -1343,11 +1343,6 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, } chrome::VersionInfo current_version_info; - if (!current_version_info.is_valid()) { - NOTREACHED(); - return false; - } - scoped_ptr<Version> current_version( Version::GetVersionFromString(current_version_info.Version())); if (!current_version.get()) { diff --git a/chrome/common/service_process_util.cc b/chrome/common/service_process_util.cc index bcbac69..4c22fda 100644 --- a/chrome/common/service_process_util.cc +++ b/chrome/common/service_process_util.cc @@ -82,12 +82,6 @@ ServiceProcessRunningState GetServiceProcessRunningState( // Get the version of the currently *running* instance of Chrome. chrome::VersionInfo version_info; - if (!version_info.is_valid()) { - NOTREACHED() << "Failed to get current file version"; - // Our own version is invalid. This is an error case. Pretend that we - // are out of date. - return SERVICE_NEWER_VERSION_RUNNING; - } scoped_ptr<Version> running_version(Version::GetVersionFromString( version_info.Version())); if (!running_version.get()) { @@ -130,7 +124,6 @@ std::string GetServiceProcessScopedVersionedName( const std::string& append_str) { std::string versioned_str; chrome::VersionInfo version_info; - DCHECK(version_info.is_valid()); versioned_str.append(version_info.Version()); versioned_str.append(append_str); return GetServiceProcessScopedName(versioned_str); @@ -198,10 +191,6 @@ bool ServiceProcessState::HandleOtherVersion() { bool ServiceProcessState::CreateSharedData() { chrome::VersionInfo version_info; - if (!version_info.is_valid()) { - NOTREACHED() << "Failed to get current file version"; - return false; - } if (version_info.Version().length() >= kMaxVersionStringLength) { NOTREACHED() << "Version string length is << " << version_info.Version().length() << "which is longer than" << diff --git a/chrome/common/service_process_util_unittest.cc b/chrome/common/service_process_util_unittest.cc index 58b68e1..34b855a 100644 --- a/chrome/common/service_process_util_unittest.cc +++ b/chrome/common/service_process_util_unittest.cc @@ -14,7 +14,6 @@ TEST(ServiceProcessUtilTest, ScopedVersionedName) { std::string test_str = "test"; std::string scoped_name = GetServiceProcessScopedVersionedName(test_str); chrome::VersionInfo version_info; - DCHECK(version_info.is_valid()); EXPECT_TRUE(EndsWith(scoped_name, test_str, true)); EXPECT_NE(std::string::npos, scoped_name.find(version_info.Version())); } diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc index 5cae2a9..6b29531 100644 --- a/chrome/renderer/renderer_glue.cc +++ b/chrome/renderer/renderer_glue.cc @@ -261,8 +261,7 @@ void ClearCache() { std::string GetProductVersion() { chrome::VersionInfo version_info; std::string product("Chrome/"); - product += version_info.is_valid() ? version_info.Version() - : "0.0.0.0"; + product += version_info.Version(); return product; } diff --git a/chrome/service/net/service_url_request_context.cc b/chrome/service/net/service_url_request_context.cc index 7f589e0..cd94482 100644 --- a/chrome/service/net/service_url_request_context.cc +++ b/chrome/service/net/service_url_request_context.cc @@ -86,9 +86,6 @@ std::string BuildOSCpuInfo() { std::string MakeUserAgentForServiceProcess() { std::string user_agent; chrome::VersionInfo version_info; - if (!version_info.is_valid()) { - DLOG(ERROR) << "Unable to create chrome::VersionInfo object"; - } std::string extra_version_info; if (!version_info.IsOfficialBuild()) extra_version_info = "-devel"; diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index 4da271b..62b003e 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -174,7 +174,6 @@ AutomationLaunchResult AutomationProxy::WaitForAppLaunch() { // Obtain our own version number and compare it to what the automation // provider sent. chrome::VersionInfo version_info; - DCHECK(version_info.is_valid()); // Note that we use a simple string comparison since we expect the version // to be a punctuated numeric string. Consider using base/Version if we diff --git a/chrome_frame/metrics_service.cc b/chrome_frame/metrics_service.cc index d82e16b..1ca8caa 100644 --- a/chrome_frame/metrics_service.cc +++ b/chrome_frame/metrics_service.cc @@ -608,17 +608,11 @@ bool MetricsService::UploadData() { // static std::string MetricsService::GetVersionString() { chrome::VersionInfo version_info; - if (version_info.is_valid()) { - std::string version = version_info.Version(); - // Add the -F extensions to ensure that UMA data uploaded by ChromeFrame - // lands in the ChromeFrame bucket. - version += "-F"; - if (!version_info.IsOfficialBuild()) - version.append("-devel"); - return version; - } else { - NOTREACHED() << "Unable to retrieve version string."; - } - - return std::string(); + std::string version = version_info.Version(); + // Add the -F extensions to ensure that UMA data uploaded by ChromeFrame + // lands in the ChromeFrame bucket. + version += "-F"; + if (!version_info.IsOfficialBuild()) + version.append("-devel"); + return version; } diff --git a/chrome_frame/renderer_glue.cc b/chrome_frame/renderer_glue.cc index 8980e97..3e973bc 100644 --- a/chrome_frame/renderer_glue.cc +++ b/chrome_frame/renderer_glue.cc @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/chrome_version_info.h" +#include "base/file_version_info.h" +#include "base/scoped_ptr.h" +#include "base/string_util.h" namespace webkit_glue { @@ -10,12 +12,11 @@ namespace webkit_glue { // here instead of pulling in the whole renderer lib where this function // is implemented for Chrome. std::string GetProductVersion() { - chrome::VersionInfo version_info; + scoped_ptr<FileVersionInfo> info( + FileVersionInfo::CreateFileVersionInfoForCurrentModule()); std::string product("Chrome/"); - product += version_info.is_valid() ? version_info.Version() - : "0.0.0.0"; + product += info.get() ? WideToASCII(info->product_version()) : "0.0.0.0"; return product; } } // end namespace webkit_glue - |