diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-27 20:28:42 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-27 20:28:42 +0000 |
commit | 0211f57eabdc1a3e34aee1e1629c26e93b803ded (patch) | |
tree | 3bcbab3506e5f3dbcbc99825529cc803d223b017 /chrome/browser | |
parent | 1f8322043d302eb0f6a050a21d2f0f9a8c1df71e (diff) | |
download | chromium_src-0211f57eabdc1a3e34aee1e1629c26e93b803ded.zip chromium_src-0211f57eabdc1a3e34aee1e1629c26e93b803ded.tar.gz chromium_src-0211f57eabdc1a3e34aee1e1629c26e93b803ded.tar.bz2 |
Refactor version-getting info into a chrome::VersionInfo object.
I was trying to replace wstring usage in base::FileVersionInfo, but
that class is rather Windows-specific with strange fields like
"private_build()" where the value and encoding aren't clear. 95%
of the users of FileVersionInfo actually just care about the current
Chrome version, so we can provide a much simpler interface for them.
We still use FileVersionInfo for retrieving information from e.g.
plugin DLLs, but in those cases the usage is clearer.
Review URL: http://codereview.chromium.org/3135028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57725 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
20 files changed, 110 insertions, 154 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index d432550..cf6b072 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -9,7 +9,6 @@ #include "app/message_box_flags.h" #include "base/callback.h" #include "base/file_path.h" -#include "base/file_version_info.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/json/string_escape.h" @@ -160,14 +159,10 @@ void AutomationProvider::ConnectToChannel(const std::string& channel_id) { automation_resource_message_filter_, g_browser_process->io_thread()->message_loop(), true, g_browser_process->shutdown_event())); - scoped_ptr<FileVersionInfo> version_info(chrome::GetChromeVersionInfo()); - std::string version_string; - if (version_info != NULL) { - version_string = WideToASCII(version_info->file_version()); - } + chrome::VersionInfo version_info; // Send a hello message with our current automation protocol version. - channel_->Send(new AutomationMsg_Hello(0, version_string.c_str())); + channel_->Send(new AutomationMsg_Hello(0, version_info.Version().c_str())); TRACE_EVENT_END("AutomationProvider::ConnectToChannel", 0, ""); } diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 4599689..e4ce4cf 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -12,7 +12,6 @@ #include "app/resource_bundle.h" #include "base/callback.h" #include "base/command_line.h" -#include "base/file_version_info.h" #include "base/histogram.h" #include "base/i18n/number_formatting.h" #include "base/path_service.h" @@ -611,11 +610,7 @@ std::string AboutSandbox() { std::string AboutVersion(DictionaryValue* localized_strings) { localized_strings->SetString("title", l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_TITLE)); - scoped_ptr<FileVersionInfo> version_info(chrome::GetChromeVersionInfo()); - if (version_info == NULL) { - DLOG(ERROR) << "Unable to create FileVersionInfo object"; - return std::string(); - } + chrome::VersionInfo version_info; std::string webkit_version = webkit_glue::GetWebKitVersion(); #ifdef CHROME_V8 @@ -628,10 +623,9 @@ std::string AboutVersion(DictionaryValue* localized_strings) { localized_strings->SetString("name", l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); - localized_strings->SetString("version", - WideToUTF16Hack(version_info->file_version())); + localized_strings->SetString("version", version_info.Version()); localized_strings->SetString("version_modifier", - platform_util::GetVersionStringModifier()); + platform_util::GetVersionStringModifier()); localized_strings->SetString("js_engine", js_engine); localized_strings->SetString("js_version", js_version); localized_strings->SetString("webkit_version", webkit_version); @@ -639,15 +633,12 @@ std::string AboutVersion(DictionaryValue* localized_strings) { l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COMPANY_NAME)); localized_strings->SetString("copyright", l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT)); - localized_strings->SetString("cl", - WideToUTF16Hack(version_info->last_change())); - if (version_info->is_official_build()) { - localized_strings->SetString("official", - l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_OFFICIAL)); - } else { - localized_strings->SetString("official", - l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_UNOFFICIAL)); - } + localized_strings->SetString("cl", version_info.LastChange()); + localized_strings->SetString("official", + l10n_util::GetStringUTF16( + version_info.IsOfficialBuild() ? + IDS_ABOUT_VERSION_OFFICIAL + : IDS_ABOUT_VERSION_UNOFFICIAL)); localized_strings->SetString("user_agent_name", l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_USER_AGENT)); localized_strings->SetString("useragent", webkit_glue::GetUserAgent(GURL())); diff --git a/chrome/browser/bug_report_util.cc b/chrome/browser/bug_report_util.cc index 71d8612..04db543 100644 --- a/chrome/browser/bug_report_util.cc +++ b/chrome/browser/bug_report_util.cc @@ -274,17 +274,14 @@ void BugReportUtil::SendReport(Profile* profile, web_data->set_url(page_url_text); // Add the Chrome version - std::string chrome_version; - scoped_ptr<FileVersionInfo> version_info(chrome::GetChromeVersionInfo()); - if (version_info.get()) { - chrome_version = WideToUTF8(version_info->product_name()) + " - " + - WideToUTF8(version_info->file_version()) + - " (" + WideToUTF8(version_info->last_change()) + ")"; - } - - if (!chrome_version.empty()) + 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); + } // Add OS version (eg, for WinXP SP2: "5.1.2600 Service Pack 2"). std::string os_version = ""; diff --git a/chrome/browser/cocoa/about_window_controller.mm b/chrome/browser/cocoa/about_window_controller.mm index f366b61..bb8044c 100644 --- a/chrome/browser/cocoa/about_window_controller.mm +++ b/chrome/browser/cocoa/about_window_controller.mm @@ -133,10 +133,10 @@ static BOOL recentShownUserActionFailedStatus = NO; NSString* versionModifier = @""; NSString* svnRevision = @""; - string16 modifier = platform_util::GetVersionStringModifier(); - if (modifier.length()) + std::string modifier = platform_util::GetVersionStringModifier(); + if (!modifier.empty()) versionModifier = [NSString stringWithFormat:@" %@", - base::SysUTF16ToNSString(modifier)]; + base::SysUTF8ToNSString(modifier)]; #if !defined(GOOGLE_CHROME_BUILD) svnRevision = [NSString stringWithFormat:@" (%@)", diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index bbe23f7..52f2ff0 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc @@ -7,7 +7,6 @@ #include <string> #include "base/file_util.h" -#include "base/file_version_info.h" #include "base/json/json_reader.h" #include "base/string_util.h" #include "base/string_number_conversions.h" @@ -116,26 +115,23 @@ class VersionTest : public DiagnosticTest { virtual int GetId() { return 0; } virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) { - scoped_ptr<FileVersionInfo> version_info( - chrome::GetChromeVersionInfo()); - if (!version_info.get()) { + chrome::VersionInfo version_info; + if (!version_info.is_valid()) { RecordFailure(ASCIIToUTF16("No Version")); return true; } - string16 current_version = WideToUTF16(version_info->file_version()); + std::string current_version = version_info.Version(); if (current_version.empty()) { RecordFailure(ASCIIToUTF16("Empty Version")); return true; } - string16 version_modifier = platform_util::GetVersionStringModifier(); - if (!version_modifier.empty()) { - current_version += ASCIIToUTF16(" "); - current_version += version_modifier; - } + std::string version_modifier = platform_util::GetVersionStringModifier(); + if (!version_modifier.empty()) + current_version += " " + version_modifier; #if defined(GOOGLE_CHROME_BUILD) - current_version += ASCIIToUTF16(" GCB"); + current_version += " GCB"; #endif // defined(GOOGLE_CHROME_BUILD) - RecordSuccess(current_version); + RecordSuccess(ASCIIToUTF16(current_version)); return true; } diff --git a/chrome/browser/dom_ui/about_page_handler.cc b/chrome/browser/dom_ui/about_page_handler.cc index 6275b7d..750a921 100644 --- a/chrome/browser/dom_ui/about_page_handler.cc +++ b/chrome/browser/dom_ui/about_page_handler.cc @@ -9,7 +9,6 @@ #include "base/basictypes.h" #include "base/callback.h" #include "base/command_line.h" -#include "base/file_version_info.h" #include "base/i18n/time_formatting.h" #include "base/string16.h" #include "base/string_number_conversions.h" @@ -136,21 +135,18 @@ void AboutPageHandler::GetLocalizedValues(DictionaryValue* localized_strings) { // browser version - scoped_ptr<FileVersionInfo> version_info(chrome::GetChromeVersionInfo()); - DCHECK(version_info.get() != NULL); + chrome::VersionInfo version_info; + DCHECK(version_info.is_valid()); - string16 browser_version = WideToUTF16Hack(version_info->file_version()); - - string16 version_modifier = platform_util::GetVersionStringModifier(); - if (version_modifier.length()) { - browser_version += ASCIIToUTF16(" "); - browser_version += version_modifier; - } + std::string browser_version = version_info.Version(); + std::string version_modifier = platform_util::GetVersionStringModifier(); + if (!version_modifier.empty()) + browser_version += " " + version_modifier; #if !defined(GOOGLE_CHROME_BUILD) - browser_version += ASCIIToUTF16(" ("); - browser_version += WideToUTF16Hack(version_info->last_change()); - browser_version += ASCIIToUTF16(")"); + browser_version += " ("; + browser_version += version_info.LastChange(); + browser_version += ")"; #endif localized_strings->SetString("browser_version", browser_version); diff --git a/chrome/browser/dom_ui/net_internals_ui.cc b/chrome/browser/dom_ui/net_internals_ui.cc index 63ad1a2..c10428a 100644 --- a/chrome/browser/dom_ui/net_internals_ui.cc +++ b/chrome/browser/dom_ui/net_internals_ui.cc @@ -13,7 +13,6 @@ #include "app/resource_bundle.h" #include "base/command_line.h" #include "base/file_util.h" -#include "base/file_version_info.h" #include "base/message_loop.h" #include "base/path_service.h" #include "base/singleton.h" @@ -456,25 +455,21 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( { DictionaryValue* dict = new DictionaryValue(); - scoped_ptr<FileVersionInfo> version_info( - chrome::GetChromeVersionInfo()); - - if (version_info == NULL) { - DLOG(ERROR) << "Unable to create FileVersionInfo object"; + 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", WideToUTF16Hack(version_info->file_version())); - dict->SetString("cl", WideToUTF16Hack(version_info->last_change())); - dict->SetString("version_mod", platform_util::GetVersionStringModifier()); - - if (version_info->is_official_build()) { - dict->SetString("official", - l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_OFFICIAL)); - } else { - dict->SetString("official", - l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_UNOFFICIAL)); - } + 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()); diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index 99415b4..2e1b867 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -9,7 +9,6 @@ #include "base/logging.h" #include "base/file_util.h" -#include "base/file_version_info.h" #include "base/histogram.h" #include "base/rand_util.h" #include "base/sha2.h" @@ -768,11 +767,10 @@ std::vector<int> ExtensionUpdater::DetermineUpdates( if (update->browser_min_version.length() > 0) { // First determine the browser version if we haven't already. if (!browser_version.get()) { - scoped_ptr<FileVersionInfo> version_info( - chrome::GetChromeVersionInfo()); - if (version_info.get()) { + chrome::VersionInfo version_info; + if (version_info.is_valid()) { browser_version.reset(Version::GetVersionFromString( - version_info->product_version())); + version_info.Version())); } } scoped_ptr<Version> browser_min_version( diff --git a/chrome/browser/gtk/about_chrome_dialog.cc b/chrome/browser/gtk/about_chrome_dialog.cc index edfb269..29f9159 100644 --- a/chrome/browser/gtk/about_chrome_dialog.cc +++ b/chrome/browser/gtk/about_chrome_dialog.cc @@ -11,7 +11,6 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "base/file_version_info.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/gtk/cairo_cached_surface.h" @@ -108,18 +107,16 @@ gboolean OnEventBoxExpose(GtkWidget* event_box, void ShowAboutDialogForProfile(GtkWindow* parent, Profile* profile) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); static GdkPixbuf* background = rb.GetPixbufNamed(IDR_ABOUT_BACKGROUND); - scoped_ptr<FileVersionInfo> version_info(chrome::GetChromeVersionInfo()); - std::wstring current_version = version_info->file_version(); + chrome::VersionInfo version_info; + std::string current_version = version_info.Version(); #if !defined(GOOGLE_CHROME_BUILD) - current_version += L" ("; - current_version += version_info->last_change(); - current_version += L")"; + current_version += " ("; + current_version += version_info.LastChange(); + current_version += ")"; #endif - string16 version_modifier = platform_util::GetVersionStringModifier(); - if (version_modifier.length()) { - current_version += L" "; - current_version += UTF16ToWide(version_modifier); - } + std::string channel = platform_util::GetVersionStringModifier(); + if (!channel.empty()) + current_version += " " + channel; // Build the dialog. GtkWidget* dialog = gtk_dialog_new_with_buttons( @@ -159,7 +156,7 @@ void ShowAboutDialogForProfile(GtkWindow* parent, Profile* profile) { gtk_widget_modify_fg(product_label, GTK_STATE_NORMAL, &black); gtk_box_pack_start(GTK_BOX(text_vbox), product_label, FALSE, FALSE, 0); - GtkWidget* version_label = gtk_label_new(WideToUTF8(current_version).c_str()); + GtkWidget* version_label = gtk_label_new(current_version.c_str()); gtk_misc_set_alignment(GTK_MISC(version_label), 0.0, 0.5); gtk_label_set_selectable(GTK_LABEL(version_label), TRUE); gtk_widget_modify_fg(version_label, GTK_STATE_NORMAL, &black); diff --git a/chrome/browser/memory_details_mac.cc b/chrome/browser/memory_details_mac.cc index 74a58d9..26b9fbf 100644 --- a/chrome/browser/memory_details_mac.cc +++ b/chrome/browser/memory_details_mac.cc @@ -15,6 +15,7 @@ #include "base/string_util.h" #include "base/process_util.h" #include "base/thread.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser_child_process_host.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" @@ -198,10 +199,10 @@ void MemoryDetails::CollectProcessDataChrome( else info.type = ChildProcessInfo::UNKNOWN_PROCESS; - scoped_ptr<FileVersionInfo> version_info(chrome::GetChromeVersionInfo()); - if (version_info.get()) { - info.product_name = version_info->product_name(); - info.version = version_info->product_version(); + 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""; diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc index 5871687..1e6d985 100644 --- a/chrome/browser/memory_details_win.cc +++ b/chrome/browser/memory_details_win.cc @@ -8,6 +8,7 @@ #include "app/l10n_util.h" #include "base/file_version_info.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser_child_process_host.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/renderer_host/backing_store_manager.h" @@ -121,10 +122,9 @@ void MemoryDetails::CollectProcessData( // Get Version Information. TCHAR name[MAX_PATH]; if (index2 == CHROME_BROWSER || index2 == CHROME_NACL_PROCESS) { - scoped_ptr<FileVersionInfo> version_info( - chrome::GetChromeVersionInfo()); - if (version_info != NULL) - info.version = version_info->file_version(); + chrome::VersionInfo version_info; + if (version_info.is_valid()) + 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 9364427..396c533 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -9,7 +9,6 @@ #include "base/basictypes.h" #include "base/file_util.h" -#include "base/file_version_info.h" #include "base/perftimer.h" #include "base/scoped_ptr.h" #include "base/string_util.h" @@ -70,20 +69,18 @@ std::string MetricsLog::GetInstallDate() const { // static std::string MetricsLog::GetVersionString() { - scoped_ptr<FileVersionInfo> version_info( - chrome::GetChromeVersionInfo()); - if (version_info.get()) { - std::string version = WideToUTF8(version_info->product_version()); - if (!version_extension_.empty()) - version += version_extension_; - if (!version_info->is_official_build()) - version.append("-devel"); - return version; - } else { - NOTREACHED() << "Unable to retrieve version string."; + chrome::VersionInfo version_info; + if (!version_info.is_valid()) { + NOTREACHED() << "Unable to retrieve version info."; + return std::string(); } - return std::string(); + std::string version = version_info.Version(); + if (!version_extension_.empty()) + version += version_extension_; + if (!version_info.IsOfficialBuild()) + version.append("-devel"); + return version; } void MetricsLog::RecordIncrementalStabilityElements() { diff --git a/chrome/browser/platform_util.h b/chrome/browser/platform_util.h index 63b5995..fb82b19 100644 --- a/chrome/browser/platform_util.h +++ b/chrome/browser/platform_util.h @@ -55,7 +55,7 @@ bool SimpleYesNoBox(gfx::NativeWindow parent, // Return a human readable modifier for the version string. For a // branded Chrome (not Chromium), this modifier is the channel (dev, // beta, but "" for stable). -string16 GetVersionStringModifier(); +std::string GetVersionStringModifier(); } diff --git a/chrome/browser/platform_util_common_linux.cc b/chrome/browser/platform_util_common_linux.cc index 43c588f..1f0ea42 100644 --- a/chrome/browser/platform_util_common_linux.cc +++ b/chrome/browser/platform_util_common_linux.cc @@ -108,11 +108,11 @@ bool SimpleYesNoBox(gfx::NativeWindow parent, return g_dialog_response == GTK_RESPONSE_YES; } -/* Warning: this may be either Linux or ChromeOS */ -string16 GetVersionStringModifier() { +// Warning: this may be either Linux or ChromeOS. +std::string GetVersionStringModifier() { char* env = getenv("CHROME_VERSION_EXTRA"); if (!env) - return string16(); + return std::string(); std::string modifier(env); #if defined(GOOGLE_CHROME_BUILD) @@ -128,7 +128,7 @@ string16 GetVersionStringModifier() { } #endif - return ASCIIToUTF16(modifier); + return modifier; } } // namespace platform_util diff --git a/chrome/browser/platform_util_mac.mm b/chrome/browser/platform_util_mac.mm index 7c71950..3ee28b7 100644 --- a/chrome/browser/platform_util_mac.mm +++ b/chrome/browser/platform_util_mac.mm @@ -176,7 +176,7 @@ bool SimpleYesNoBox(gfx::NativeWindow parent, return result == NSAlertFirstButtonReturn; } -string16 GetVersionStringModifier() { +std::string GetVersionStringModifier() { #if defined(GOOGLE_CHROME_BUILD) // Use the main application bundle and not the framework bundle. Keystone // keys don't live in the framework. @@ -196,9 +196,9 @@ string16 GetVersionStringModifier() { channel = @"unknown"; } - return base::SysNSStringToUTF16(channel); + return base::SysNSStringToUTF8(channel); #else - return string16(); + return std::string(); #endif } diff --git a/chrome/browser/platform_util_win.cc b/chrome/browser/platform_util_win.cc index 5157cb4..1c69075 100644 --- a/chrome/browser/platform_util_win.cc +++ b/chrome/browser/platform_util_win.cc @@ -166,7 +166,7 @@ bool SimpleYesNoBox(gfx::NativeWindow parent, MB_YESNO | MB_ICONWARNING | MB_SETFOREGROUND) == IDYES; } -string16 GetVersionStringModifier() { +std::string GetVersionStringModifier() { #if defined(GOOGLE_CHROME_BUILD) FilePath module; string16 channel; @@ -176,9 +176,9 @@ string16 GetVersionStringModifier() { GoogleUpdateSettings::GetChromeChannel(is_system_install, &channel); } - return channel; + return UTF16ToASCII(channel); #else - return string16(); + return std::string(); #endif } diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index 611349b..340d0ca 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -8,7 +8,6 @@ #include "base/base64.h" #endif #include "base/environment.h" -#include "base/file_version_info.h" #include "base/histogram.h" #include "base/logging.h" #include "base/rand_util.h" @@ -76,11 +75,11 @@ SafeBrowsingProtocolManager::SafeBrowsingProtocolManager( // The first update must happen between 1-5 minutes of start up. next_update_sec_ = base::RandInt(60, kSbTimerStartIntervalSec); - scoped_ptr<FileVersionInfo> version_info(chrome::GetChromeVersionInfo()); - if (!version_info.get()) + chrome::VersionInfo version_info; + if (!version_info.is_valid()) version_ = "0.1"; else - version_ = WideToASCII(version_info->product_version()); + version_ = version_info.Version(); } SafeBrowsingProtocolManager::~SafeBrowsingProtocolManager() { diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index 40782ec..6903ecd 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -7,7 +7,6 @@ #include <algorithm> #include "base/file_util.h" -#include "base/file_version_info.h" #include "base/task.h" #include "base/utf_string_conversions.h" #include "chrome/browser/chrome_thread.h" @@ -393,15 +392,15 @@ std::string MakeUserAgentForSyncapi() { #elif defined(OS_MACOSX) user_agent += "MAC "; #endif - scoped_ptr<FileVersionInfo> version_info(chrome::GetChromeVersionInfo()); - if (version_info == NULL) { - DLOG(ERROR) << "Unable to create FileVersionInfo object"; + chrome::VersionInfo version_info; + if (!version_info.is_valid()) { + DLOG(ERROR) << "Unable to create chrome::VersionInfo object"; return user_agent; } - user_agent += WideToUTF8(version_info->product_version()); - user_agent += " (" + WideToUTF8(version_info->last_change()) + ")"; - if (!version_info->is_official_build()) + user_agent += version_info.Version(); + user_agent += " (" + version_info.LastChange() + ")"; + if (!version_info.IsOfficialBuild()) user_agent += "-devel"; return user_agent; } diff --git a/chrome/browser/upgrade_detector.cc b/chrome/browser/upgrade_detector.cc index 38e5a49..ae21a23 100644 --- a/chrome/browser/upgrade_detector.cc +++ b/chrome/browser/upgrade_detector.cc @@ -7,7 +7,6 @@ #include <string> #include "base/command_line.h" -#include "base/file_version_info.h" #include "base/scoped_ptr.h" #include "base/time.h" #include "base/task.h" @@ -102,14 +101,13 @@ class DetectUpgradeTask : public Task { #endif // Get the version of the currently *running* instance of Chrome. - scoped_ptr<FileVersionInfo> version(chrome::GetChromeVersionInfo()); - if (version.get() == NULL) { + chrome::VersionInfo version_info; + if (!version_info.is_valid()) { NOTREACHED() << "Failed to get current file version"; return; } - scoped_ptr<Version> running_version( - Version::GetVersionFromString(WideToUTF16(version->file_version()))); + Version::GetVersionFromString(ASCIIToUTF16(version_info.Version()))); if (running_version.get() == NULL) { NOTREACHED() << "Failed to parse version info"; return; diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index ff1b7d1..0863d5c 100644 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -11,7 +11,6 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/callback.h" -#include "base/file_version_info.h" #include "base/i18n/rtl.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" @@ -142,23 +141,21 @@ void AboutChromeView::Init() { text_direction_is_rtl_ = base::i18n::IsRTL(); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - scoped_ptr<FileVersionInfo> version_info(chrome::GetChromeVersionInfo()); - if (version_info.get() == NULL) { + chrome::VersionInfo version_info; + if (!version_info.is_valid()) { NOTREACHED() << L"Failed to initialize about window"; return; } - current_version_ = version_info->file_version(); + current_version_ = ASCIIToWide(version_info.Version()); - string16 version_modifier = platform_util::GetVersionStringModifier(); - if (version_modifier.length()) { - version_details_ += L" "; - version_details_ += UTF16ToWide(version_modifier); - } + std::string version_modifier = platform_util::GetVersionStringModifier(); + if (!version_modifier.empty()) + version_details_ += L" " + ASCIIToWide(version_modifier); #if !defined(GOOGLE_CHROME_BUILD) version_details_ += L" ("; - version_details_ += version_info->last_change(); + version_details_ += ASCIIToWide(version_info.LastChange()); version_details_ += L")"; #endif |