Commit da984bd7 authored by Jimmy Gong's avatar Jimmy Gong Committed by Commit Bot

Update various OnStatusChanged to more relevant observer function names

There are several observers that have "OnStatusChanged" as a function
name. This change updates them to be more specific so that potential
listeners can implement the observers without any name conflicts.

Bug: 1106937
Change-Id: I111828f2d402b11daf2dca2b27df8f6a59786109
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2399130Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Jimmy Gong <jimmyxgong@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805435}
parent de83b74a
......@@ -20,7 +20,7 @@ void ConnectionManager::RemoveObserver(Observer* observer) {
void ConnectionManager::NotifyStatusChanged() {
for (auto& observer : observer_list_)
observer.OnStatusChanged();
observer.OnConnectionStatusChanged();
}
void ConnectionManager::NotifyMessageReceived(const std::string& payload) {
......
......@@ -32,7 +32,7 @@ class ConnectionManager {
~Observer() override = default;
// Called the status has changed; use GetStatus() to get the new status.
virtual void OnStatusChanged() {}
virtual void OnConnectionStatusChanged() {}
// Called when a payload message has been received.
virtual void OnMessageReceived(const std::string& payload) {}
......
......@@ -32,7 +32,7 @@ class FakeObserver : public ConnectionManager::Observer {
const std::string& last_message() const { return last_message_; }
// ConnectionManager::Observer:
void OnStatusChanged() override { ++status_changed_num_calls_; }
void OnConnectionStatusChanged() override { ++status_changed_num_calls_; }
void OnMessageReceived(const std::string& payload) override {
last_message_ = payload;
++message_received_num_calls_;
......
......@@ -21,7 +21,7 @@ void FeatureStatusProvider::RemoveObserver(Observer* observer) {
void FeatureStatusProvider::NotifyStatusChanged() {
for (auto& observer : observer_list_)
observer.OnStatusChanged();
observer.OnFeatureStatusChanged();
}
} // namespace phonehub
......
......@@ -21,7 +21,7 @@ class FeatureStatusProvider {
~Observer() override = default;
// Called when the status has changed; use GetStatus() for the new status.
virtual void OnStatusChanged() = 0;
virtual void OnFeatureStatusChanged() = 0;
};
FeatureStatusProvider(const FeatureStatusProvider&) = delete;
......
......@@ -184,7 +184,7 @@ void FeatureStatusProviderImpl::OnBluetoothAdapterReceived(
UpdateStatus();
}
void FeatureStatusProviderImpl::OnStatusChanged() {
void FeatureStatusProviderImpl::OnConnectionStatusChanged() {
UpdateStatus();
}
......
......@@ -64,7 +64,7 @@ class FeatureStatusProviderImpl
bool powered) override;
// ConnectionManager::Observer:
void OnStatusChanged() override;
void OnConnectionStatusChanged() override;
device_sync::DeviceSyncClient* device_sync_client_;
multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client_;
......
......@@ -72,7 +72,7 @@ class FakeObserver : public FeatureStatusProvider::Observer {
size_t num_calls() const { return num_calls_; }
// FeatureStatusProvider::Observer:
void OnStatusChanged() override { ++num_calls_; }
void OnFeatureStatusChanged() override { ++num_calls_; }
private:
size_t num_calls_ = 0;
......
......@@ -21,7 +21,7 @@ void TetherController::RemoveObserver(Observer* observer) {
void TetherController::NotifyStatusChanged() {
for (auto& observer : observer_list_)
observer.OnStatusChanged();
observer.OnTetherStatusChanged();
}
std::ostream& operator<<(std::ostream& stream,
......
......@@ -46,7 +46,7 @@ class TetherController {
~Observer() override = default;
// Called the status has changed; use GetStatus() to get the new status.
virtual void OnStatusChanged() = 0;
virtual void OnTetherStatusChanged() = 0;
};
TetherController(const TetherController&) = delete;
......
......@@ -21,7 +21,7 @@ class FakeObserver : public TetherController::Observer {
size_t num_calls() const { return num_calls_; }
// TetherController::Observer:
void OnStatusChanged() override { ++num_calls_; }
void OnTetherStatusChanged() override { ++num_calls_; }
private:
size_t num_calls_ = 0;
......
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