| Index: chrome/browser/chromeos/login/version_info_updater.cc
|
| diff --git a/chrome/browser/chromeos/login/version_info_updater.cc b/chrome/browser/chromeos/login/version_info_updater.cc
|
| index 72c068ba0bcfa19e51d0ad1a0f055ed525596bb1..c9b5b8e67ef8a04db1096b9218dc175d8ba1dca4 100644
|
| --- a/chrome/browser/chromeos/login/version_info_updater.cc
|
| +++ b/chrome/browser/chromeos/login/version_info_updater.cc
|
| @@ -16,8 +16,11 @@
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/chromeos/cros/cros_library.h"
|
| +#include "chrome/browser/chromeos/cros_settings.h"
|
| +#include "chrome/browser/chromeos/cros_settings_names.h"
|
| #include "chrome/browser/policy/browser_policy_connector.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| +#include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/chrome_version_info.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "grit/chromium_strings.h"
|
| @@ -29,11 +32,23 @@
|
|
|
| namespace chromeos {
|
|
|
| +namespace {
|
| +
|
| +const char* kReportingFlags[] = {
|
| + chromeos::kReportDeviceVersionInfo,
|
| + chromeos::kReportDeviceActivityTimes,
|
| + chromeos::kReportDeviceBootMode,
|
| +};
|
| +
|
| +}
|
| +
|
| ///////////////////////////////////////////////////////////////////////////////
|
| // VersionInfoUpdater public:
|
|
|
| VersionInfoUpdater::VersionInfoUpdater(Delegate* delegate)
|
| - : delegate_(delegate) {
|
| + : enterprise_reporting_hint_(false),
|
| + cros_settings_(chromeos::CrosSettings::Get()),
|
| + delegate_(delegate) {
|
| }
|
|
|
| VersionInfoUpdater::~VersionInfoUpdater() {
|
| @@ -72,6 +87,10 @@ void VersionInfoUpdater::StartUpdate(bool is_official_build) {
|
| // is already fetched and has finished initialization.
|
| UpdateEnterpriseInfo();
|
| }
|
| +
|
| + // Watch for changes to the reporting flags.
|
| + for (unsigned int i = 0; i < arraysize(kReportingFlags); ++i)
|
| + cros_settings_->AddSettingsObserver(kReportingFlags[i], this);
|
| }
|
|
|
| void VersionInfoUpdater::UpdateVersionLabel() {
|
| @@ -144,15 +163,29 @@ void VersionInfoUpdater::UpdateEnterpriseInfo() {
|
| }
|
| }
|
|
|
| - SetEnterpriseInfo(policy_connector->GetEnterpriseDomain(), status_text);
|
| + bool reporting_hint = false;
|
| + for (unsigned int i = 0; i < arraysize(kReportingFlags); ++i) {
|
| + bool enabled = false;
|
| + if (cros_settings_->GetBoolean(kReportingFlags[i], &enabled) && enabled) {
|
| + reporting_hint = true;
|
| + break;
|
| + }
|
| + }
|
| +
|
| + SetEnterpriseInfo(policy_connector->GetEnterpriseDomain(),
|
| + status_text,
|
| + reporting_hint);
|
| }
|
|
|
| void VersionInfoUpdater::SetEnterpriseInfo(const std::string& domain_name,
|
| - const std::string& status_text) {
|
| + const std::string& status_text,
|
| + bool reporting_hint) {
|
| if (domain_name != enterprise_domain_text_ ||
|
| - status_text != enterprise_status_text_) {
|
| + status_text != enterprise_status_text_ ||
|
| + reporting_hint != enterprise_reporting_hint_) {
|
| enterprise_domain_text_ = domain_name;
|
| enterprise_status_text_ = status_text;
|
| + enterprise_reporting_hint_ = enterprise_reporting_hint_;
|
| UpdateVersionLabel();
|
|
|
| // Update the notification about device status reporting.
|
| @@ -162,7 +195,7 @@ void VersionInfoUpdater::SetEnterpriseInfo(const std::string& domain_name,
|
| enterprise_info = l10n_util::GetStringFUTF8(
|
| IDS_LOGIN_MANAGED_BY_NOTICE,
|
| UTF8ToUTF16(enterprise_domain_text_));
|
| - delegate_->OnEnterpriseInfoUpdated(enterprise_info);
|
| + delegate_->OnEnterpriseInfoUpdated(enterprise_info, reporting_hint);
|
| }
|
| }
|
| }
|
| @@ -214,4 +247,14 @@ void VersionInfoUpdater::OnPolicyStateChanged(
|
| UpdateEnterpriseInfo();
|
| }
|
|
|
| +void VersionInfoUpdater::Observe(
|
| + int type,
|
| + const content::NotificationSource& source,
|
| + const content::NotificationDetails& details) {
|
| + if (type == chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED)
|
| + UpdateEnterpriseInfo();
|
| + else
|
| + NOTREACHED();
|
| +}
|
| +
|
| } // namespace chromeos
|
|
|