diff options
author | aruslan@chromium.org <aruslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-09 03:03:23 +0000 |
---|---|---|
committer | aruslan@chromium.org <aruslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-09 03:03:23 +0000 |
commit | 281288d32657c08f47c0a894c5b90d1027a2b3e1 (patch) | |
tree | fc23d3b43e5d6c908f4bbcd42017fa9d12bf6ff7 /chrome/common/chrome_version_info_android.cc | |
parent | e56e4d8868fa7e63e1d91bae14e2934916bcbc60 (diff) | |
download | chromium_src-281288d32657c08f47c0a894c5b90d1027a2b3e1.zip chromium_src-281288d32657c08f47c0a894c5b90d1027a2b3e1.tar.gz chromium_src-281288d32657c08f47c0a894c5b90d1027a2b3e1.tar.bz2 |
On Android, the app package name defines a distribution channel
BUG=159476
Review URL: https://chromiumcodereview.appspot.com/11368146
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166844 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/chrome_version_info_android.cc')
-rw-r--r-- | chrome/common/chrome_version_info_android.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/chrome/common/chrome_version_info_android.cc b/chrome/common/chrome_version_info_android.cc new file mode 100644 index 0000000..a993672 --- /dev/null +++ b/chrome/common/chrome_version_info_android.cc @@ -0,0 +1,41 @@ +// Copyright (c) 2012 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" + +#include "base/android/build_info.h" +#include "base/logging.h" +#include "base/string_util.h" + +namespace chrome { + +// static +std::string VersionInfo::GetVersionStringModifier() { + switch (GetChannel()) { + case CHANNEL_UNKNOWN: return "unknown"; + case CHANNEL_CANARY: return "canary"; + case CHANNEL_DEV: return "dev"; + case CHANNEL_BETA: return "beta"; + case CHANNEL_STABLE: return std::string(); + } + NOTREACHED() << "Unknown channel " << GetChannel(); + return std::string(); +} + +// static +VersionInfo::Channel VersionInfo::GetChannel() { + const base::android::BuildInfo* bi = base::android::BuildInfo::GetInstance(); + DCHECK(bi && bi->package_name()); + + if (!strcmp(bi->package_name(), "com.android.chrome")) + return CHANNEL_STABLE; + if (!strcmp(bi->package_name(), "com.google.android.apps.chrome_beta")) + return CHANNEL_BETA; + if (!strcmp(bi->package_name(), "com.google.android.apps.chrome_dev")) + return CHANNEL_DEV; + + return CHANNEL_UNKNOWN; +} + +} // namespace chrome |