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) { ...@@ -20,7 +20,7 @@ void ConnectionManager::RemoveObserver(Observer* observer) {
void ConnectionManager::NotifyStatusChanged() { void ConnectionManager::NotifyStatusChanged() {
for (auto& observer : observer_list_) for (auto& observer : observer_list_)
observer.OnStatusChanged(); observer.OnConnectionStatusChanged();
} }
void ConnectionManager::NotifyMessageReceived(const std::string& payload) { void ConnectionManager::NotifyMessageReceived(const std::string& payload) {
......
...@@ -32,7 +32,7 @@ class ConnectionManager { ...@@ -32,7 +32,7 @@ class ConnectionManager {
~Observer() override = default; ~Observer() override = default;
// Called the status has changed; use GetStatus() to get the new status. // 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. // Called when a payload message has been received.
virtual void OnMessageReceived(const std::string& payload) {} virtual void OnMessageReceived(const std::string& payload) {}
......
...@@ -32,7 +32,7 @@ class FakeObserver : public ConnectionManager::Observer { ...@@ -32,7 +32,7 @@ class FakeObserver : public ConnectionManager::Observer {
const std::string& last_message() const { return last_message_; } const std::string& last_message() const { return last_message_; }
// ConnectionManager::Observer: // ConnectionManager::Observer:
void OnStatusChanged() override { ++status_changed_num_calls_; } void OnConnectionStatusChanged() override { ++status_changed_num_calls_; }
void OnMessageReceived(const std::string& payload) override { void OnMessageReceived(const std::string& payload) override {
last_message_ = payload; last_message_ = payload;
++message_received_num_calls_; ++message_received_num_calls_;
......
...@@ -21,7 +21,7 @@ void FeatureStatusProvider::RemoveObserver(Observer* observer) { ...@@ -21,7 +21,7 @@ void FeatureStatusProvider::RemoveObserver(Observer* observer) {
void FeatureStatusProvider::NotifyStatusChanged() { void FeatureStatusProvider::NotifyStatusChanged() {
for (auto& observer : observer_list_) for (auto& observer : observer_list_)
observer.OnStatusChanged(); observer.OnFeatureStatusChanged();
} }
} // namespace phonehub } // namespace phonehub
......
...@@ -21,7 +21,7 @@ class FeatureStatusProvider { ...@@ -21,7 +21,7 @@ class FeatureStatusProvider {
~Observer() override = default; ~Observer() override = default;
// Called when the status has changed; use GetStatus() for the new status. // Called when the status has changed; use GetStatus() for the new status.
virtual void OnStatusChanged() = 0; virtual void OnFeatureStatusChanged() = 0;
}; };
FeatureStatusProvider(const FeatureStatusProvider&) = delete; FeatureStatusProvider(const FeatureStatusProvider&) = delete;
......
...@@ -184,7 +184,7 @@ void FeatureStatusProviderImpl::OnBluetoothAdapterReceived( ...@@ -184,7 +184,7 @@ void FeatureStatusProviderImpl::OnBluetoothAdapterReceived(
UpdateStatus(); UpdateStatus();
} }
void FeatureStatusProviderImpl::OnStatusChanged() { void FeatureStatusProviderImpl::OnConnectionStatusChanged() {
UpdateStatus(); UpdateStatus();
} }
......
...@@ -64,7 +64,7 @@ class FeatureStatusProviderImpl ...@@ -64,7 +64,7 @@ class FeatureStatusProviderImpl
bool powered) override; bool powered) override;
// ConnectionManager::Observer: // ConnectionManager::Observer:
void OnStatusChanged() override; void OnConnectionStatusChanged() override;
device_sync::DeviceSyncClient* device_sync_client_; device_sync::DeviceSyncClient* device_sync_client_;
multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client_; multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client_;
......
...@@ -72,7 +72,7 @@ class FakeObserver : public FeatureStatusProvider::Observer { ...@@ -72,7 +72,7 @@ class FakeObserver : public FeatureStatusProvider::Observer {
size_t num_calls() const { return num_calls_; } size_t num_calls() const { return num_calls_; }
// FeatureStatusProvider::Observer: // FeatureStatusProvider::Observer:
void OnStatusChanged() override { ++num_calls_; } void OnFeatureStatusChanged() override { ++num_calls_; }
private: private:
size_t num_calls_ = 0; size_t num_calls_ = 0;
......
...@@ -21,7 +21,7 @@ void TetherController::RemoveObserver(Observer* observer) { ...@@ -21,7 +21,7 @@ void TetherController::RemoveObserver(Observer* observer) {
void TetherController::NotifyStatusChanged() { void TetherController::NotifyStatusChanged() {
for (auto& observer : observer_list_) for (auto& observer : observer_list_)
observer.OnStatusChanged(); observer.OnTetherStatusChanged();
} }
std::ostream& operator<<(std::ostream& stream, std::ostream& operator<<(std::ostream& stream,
......
...@@ -46,7 +46,7 @@ class TetherController { ...@@ -46,7 +46,7 @@ class TetherController {
~Observer() override = default; ~Observer() override = default;
// Called the status has changed; use GetStatus() to get the new status. // Called the status has changed; use GetStatus() to get the new status.
virtual void OnStatusChanged() = 0; virtual void OnTetherStatusChanged() = 0;
}; };
TetherController(const TetherController&) = delete; TetherController(const TetherController&) = delete;
......
...@@ -21,7 +21,7 @@ class FakeObserver : public TetherController::Observer { ...@@ -21,7 +21,7 @@ class FakeObserver : public TetherController::Observer {
size_t num_calls() const { return num_calls_; } size_t num_calls() const { return num_calls_; }
// TetherController::Observer: // TetherController::Observer:
void OnStatusChanged() override { ++num_calls_; } void OnTetherStatusChanged() override { ++num_calls_; }
private: private:
size_t num_calls_ = 0; 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