Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2163)

Unified Diff: chrome/browser/chromeos/login/version_info_updater.cc

Issue 2876753003: Bootstrapping: Display Bluetooth name of CrOS device on OOBE screen. (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 00e4784e66d96c06119f71db1f823636ff2ffe03..96ee11b9f092813befaa95e0efdc63170f7942b8 100644
--- a/chrome/browser/chromeos/login/version_info_updater.cc
+++ b/chrome/browser/chromeos/login/version_info_updater.cc
@@ -23,6 +23,8 @@
#include "chromeos/settings/cros_settings_names.h"
#include "chromeos/system/statistics_provider.h"
#include "components/version_info/version_info.h"
+#include "device/bluetooth/bluetooth_adapter.h"
+#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "ui/base/l10n/l10n_util.h"
namespace chromeos {
@@ -39,6 +41,8 @@ const char* const kReportingFlags[] = {
// Strings used to generate the serial number part of the version string.
const char kSerialNumberPrefix[] = "SN:";
+// Strings used to generate the bluetooth device name.
+const char kBluetoothDeviceNamePrefix[] = "Bluetooth device name: ";
achuithb 2017/05/17 00:02:50 nit newline after this. This doesn't need to be l
xdai1 2017/05/17 23:55:43 I don't think it needs to be localized, especially
} // namespace
///////////////////////////////////////////////////////////////////////////////
@@ -92,6 +96,8 @@ void VersionInfoUpdater::StartUpdate(bool is_official_build) {
subscriptions_.push_back(
cros_settings_->AddSettingsObserver(kReportingFlags[i], callback));
}
+
+ UpdateDeviceInfo();
}
void VersionInfoUpdater::UpdateVersionLabel() {
@@ -146,6 +152,20 @@ void VersionInfoUpdater::OnVersion(const std::string& version) {
UpdateVersionLabel();
}
+void VersionInfoUpdater::UpdateDeviceInfo() {
achuithb 2017/05/17 00:02:50 Why not get rid of this function since it's just o
xdai1 2017/05/17 23:55:43 Done.
+ device::BluetoothAdapterFactory::GetAdapter(base::Bind(
+ &VersionInfoUpdater::OnGetAdapter, weak_pointer_factory_.GetWeakPtr()));
+}
+
+void VersionInfoUpdater::OnGetAdapter(
+ scoped_refptr<device::BluetoothAdapter> adapter) {
+ if (delegate_ && adapter->IsDiscoverable() && !adapter->GetName().empty()) {
+ std::string bluetooth_name_text = kBluetoothDeviceNamePrefix;
+ bluetooth_name_text.append(adapter->GetName());
+ delegate_->OnDeviceInfoUpdated(bluetooth_name_text);
achuithb 2017/05/17 00:02:50 Why not delegate_->OnDeviceInfoUpdated(kBluetoothD
xdai1 2017/05/17 23:55:44 Done.
+ }
+}
+
void VersionInfoUpdater::OnStoreLoaded(policy::CloudPolicyStore* store) {
UpdateEnterpriseInfo();
}

Powered by Google App Engine
This is Rietveld 408576698