diff options
author | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-08 23:59:13 +0000 |
---|---|---|
committer | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-08 23:59:13 +0000 |
commit | a137642ec9212bd801c10163be21f9008be5fe46 (patch) | |
tree | 7f9442eb7953c34d9c40017936518b317caaf506 | |
parent | b4b5b584bc3e84c4ac490eb31c9daed404cecf96 (diff) | |
download | chromium_src-a137642ec9212bd801c10163be21f9008be5fe46.zip chromium_src-a137642ec9212bd801c10163be21f9008be5fe46.tar.gz chromium_src-a137642ec9212bd801c10163be21f9008be5fe46.tar.bz2 |
Merge 88440 - Change Chrome OS version numbers to Platform versions.
Changed the version parsing for Chrome OS if a special function has been called to strip out the leading 0. and major version number. Additionally changed about chrome os, about chrome os -> more info, about:version and the login screen to reflect version numbers more in tune with a 'platform' than OS.
BUG=chromium-os:15789
TEST=Viewed all the screens and took screenshots. Screen shots of all effected screens are attached to the cros bug
Review URL: http://codereview.chromium.org/7108019
TBR=rkc@chromium.org
Review URL: http://codereview.chromium.org/7134029
git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@88443 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/sys_info_chromeos.cc | 11 | ||||
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 1 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/background_view.cc | 17 | ||||
-rw-r--r-- | chrome/browser/chromeos/version_loader.cc | 24 | ||||
-rw-r--r-- | chrome/browser/chromeos/version_loader.h | 12 | ||||
-rw-r--r-- | chrome/browser/resources/options/about_page.html | 18 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/about_page_handler.cc | 1 |
7 files changed, 65 insertions, 19 deletions
diff --git a/base/sys_info_chromeos.cc b/base/sys_info_chromeos.cc index cd17c18..f724f99 100644 --- a/base/sys_info_chromeos.cc +++ b/base/sys_info_chromeos.cc @@ -94,17 +94,20 @@ void SysInfo::ParseLsbRelease(const std::string& lsb_release, size_t length = lsb_release.find_first_of('\n', start_index) - start_index; std::string version = lsb_release.substr(start_index, length); StringTokenizer tokenizer(version, "."); - for (int i = 0; i < 3 && tokenizer.GetNext(); i++) { - if (0 == i) { + // TODO(rkc): Ignore the 0. here; fix this once we move Chrome OS version + // numbers from the 0.xx.yyy.zz format to the xx.yyy.zz format. + // Refer to http://code.google.com/p/chromium-os/issues/detail?id=15789 + for (int i = 0; i < 4 && tokenizer.GetNext(); i++) { + if (1 == i) { StringToInt(tokenizer.token_begin(), tokenizer.token_end(), major_version); *minor_version = *bugfix_version = 0; - } else if (1 == i) { + } else if (2 == i) { StringToInt(tokenizer.token_begin(), tokenizer.token_end(), minor_version); - } else { // 2 == i + } else { // 3 == i StringToInt(tokenizer.token_begin(), tokenizer.token_end(), bugfix_version); diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 7f625d9..e1bc42c 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -1218,6 +1218,7 @@ ChromeOSAboutVersionHandler::ChromeOSAboutVersionHandler(AboutSource* source, int request_id) : source_(source), request_id_(request_id) { + loader_.EnablePlatformVersions(true); loader_.GetVersion(&consumer_, NewCallback(this, &ChromeOSAboutVersionHandler::OnVersion), chromeos::VersionLoader::VERSION_FULL); diff --git a/chrome/browser/chromeos/login/background_view.cc b/chrome/browser/chromeos/login/background_view.cc index 9549ccc..ad15739 100644 --- a/chrome/browser/chromeos/login/background_view.cc +++ b/chrome/browser/chromeos/login/background_view.cc @@ -28,6 +28,7 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/views/dom_view.h" #include "chrome/browser/ui/views/window.h" +#include "chrome/common/chrome_version_info.h" #include "googleurl/src/gurl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -54,6 +55,7 @@ using views::WidgetGtk; namespace { const SkColor kVersionColor = 0xff5c739f; +const char kPlatformLabel[] = "cros:"; // Returns the corresponding step id for step constant. int GetStepId(size_t step) { @@ -386,10 +388,11 @@ void BackgroundView::InitInfoLabels() { } if (CrosLibrary::Get()->EnsureLoaded()) { + version_loader_.EnablePlatformVersions(true); version_loader_.GetVersion( &version_consumer_, NewCallback(this, &BackgroundView::OnVersion), - is_official_build_? + is_official_build_ ? VersionLoader::VERSION_SHORT_WITH_DATE : VersionLoader::VERSION_FULL); if (!is_official_build_) { @@ -449,12 +452,18 @@ void BackgroundView::UpdateVersionLabel() { if (version_text_.empty()) return; - // TODO(jungshik): Is string concatenation OK here? - std::string label_text = l10n_util::GetStringUTF8(IDS_PRODUCT_OS_NAME); + chrome::VersionInfo version_info; + std::string label_text = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); label_text += ' '; - label_text += l10n_util::GetStringUTF8(IDS_VERSION_FIELD_PREFIX); + label_text += version_info.Version(); + label_text += " ("; + // TODO(rkc): Fix this. This needs to be in a resource file, but we have had + // to put it in for merge into R12. Also, look at rtl implications for this + // entire string composition code. + label_text += kPlatformLabel; label_text += ' '; label_text += version_text_; + label_text += ')'; if (!enterprise_domain_text_.empty()) { label_text += ' '; diff --git a/chrome/browser/chromeos/version_loader.cc b/chrome/browser/chromeos/version_loader.cc index a026bf8..8356466 100644 --- a/chrome/browser/chromeos/version_loader.cc +++ b/chrome/browser/chromeos/version_loader.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,6 +21,10 @@ namespace chromeos { // File to look for version number in. static const char kPathVersion[] = "/etc/lsb-release"; +// TODO(rkc): Remove once we change over the Chrome OS version format. +// Done for http://code.google.com/p/chromium-os/issues/detail?id=15789 +static const size_t kTrimVersion = 2; + // File to look for firmware number in. static const char kPathFirmware[] = "/var/log/bios_info.txt"; @@ -77,6 +81,10 @@ VersionLoader::Handle VersionLoader::GetFirmware( return request->handle(); } +void VersionLoader::EnablePlatformVersions(bool enable) { + backend_.get()->set_parse_as_platform(enable); +} + // static std::string VersionLoader::ParseVersion(const std::string& contents, const std::string& prefix) { @@ -138,6 +146,20 @@ void VersionLoader::Backend::GetVersion( version = ParseVersion( contents, (format == VERSION_FULL) ? kFullVersionPrefix : kVersionPrefix); + + // TODO(rkc): Fix this once we move to xx.yyy version numbers for Chrome OS + // instead of 0.xx.yyy + // Done for http://code.google.com/p/chromium-os/issues/detail?id=15789 + if (parse_as_platform_) { + if (version.size() > kTrimVersion) { + version = version.substr(kTrimVersion); + // Strip the major version. + size_t first_dot = version.find("."); + if (first_dot != std::string::npos) { + version = version.substr(first_dot + 1); + } + } + } } if (format == VERSION_SHORT_WITH_DATE) { diff --git a/chrome/browser/chromeos/version_loader.h b/chrome/browser/chromeos/version_loader.h index e3ea990..554a323 100644 --- a/chrome/browser/chromeos/version_loader.h +++ b/chrome/browser/chromeos/version_loader.h @@ -58,6 +58,12 @@ class VersionLoader : public CancelableRequestProvider { Handle GetFirmware(CancelableRequestConsumerBase* consumer, GetFirmwareCallback* callback); + // Parse the version information as a Chrome platfrom, not Chrome OS + // TODO(rkc): Change this and everywhere it is used once we switch Chrome OS + // over to xx.yyy.zz version numbers instead of 0.xx.yyy.zz + // Refer to http://code.google.com/p/chromium-os/issues/detail?id=15789 + void EnablePlatformVersions(bool enable); + static const char kFullVersionPrefix[]; static const char kVersionPrefix[]; static const char kFirmwarePrefix[]; @@ -71,7 +77,7 @@ class VersionLoader : public CancelableRequestProvider { // and extract the version. class Backend : public base::RefCountedThreadSafe<Backend> { public: - Backend() {} + Backend() : parse_as_platform_(false) {} // Calls ParseVersion to get the version # and notifies request. // This is invoked on the file thread. @@ -83,9 +89,13 @@ class VersionLoader : public CancelableRequestProvider { // This is invoked on the file thread. void GetFirmware(scoped_refptr<GetFirmwareRequest> request); + void set_parse_as_platform(bool value) { parse_as_platform_ = value; } + private: friend class base::RefCountedThreadSafe<Backend>; + bool parse_as_platform_; + ~Backend() {} DISALLOW_COPY_AND_ASSIGN(Backend); diff --git a/chrome/browser/resources/options/about_page.html b/chrome/browser/resources/options/about_page.html index ef2bc25..6c0f9a7 100644 --- a/chrome/browser/resources/options/about_page.html +++ b/chrome/browser/resources/options/about_page.html @@ -4,14 +4,14 @@ <section> <div> <!-- White space is significant between spans. --> - <div><span i18n-content="firmware"></span> <span id="osFirmware0"> - <span class="loading" i18n-content="loading"></span></span></div> - <div><span i18n-content="os"></span> <span id="osVersion0"> - <span class="loading" i18n-content="loading"></span></span></div> <div> <span i18n-content="browser"></span> <span i18n-content="browser_version"></span> </div> + <div><span i18n-content="os"></span> <span id="osVersion0"> + <span class="loading" i18n-content="loading"></span></span></div> + <div><span i18n-content="firmware"></span> <span id="osFirmware0"> + <span class="loading" i18n-content="loading"></span></span></div> <div> <button class="link-button" id="moreInfoButton" i18n-content="more_info"></button> @@ -35,9 +35,8 @@ </div> </section> <section> - <h3 i18n-content="firmware"></h3> - <div id="osFirmware1"> - <span class="loading" i18n-content="loading"></span> + <h3 i18n-content="browser"></h3> + <div i18n-content="browser_version"></div> </section> <section> <h3 i18n-content="os"></h3> @@ -46,8 +45,9 @@ </div> </section> <section> - <h3 i18n-content="browser"></h3> - <div i18n-content="browser_version"></div> + <h3 i18n-content="firmware"></h3> + <div id="osFirmware1"> + <span class="loading" i18n-content="loading"></span> </section> <section> <h3>WebKit</h3> diff --git a/chrome/browser/ui/webui/options/about_page_handler.cc b/chrome/browser/ui/webui/options/about_page_handler.cc index 3fb176d..c2cd538 100644 --- a/chrome/browser/ui/webui/options/about_page_handler.cc +++ b/chrome/browser/ui/webui/options/about_page_handler.cc @@ -273,6 +273,7 @@ void AboutPageHandler::RegisterMessages() { void AboutPageHandler::PageReady(const ListValue* args) { #if defined(OS_CHROMEOS) // Version information is loaded from a callback + loader_.EnablePlatformVersions(true); loader_.GetVersion(&consumer_, NewCallback(this, &AboutPageHandler::OnOSVersion), chromeos::VersionLoader::VERSION_FULL); |