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