Commit cbf0d1d7 authored by rbyers@chromium.org's avatar rbyers@chromium.org

Set linux distro to CHROMEOS_RELEASE_DESCRIPTION on ChromeOS

This makes ChromeOS more consistent with Linux, which uses the DISTRIB_DESCRIPTION from /etc/lsb-release here.  We have a different pre-existing mechanism in the code for reading the value (since ChromeOS doesn't have the lsb_release tool), but it's conceptually the same thing.

This makes it possible to search / catagorize ChromeOS crash reports based on the build, or other information about the ChromeOS version.  It also allows the matching build/symbols to be more easily found given a crash report.

There's no need for Aura customization of distro anymore - that was added when
Aura was experimental.  All ChromeOS is now Aura.

BUG=142630


Review URL: https://chromiumcodereview.appspot.com/10827322

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151741 0039d316-1c4b-4281-b951-d872f2087c98
parent f89f58ad
......@@ -132,9 +132,7 @@ static const int kDistroSize = 128 + 1;
// We use this static string to hold the Linux distro info. If we
// crash, the crash handler code will send this in the crash dump.
char g_linux_distro[kDistroSize] =
#if defined(OS_CHROMEOS) && defined(USE_AURA)
"CrOS Aura";
#elif defined(OS_CHROMEOS)
#if defined(OS_CHROMEOS)
"CrOS";
#elif defined(OS_ANDROID)
"Android";
......
......@@ -30,9 +30,16 @@
namespace {
#if defined(USE_LINUX_BREAKPAD)
#if defined(OS_CHROMEOS)
void ChromeOSVersionCallback(chromeos::VersionLoader::Handle,
const std::string& version) {
base::SetLinuxDistro(std::string("CrOS ") + version);
}
#else
void GetLinuxDistroCallback() {
base::GetLinuxDistro(); // Initialize base::linux_distro if needed.
}
#endif
bool IsCrashReportingEnabled(const PrefService* local_state) {
// Check whether we should initialize the crash reporter. It may be disabled
......@@ -79,11 +86,17 @@ ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() {
void ChromeBrowserMainPartsLinux::PreProfileInit() {
#if defined(USE_LINUX_BREAKPAD)
#if defined(OS_CHROMEOS)
cros_version_loader_.GetVersion(&cros_consumer_,
base::Bind(&ChromeOSVersionCallback),
chromeos::VersionLoader::VERSION_FULL);
#else
// Needs to be called after we have chrome::DIR_USER_DATA and
// g_browser_process. This happens in PreCreateThreads.
content::BrowserThread::PostTask(content::BrowserThread::FILE,
FROM_HERE,
base::Bind(&GetLinuxDistroCallback));
#endif
if (IsCrashReportingEnabled(local_state()))
InitCrashReporter();
......
......@@ -9,8 +9,13 @@
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/chrome_browser_main_posix.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/version_loader.h"
#endif
#if !defined(OS_CHROMEOS)
namespace chrome {
class MediaDeviceNotificationsLinux;
......@@ -33,6 +38,11 @@ class ChromeBrowserMainPartsLinux : public ChromeBrowserMainPartsPosix {
media_device_notifications_linux_;
#endif
#if defined(OS_CHROMEOS)
chromeos::VersionLoader cros_version_loader_;
CancelableRequestConsumer cros_consumer_;
#endif
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsLinux);
};
......
......@@ -191,8 +191,8 @@ void VersionInfoUpdater::SetEnterpriseInfo(const std::string& domain_name,
}
void VersionInfoUpdater::OnVersion(
VersionLoader::Handle handle, std::string version) {
version_text_.swap(version);
VersionLoader::Handle handle, const std::string& version) {
version_text_ = version;
UpdateVersionLabel();
}
......
......@@ -73,7 +73,7 @@ class VersionInfoUpdater : public policy::CloudPolicySubsystem::Observer,
bool reporting_hint);
// Callback from chromeos::VersionLoader giving the version.
void OnVersion(VersionLoader::Handle handle, std::string version);
void OnVersion(VersionLoader::Handle handle, const std::string& version);
// Callback from chromeos::InfoLoader giving the boot times.
void OnBootTimes(
BootTimesLoader::Handle handle, BootTimesLoader::BootTimes boot_times);
......
......@@ -23,7 +23,7 @@ namespace chromeos {
// CancelableRequestConsumerBase.
// . Define the callback method, something like:
// void OnGetChromeOSVersion(chromeos::VersionLoader::Handle,
// std::string version);
// const std::string& version);
// . When you want the version invoke: loader.GetVersion(&consumer, callback);
//
// This class also provides the ability to load the bios firmware using
......@@ -40,10 +40,10 @@ class VersionLoader : public CancelableRequestProvider {
};
// Signature
typedef base::Callback<void(Handle, std::string)> GetVersionCallback;
typedef base::Callback<void(Handle, const std::string&)> GetVersionCallback;
typedef CancelableRequest<GetVersionCallback> GetVersionRequest;
typedef base::Callback<void(Handle, std::string)> GetFirmwareCallback;
typedef base::Callback<void(Handle, const std::string&)> GetFirmwareCallback;
typedef CancelableRequest<GetFirmwareCallback> GetFirmwareRequest;
// Asynchronously requests the version.
......
......@@ -368,12 +368,12 @@ void DeviceStatusCollector::GetStatus(em::DeviceStatusReportRequest* request) {
}
void DeviceStatusCollector::OnOSVersion(VersionLoader::Handle handle,
std::string version) {
const std::string& version) {
os_version_ = version;
}
void DeviceStatusCollector::OnOSFirmware(VersionLoader::Handle handle,
std::string version) {
const std::string& version) {
firmware_version_ = version;
}
......
......@@ -87,9 +87,9 @@ class DeviceStatusCollector : public content::NotificationObserver {
// Callbacks from chromeos::VersionLoader.
void OnOSVersion(chromeos::VersionLoader::Handle handle,
std::string version);
const std::string& version);
void OnOSFirmware(chromeos::VersionLoader::Handle handle,
std::string version);
const std::string& version);
// Helpers for the various portions of the status.
void GetActivityTimes(
......
......@@ -162,7 +162,7 @@ class ChromeOSAboutVersionHandler {
// Callback from chromeos::VersionLoader giving the version.
void OnVersion(chromeos::VersionLoader::Handle handle,
std::string version);
const std::string& version);
private:
// Where the results are fed to.
......@@ -1276,7 +1276,7 @@ ChromeOSAboutVersionHandler::ChromeOSAboutVersionHandler(
void ChromeOSAboutVersionHandler::OnVersion(
chromeos::VersionLoader::Handle handle,
std::string version) {
const std::string& version) {
DictionaryValue localized_strings;
localized_strings.SetString("os_version", version);
source_->FinishDataRequest(AboutVersionStrings(
......
......@@ -130,7 +130,8 @@ class RegisterPageHandler : public WebUIMessageHandler,
void HandleGetUserInfo(const ListValue* args);
// Callback from chromeos::VersionLoader giving the version.
void OnVersion(chromeos::VersionLoader::Handle handle, std::string version);
void OnVersion(chromeos::VersionLoader::Handle handle,
const std::string& version);
// Skips registration logging |error_msg| with log type ERROR.
void SkipRegistration(const std::string& error_msg);
......@@ -230,7 +231,7 @@ void RegisterPageHandler::HandleGetUserInfo(const ListValue* args) {
}
void RegisterPageHandler::OnVersion(chromeos::VersionLoader::Handle handle,
std::string version) {
const std::string& version) {
version_ = version;
SendUserInfo();
}
......
......@@ -393,14 +393,14 @@ void HelpHandler::SetPromotionState(VersionUpdater::PromotionState state) {
#if defined(OS_CHROMEOS)
void HelpHandler::OnOSVersion(chromeos::VersionLoader::Handle handle,
std::string version) {
const std::string& version) {
scoped_ptr<Value> version_string(Value::CreateStringValue(version));
web_ui()->CallJavascriptFunction("help.HelpPage.setOSVersion",
*version_string);
}
void HelpHandler::OnOSFirmware(chromeos::VersionLoader::Handle handle,
std::string firmware) {
const std::string& firmware) {
scoped_ptr<Value> firmware_string(Value::CreateStringValue(firmware));
web_ui()->CallJavascriptFunction("help.HelpPage.setOSFirmware",
*firmware_string);
......
......@@ -70,9 +70,10 @@ class HelpHandler : public content::WebUIMessageHandler,
#if defined(OS_CHROMEOS)
// Callbacks from VersionLoader.
void OnOSVersion(chromeos::VersionLoader::Handle handle, std::string version);
void OnOSVersion(chromeos::VersionLoader::Handle handle,
const std::string& version);
void OnOSFirmware(chromeos::VersionLoader::Handle handle,
std::string firmware);
const std::string& firmware);
void OnReleaseChannel(const std::string& channel);
void ProcessLsbFileInfo(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment