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

Unified Diff: chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc

Issue 2163683005: Change ChooserController::Observer to ChooserController::View (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 5 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/ui/bluetooth/bluetooth_chooser_controller.cc
diff --git a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc
index 7005be741f9c8b1d722f38d791d3297b4794720b..e212a7394fd190f34f144320030d8fb7cb5471b6 100644
--- a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc
+++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc
@@ -107,18 +107,20 @@ void BluetoothChooserController::OnAdapterPresenceChanged(
no_devices_text_ =
l10n_util::GetStringUTF16(IDS_BLUETOOTH_DEVICE_CHOOSER_ADAPTER_OFF);
status_text_ = base::string16();
- if (observer())
- observer()->OnAdapterEnabledChanged(
+ if (view()) {
+ view()->OnAdapterEnabledChanged(
false /* Bluetooth adapter is turned off */);
+ }
break;
case content::BluetoothChooser::AdapterPresence::POWERED_ON:
no_devices_text_ =
l10n_util::GetStringUTF16(IDS_DEVICE_CHOOSER_NO_DEVICES_FOUND_PROMPT);
status_text_ =
l10n_util::GetStringUTF16(IDS_BLUETOOTH_DEVICE_CHOOSER_RE_SCAN);
- if (observer())
- observer()->OnAdapterEnabledChanged(
+ if (view()) {
+ view()->OnAdapterEnabledChanged(
true /* Bluetooth adapter is turned on */);
+ }
break;
}
}
@@ -129,17 +131,19 @@ void BluetoothChooserController::OnDiscoveryStateChanged(
case content::BluetoothChooser::DiscoveryState::DISCOVERING:
status_text_ =
l10n_util::GetStringUTF16(IDS_BLUETOOTH_DEVICE_CHOOSER_SCANNING);
- if (observer())
- observer()->OnRefreshStateChanged(
+ if (view()) {
+ view()->OnRefreshStateChanged(
true /* Refreshing options is in progress */);
+ }
break;
case content::BluetoothChooser::DiscoveryState::IDLE:
case content::BluetoothChooser::DiscoveryState::FAILED_TO_START:
status_text_ =
l10n_util::GetStringUTF16(IDS_BLUETOOTH_DEVICE_CHOOSER_RE_SCAN);
- if (observer())
- observer()->OnRefreshStateChanged(
+ if (view()) {
+ view()->OnRefreshStateChanged(
false /* Refreshing options is complete */);
+ }
break;
}
}
@@ -148,8 +152,8 @@ void BluetoothChooserController::AddDevice(const std::string& device_id,
const base::string16& device_name) {
device_names_and_ids_.push_back(std::make_pair(device_name, device_id));
++device_name_map_[device_name];
- if (observer())
- observer()->OnOptionAdded(device_names_and_ids_.size() - 1);
+ if (view())
+ view()->OnOptionAdded(device_names_and_ids_.size() - 1);
}
void BluetoothChooserController::RemoveDevice(const std::string& device_id) {
@@ -161,8 +165,8 @@ void BluetoothChooserController::RemoveDevice(const std::string& device_id) {
if (--device_name_map_[it->first] == 0)
device_name_map_.erase(it->first);
device_names_and_ids_.erase(it);
- if (observer())
- observer()->OnOptionRemoved(index);
+ if (view())
+ view()->OnOptionRemoved(index);
return;
}
}
« no previous file with comments | « chrome/browser/chooser_controller/mock_chooser_controller.cc ('k') | chrome/browser/ui/cocoa/chooser_content_view_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698