summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/system/statistics_provider.cc15
-rw-r--r--chrome/chrome_common.gypi10
-rw-r--r--chrome/common/chrome_version_info.h5
-rw-r--r--chrome/common/chrome_version_info_chromeos.cc50
-rw-r--r--chrome/common/chrome_version_info_linux.cc4
5 files changed, 82 insertions, 2 deletions
diff --git a/chrome/browser/chromeos/system/statistics_provider.cc b/chrome/browser/chromeos/system/statistics_provider.cc
index c81295c..d62add1 100644
--- a/chrome/browser/chromeos/system/statistics_provider.cc
+++ b/chrome/browser/chromeos/system/statistics_provider.cc
@@ -14,6 +14,7 @@
#include "base/time.h"
#include "chrome/browser/chromeos/system/name_value_pairs_parser.h"
#include "chrome/browser/chromeos/system/runtime_environment.h"
+#include "chrome/common/chrome_version_info.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
@@ -151,6 +152,20 @@ void StatisticsProviderImpl::LoadMachineStatistics() {
kMachineOSInfoDelim);
GetNameValuePairsFromFile(&parser, FilePath(kVpdFile), kVpdEq, kVpdDelim);
+#if defined(GOOGLE_CHROME_BUILD)
+ // TODO(kochi): This is for providing a channel information to
+ // chrome::VersionInfo::GetChannel()/GetVersionStringModifier(),
+ // but this is still late for some early customers such as
+ // prerender::ConfigurePrefetchAndPrerender() and
+ // ThreadWatcherList::ParseCommandLine().
+ // See http://crbug.com/107333 .
+ const char kChromeOSReleaseTrack[] = "CHROMEOS_RELEASE_TRACK";
+ std::string channel;
+ if (GetMachineStatistic(kChromeOSReleaseTrack, &channel)) {
+ chrome::VersionInfo::SetChannel(channel);
+ }
+#endif
+
// Finished loading the statistics.
on_statistics_loaded_.Signal();
VLOG(1) << "Finished loading statistics";
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index ddb7bb0..186c72e 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -81,6 +81,7 @@
'common/chrome_sandbox_type_mac.h',
'common/chrome_utility_messages.h',
'common/chrome_version_info.cc',
+ 'common/chrome_version_info_chromeos.cc',
'common/chrome_version_info_linux.cc',
'common/chrome_version_info_mac.mm',
'common/chrome_version_info_win.cc',
@@ -281,6 +282,15 @@
'../build/linux/system.gyp:selinux',
],
}],
+ ['chromeos==0', {
+ 'sources!': [
+ 'common/chrome_version_info_chromeos.cc',
+ ],
+ }, {
+ 'sources!': [
+ 'common/chrome_version_info_linux.cc',
+ ],
+ }],
['OS=="mac"', {
'dependencies': [
'../third_party/mach_override/mach_override.gyp:mach_override',
diff --git a/chrome/common/chrome_version_info.h b/chrome/common/chrome_version_info.h
index 84292e5..4a6658f 100644
--- a/chrome/common/chrome_version_info.h
+++ b/chrome/common/chrome_version_info.h
@@ -72,6 +72,11 @@ class VersionInfo {
// will be CHANNEL_UNKNOWN.
static Channel GetChannel();
+#if defined(OS_CHROMEOS)
+ // Sets channel before use.
+ static void SetChannel(const std::string& channel);
+#endif
+
// Returns a version string to be displayed in "About Chromium" dialog.
std::string CreateVersionString() const;
diff --git a/chrome/common/chrome_version_info_chromeos.cc b/chrome/common/chrome_version_info_chromeos.cc
new file mode 100644
index 0000000..22d9ef7
--- /dev/null
+++ b/chrome/common/chrome_version_info_chromeos.cc
@@ -0,0 +1,50 @@
+// 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.
+
+#include "chrome/common/chrome_version_info.h"
+
+namespace chrome {
+
+static VersionInfo::Channel chromeos_channel = VersionInfo::CHANNEL_UNKNOWN;
+
+// static
+std::string VersionInfo::GetVersionStringModifier() {
+#if defined(GOOGLE_CHROME_BUILD)
+ switch (chromeos_channel) {
+ case CHANNEL_STABLE:
+ return "";
+ case CHANNEL_BETA:
+ return "beta";
+ case CHANNEL_DEV:
+ return "dev";
+ case CHANNEL_CANARY:
+ return "canary";
+ default:
+ return "unknown";
+ }
+#endif
+ return std::string();
+}
+
+// static
+VersionInfo::Channel VersionInfo::GetChannel() {
+ return chromeos_channel;
+}
+
+// static
+void VersionInfo::SetChannel(const std::string& channel) {
+#if defined(GOOGLE_CHROME_BUILD)
+ if (channel == "stable-channel") {
+ chromeos_channel = CHANNEL_STABLE;
+ } else if (channel == "beta-channel") {
+ chromeos_channel = CHANNEL_BETA;
+ } else if (channel == "dev-channel") {
+ chromeos_channel = CHANNEL_DEV;
+ } else if (channel == "canary-channel") {
+ chromeos_channel = CHANNEL_CANARY;
+ }
+#endif
+}
+
+} // namespace chrome
diff --git a/chrome/common/chrome_version_info_linux.cc b/chrome/common/chrome_version_info_linux.cc
index 301ed70..b657cbd 100644
--- a/chrome/common/chrome_version_info_linux.cc
+++ b/chrome/common/chrome_version_info_linux.cc
@@ -6,7 +6,7 @@
namespace chrome {
-// static. Warning: this may be either Linux or ChromeOS.
+// static
std::string VersionInfo::GetVersionStringModifier() {
char* env = getenv("CHROME_VERSION_EXTRA");
if (!env)
@@ -29,7 +29,7 @@ std::string VersionInfo::GetVersionStringModifier() {
return modifier;
}
-// static. Warning: this may be either Linux or ChromeOS.
+// static
VersionInfo::Channel VersionInfo::GetChannel() {
#if defined(GOOGLE_CHROME_BUILD)
std::string channel = GetVersionStringModifier();