Commit b97e0056 authored by Sorin Jianu's avatar Sorin Jianu Committed by Commit Bot

Revert "Migrate assistant_volume_control.mojom to the new Mojo types"

This reverts commit b0784c2f.

It's breaking the chrome bots at compile time, for example:

https://ci.chromium.org/p/chrome/builders/ci/chromeos-amd64-generic-google-rel/7364

../../chromeos/services/assistant/platform/volume_control_impl.cc -o obj/chromeos/services/assistant/lib/volume_control_impl.o
../../chromeos/services/assistant/platform/volume_control_impl.cc:26:23: error: no member named 'ash' in namespace 'mojo'; did you mean simply 'ash'?
  mojo::PendingRemote<mojo::ash::mojom::VolumeObserver> observer;
                      ^~~~~~~~~
                      ash
gen/ash/public/mojom/constants.mojom.h:45:11: note: 'ash' declared here
namespace ash {
          ^
../../chromeos/services/assistant/platform/volume_control_impl.cc:103:3: error: use of undeclared identifier 'volume_control_ptr_'; did you mean 'volume_control_'?
  volume_control_ptr_->SetVolume(new_volume * 100.0, user_initiated);
  ^~~~~~~~~~~~~~~~~~~
  volume_control_
../../chromeos/services/assistant/platform/volume_control_impl.h:48:52: note: 'volume_control_' declared here
  mojo::Remote<ash::mojom::AssistantVolumeControl> volume_control_;
                                                   ^
../../chromeos/services/assistant/platform/volume_control_impl.cc:108:3: error: use of undeclared identifier 'volume_control_ptr_'; did you mean 'volume_control_'?
  volume_control_ptr_->SetMuted(muted);
  ^~~~~~~~~~~~~~~~~~~
  volume_control_
../../chromeos/services/assistant/platform/volume_control_impl.h:48:52: note: 'volume_control_' declared here
  mojo::Remote<ash::mojom::AssistantVolumeControl> volume_control_;

Original change's description:
> Migrate assistant_volume_control.mojom to the new Mojo types
> 
> Convert the implementation and all users of the
> ash::mojom::AssistantVolumeControl and VolumeObserver interfaces.
> 
> Bug: 955171
> Change-Id: Id4fd8931ecc2d29eaff0b25defb909bf0f491aca
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795422
> Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
> Reviewed-by: Emily Stark <estark@chromium.org>
> Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
> Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
> Cr-Commit-Position: refs/heads/master@{#696007}

TBR=oshima@chromium.org,estark@chromium.org,hferreiro@igalia.com,oksamyt@chromium.org

Change-Id: I2eedac2da7539200787789a6436666b68bd067e8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 955171
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1800516Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696045}
parent 1ac9bd6c
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "ash/public/cpp/android_intent_helper.h" #include "ash/public/cpp/android_intent_helper.h"
#include "ash/public/cpp/ash_pref_names.h" #include "ash/public/cpp/ash_pref_names.h"
#include "ash/public/cpp/new_window_delegate.h" #include "ash/public/cpp/new_window_delegate.h"
#include "ash/public/mojom/assistant_volume_control.mojom.h"
#include "ash/session/session_controller_impl.h" #include "ash/session/session_controller_impl.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/shell_delegate.h" #include "ash/shell_delegate.h"
...@@ -22,10 +21,6 @@ ...@@ -22,10 +21,6 @@
#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
#include "chromeos/services/assistant/public/mojom/assistant.mojom.h" #include "chromeos/services/assistant/public/mojom/assistant.mojom.h"
#include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_registry_simple.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote_set.h"
#include "services/content/public/mojom/constants.mojom.h" #include "services/content/public/mojom/constants.mojom.h"
#include "services/content/public/mojom/navigable_contents_factory.mojom.h" #include "services/content/public/mojom/navigable_contents_factory.mojom.h"
#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/connector.h"
...@@ -40,7 +35,8 @@ constexpr char kAndroidIntentScheme[] = "intent"; ...@@ -40,7 +35,8 @@ constexpr char kAndroidIntentScheme[] = "intent";
} // namespace } // namespace
AssistantController::AssistantController() AssistantController::AssistantController()
: assistant_alarm_timer_controller_(this), : assistant_volume_control_binding_(this),
assistant_alarm_timer_controller_(this),
assistant_interaction_controller_(this), assistant_interaction_controller_(this),
assistant_notification_controller_(this), assistant_notification_controller_(this),
assistant_screen_context_controller_(this), assistant_screen_context_controller_(this),
...@@ -74,9 +70,9 @@ void AssistantController::BindRequest( ...@@ -74,9 +70,9 @@ void AssistantController::BindRequest(
assistant_controller_bindings_.AddBinding(this, std::move(request)); assistant_controller_bindings_.AddBinding(this, std::move(request));
} }
void AssistantController::BindReceiver( void AssistantController::BindRequest(
mojo::PendingReceiver<mojom::AssistantVolumeControl> receiver) { mojom::AssistantVolumeControlRequest request) {
assistant_volume_control_receiver_.Bind(std::move(receiver)); assistant_volume_control_binding_.Bind(std::move(request));
} }
void AssistantController::AddObserver(AssistantControllerObserver* observer) { void AssistantController::AddObserver(AssistantControllerObserver* observer) {
...@@ -204,9 +200,8 @@ void AssistantController::SetMuted(bool muted) { ...@@ -204,9 +200,8 @@ void AssistantController::SetMuted(bool muted) {
chromeos::CrasAudioHandler::Get()->SetOutputMute(muted); chromeos::CrasAudioHandler::Get()->SetOutputMute(muted);
} }
void AssistantController::AddVolumeObserver( void AssistantController::AddVolumeObserver(mojom::VolumeObserverPtr observer) {
mojo::PendingRemote<mojom::VolumeObserver> observer) { volume_observer_.AddPtr(std::move(observer));
volume_observers_.Add(std::move(observer));
int output_volume = int output_volume =
chromeos::CrasAudioHandler::Get()->GetOutputVolumePercent(); chromeos::CrasAudioHandler::Get()->GetOutputVolumePercent();
...@@ -216,14 +211,16 @@ void AssistantController::AddVolumeObserver( ...@@ -216,14 +211,16 @@ void AssistantController::AddVolumeObserver(
} }
void AssistantController::OnOutputMuteChanged(bool mute_on) { void AssistantController::OnOutputMuteChanged(bool mute_on) {
for (auto& observer : volume_observers_) volume_observer_.ForAllPtrs([mute_on](mojom::VolumeObserver* observer) {
observer->OnMuteStateChanged(mute_on); observer->OnMuteStateChanged(mute_on);
});
} }
void AssistantController::OnOutputNodeVolumeChanged(uint64_t node, int volume) { void AssistantController::OnOutputNodeVolumeChanged(uint64_t node, int volume) {
// |node| refers to the active volume device, which we don't care here. // |node| refers to the active volume device, which we don't care here.
for (auto& observer : volume_observers_) volume_observer_.ForAllPtrs([volume](mojom::VolumeObserver* observer) {
observer->OnVolumeChanged(volume); observer->OnVolumeChanged(volume);
});
} }
void AssistantController::OnAccessibilityStatusChanged() { void AssistantController::OnAccessibilityStatusChanged() {
...@@ -370,7 +367,7 @@ void AssistantController::BindStateController( ...@@ -370,7 +367,7 @@ void AssistantController::BindStateController(
void AssistantController::BindVolumeControl( void AssistantController::BindVolumeControl(
mojo::PendingReceiver<mojom::AssistantVolumeControl> receiver) { mojo::PendingReceiver<mojom::AssistantVolumeControl> receiver) {
Shell::Get()->assistant_controller()->BindReceiver(std::move(receiver)); Shell::Get()->assistant_controller()->BindRequest(std::move(receiver));
} }
base::WeakPtr<AssistantController> AssistantController::GetWeakPtr() { base::WeakPtr<AssistantController> AssistantController::GetWeakPtr() {
......
...@@ -33,10 +33,9 @@ ...@@ -33,10 +33,9 @@
#include "chromeos/services/assistant/public/mojom/assistant.mojom-forward.h" #include "chromeos/services/assistant/public/mojom/assistant.mojom-forward.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/interface_ptr_set.h"
#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote_set.h"
#include "services/content/public/mojom/navigable_contents_factory.mojom-forward.h" #include "services/content/public/mojom/navigable_contents_factory.mojom-forward.h"
class PrefRegistrySimple; class PrefRegistrySimple;
...@@ -68,8 +67,7 @@ class ASH_EXPORT AssistantController ...@@ -68,8 +67,7 @@ class ASH_EXPORT AssistantController
void BindRequest( void BindRequest(
chromeos::assistant::mojom::AssistantControllerRequest request); chromeos::assistant::mojom::AssistantControllerRequest request);
void BindReceiver( void BindRequest(mojom::AssistantVolumeControlRequest request);
mojo::PendingReceiver<mojom::AssistantVolumeControl> receiver);
// Adds/removes the specified |observer|. // Adds/removes the specified |observer|.
void AddObserver(AssistantControllerObserver* observer); void AddObserver(AssistantControllerObserver* observer);
...@@ -98,8 +96,7 @@ class ASH_EXPORT AssistantController ...@@ -98,8 +96,7 @@ class ASH_EXPORT AssistantController
// mojom::VolumeControl: // mojom::VolumeControl:
void SetVolume(int volume, bool user_initiated) override; void SetVolume(int volume, bool user_initiated) override;
void SetMuted(bool muted) override; void SetMuted(bool muted) override;
void AddVolumeObserver( void AddVolumeObserver(mojom::VolumeObserverPtr observer) override;
mojo::PendingRemote<mojom::VolumeObserver> observer) override;
// chromeos::CrasAudioHandler::AudioObserver: // chromeos::CrasAudioHandler::AudioObserver:
void OnOutputMuteChanged(bool mute_on) override; void OnOutputMuteChanged(bool mute_on) override;
...@@ -187,9 +184,9 @@ class ASH_EXPORT AssistantController ...@@ -187,9 +184,9 @@ class ASH_EXPORT AssistantController
mojo::BindingSet<chromeos::assistant::mojom::AssistantController> mojo::BindingSet<chromeos::assistant::mojom::AssistantController>
assistant_controller_bindings_; assistant_controller_bindings_;
mojo::Receiver<mojom::AssistantVolumeControl> mojo::Binding<mojom::AssistantVolumeControl>
assistant_volume_control_receiver_{this}; assistant_volume_control_binding_;
mojo::RemoteSet<mojom::VolumeObserver> volume_observers_; mojo::InterfacePtrSet<mojom::VolumeObserver> volume_observer_;
chromeos::assistant::mojom::AssistantPtr assistant_; chromeos::assistant::mojom::AssistantPtr assistant_;
......
...@@ -14,7 +14,7 @@ interface AssistantVolumeControl { ...@@ -14,7 +14,7 @@ interface AssistantVolumeControl {
// Adds volume observer. The observer will be immediately notified of volume // Adds volume observer. The observer will be immediately notified of volume
// and mute status when added. // and mute status when added.
AddVolumeObserver(pending_remote<VolumeObserver> observer); AddVolumeObserver(VolumeObserver observer);
}; };
// Observes volume state changes. // Observes volume state changes.
......
...@@ -6,12 +6,8 @@ ...@@ -6,12 +6,8 @@
#include <utility> #include <utility>
#include "ash/public/mojom/assistant_volume_control.mojom.h"
#include "ash/public/mojom/constants.mojom.h" #include "ash/public/mojom/constants.mojom.h"
#include "chromeos/services/assistant/media_session/assistant_media_session.h" #include "chromeos/services/assistant/media_session/assistant_media_session.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace chromeos { namespace chromeos {
namespace assistant { namespace assistant {
...@@ -19,13 +15,14 @@ namespace assistant { ...@@ -19,13 +15,14 @@ namespace assistant {
VolumeControlImpl::VolumeControlImpl(mojom::Client* client, VolumeControlImpl::VolumeControlImpl(mojom::Client* client,
AssistantMediaSession* media_session) AssistantMediaSession* media_session)
: media_session_(media_session), : media_session_(media_session),
binding_(this),
main_task_runner_(base::SequencedTaskRunnerHandle::Get()), main_task_runner_(base::SequencedTaskRunnerHandle::Get()),
weak_factory_(this) { weak_factory_(this) {
client->RequestAssistantVolumeControl( client->RequestAssistantVolumeControl(
volume_control_.BindNewPipeAndPassReceiver()); mojo::MakeRequest(&volume_control_ptr_));
mojo::PendingRemote<mojo::ash::mojom::VolumeObserver> observer; ash::mojom::VolumeObserverPtr observer;
receiver_.Bind(observer.InitWithNewPipeAndPassReceiver()); binding_.Bind(mojo::MakeRequest(&observer));
volume_control_->AddVolumeObserver(std::move(observer)); volume_control_ptr_->AddVolumeObserver(std::move(observer));
} }
VolumeControlImpl::~VolumeControlImpl() = default; VolumeControlImpl::~VolumeControlImpl() = default;
......
...@@ -9,8 +9,7 @@ ...@@ -9,8 +9,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "chromeos/services/assistant/public/mojom/assistant.mojom.h" #include "chromeos/services/assistant/public/mojom/assistant.mojom.h"
#include "libassistant/shared/public/platform_audio_output.h" #include "libassistant/shared/public/platform_audio_output.h"
#include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace chromeos { namespace chromeos {
namespace assistant { namespace assistant {
...@@ -45,8 +44,8 @@ class VolumeControlImpl : public assistant_client::VolumeControl, ...@@ -45,8 +44,8 @@ class VolumeControlImpl : public assistant_client::VolumeControl,
void SetSystemMutedOnMainThread(bool muted); void SetSystemMutedOnMainThread(bool muted);
AssistantMediaSession* media_session_; AssistantMediaSession* media_session_;
mojo::Remote<ash::mojom::AssistantVolumeControl> volume_control_; ash::mojom::AssistantVolumeControlPtr volume_control_ptr_;
mojo::Receiver<ash::mojom::VolumeObserver> receiver_{this}; mojo::Binding<ash::mojom::VolumeObserver> binding_;
scoped_refptr<base::SequencedTaskRunner> main_task_runner_; scoped_refptr<base::SequencedTaskRunner> main_task_runner_;
int volume_ = 100; int volume_ = 100;
......
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