Migrate //chromeos/ash/services/libassistant to namespace ash [4/N]
This CL migrates to namespace ash from chromeos for top-level files. This CL is part of the Chrome OS source code directory migration: https://docs.google.com/document/d/1g-98HpzA8XcoGBWUv1gQNr4rbnD5yfvbtYZyPDDbkaE. Change-Id: I873edabdf5ecd35e29bd580c750afdd4c9404090 Bug: 1164001 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3893610 Reviewed-by: Hidehiko Abe <hidehiko@chromium.org> Reviewed-by: Tao Wu <wutao@chromium.org> Owners-Override: Hidehiko Abe <hidehiko@chromium.org> Commit-Queue: Yeunjoo Choi <ychoi@igalia.com> Cr-Commit-Position: refs/heads/main@{#1050029}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
e1d1a97062
commit
5dc9f1528a
chrome/utility
chromeos/ash/services
assistant
libassistant
abortable_task_list.ccabortable_task_list.haudio_input_controller.ccaudio_input_controller.haudio_input_controller_unittest.ccauthentication_state_observer_unittest.cccallback_utils.hchromium_api_delegate.ccchromium_api_delegate.hchromium_http_connection.ccchromium_http_connection.hconstants.ccconstants.hconversation_controller.ccconversation_controller.hconversation_controller_unittest.ccconversation_observer_unittest.ccconversation_state_listener_impl.ccconversation_state_listener_impl.hdevice_settings_controller.ccdevice_settings_controller.hdevice_settings_controller_unittest.ccdisplay_connection.ccdisplay_connection.hdisplay_controller.ccdisplay_controller.hdisplay_controller_unittest.ccfake_auth_provider.ccfake_auth_provider.hfile_provider_impl.ccfile_provider_impl.h
grpc
libassistant_factory.hlibassistant_loader_impl.cclibassistant_loader_impl.hlibassistant_loader_impl_unittest.cclibassistant_sandbox_hook.cclibassistant_sandbox_hook.hlibassistant_service.cclibassistant_service.hmedia_controller.ccmedia_controller.hmedia_controller_unittest.ccnetwork_provider_impl.ccnetwork_provider_impl.hnetwork_provider_impl_unittest.ccnotification_delegate_unittest.ccplatform_api.ccplatform_api.hpower_manager_provider_impl.ccpower_manager_provider_impl.hpower_manager_provider_impl_unittest.ccpublic
service_controller.ccservice_controller.hservice_controller_unittest.ccsettings_controller.ccsettings_controller.hsettings_controller_unittest.ccspeaker_id_enrollment_controller.ccspeaker_id_enrollment_controller.hspeaker_id_enrollment_controller_unittest.ccspeech_recognition_observer_unittest.ccsystem_provider_impl.ccsystem_provider_impl.hsystem_provider_impl_unittest.cctimer_controller.cctimer_controller.htimer_controller_unittest.ccutil.ccutil.hcontent/utility
@ -411,7 +411,7 @@ auto RunAssistantAudioDecoder(
|
||||
auto RunLibassistantService(
|
||||
mojo::PendingReceiver<chromeos::libassistant::mojom::LibassistantService>
|
||||
receiver) {
|
||||
return std::make_unique<chromeos::libassistant::LibassistantService>(
|
||||
return std::make_unique<ash::libassistant::LibassistantService>(
|
||||
std::move(receiver));
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_CROS_LIBASSISTANT)
|
||||
|
@ -35,9 +35,8 @@ void LibassistantServiceHostImpl::Launch(
|
||||
std::move(receiver));
|
||||
} else {
|
||||
DCHECK(!libassistant_service_);
|
||||
libassistant_service_ =
|
||||
std::make_unique<chromeos::libassistant::LibassistantService>(
|
||||
std::move(receiver));
|
||||
libassistant_service_ = std::make_unique<libassistant::LibassistantService>(
|
||||
std::move(receiver));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,13 +12,13 @@
|
||||
#include "chromeos/ash/components/assistant/buildflags.h"
|
||||
#include "chromeos/ash/services/assistant/libassistant_service_host.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace ash {
|
||||
|
||||
namespace libassistant {
|
||||
class LibassistantService;
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
}
|
||||
|
||||
namespace ash::assistant {
|
||||
namespace assistant {
|
||||
|
||||
// Host class controlling the lifetime of the Libassistant service.
|
||||
// The implementation will be stubbed out in the unbranded build.
|
||||
@ -38,11 +38,12 @@ class LibassistantServiceHostImpl : public LibassistantServiceHost {
|
||||
private:
|
||||
#if BUILDFLAG(ENABLE_CROS_LIBASSISTANT)
|
||||
SEQUENCE_CHECKER(sequence_checker_);
|
||||
std::unique_ptr<chromeos::libassistant::LibassistantService>
|
||||
libassistant_service_ GUARDED_BY_CONTEXT(sequence_checker_);
|
||||
std::unique_ptr<libassistant::LibassistantService> libassistant_service_
|
||||
GUARDED_BY_CONTEXT(sequence_checker_);
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace ash::assistant
|
||||
} // namespace assistant
|
||||
} // namespace ash
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_ASSISTANT_LIBASSISTANT_SERVICE_HOST_IMPL_H_
|
||||
|
@ -6,8 +6,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
AbortableTaskList::AbortableTaskList() = default;
|
||||
AbortableTaskList::~AbortableTaskList() {
|
||||
@ -38,5 +37,4 @@ void AbortableTaskList::RemoveFinishedTasks() {
|
||||
tasks_.end());
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -8,8 +8,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class AbortableTask {
|
||||
public:
|
||||
@ -49,7 +48,6 @@ class AbortableTaskList {
|
||||
std::vector<std::unique_ptr<AbortableTask>> tasks_;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_ABORTABLE_TASK_LIST_H_
|
||||
|
@ -6,8 +6,10 @@
|
||||
|
||||
#include "base/notreached.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
AudioInputController::AudioInputController() = default;
|
||||
|
||||
@ -63,5 +65,4 @@ AudioInputImpl& AudioInputController::audio_input() {
|
||||
return audio_input_provider().GetAudioInput();
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -12,13 +12,12 @@
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// Implementation of |mojom::AudioInputController| that will forward all calls
|
||||
// to a Libassistant V1 |assistant_client::AudioInputProvider| implementation.
|
||||
class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) AudioInputController
|
||||
: public mojom::AudioInputController {
|
||||
: public chromeos::libassistant::mojom::AudioInputController {
|
||||
public:
|
||||
using Resolution = assistant_client::ConversationStateListener::Resolution;
|
||||
|
||||
@ -27,8 +26,9 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) AudioInputController
|
||||
AudioInputController& operator=(AudioInputController&) = delete;
|
||||
~AudioInputController() override;
|
||||
|
||||
void Bind(mojo::PendingReceiver<mojom::AudioInputController> receiver,
|
||||
mojom::PlatformDelegate* platform_delegate);
|
||||
void Bind(mojo::PendingReceiver<
|
||||
chromeos::libassistant::mojom::AudioInputController> receiver,
|
||||
chromeos::libassistant::mojom::PlatformDelegate* platform_delegate);
|
||||
|
||||
// mojom::AudioInputController implementation:
|
||||
void SetMicOpen(bool mic_open) override;
|
||||
@ -36,7 +36,7 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) AudioInputController
|
||||
void SetDeviceId(const absl::optional<std::string>& device_id) override;
|
||||
void SetHotwordDeviceId(
|
||||
const absl::optional<std::string>& device_id) override;
|
||||
void SetLidState(mojom::LidState new_state) override;
|
||||
void SetLidState(chromeos::libassistant::mojom::LidState new_state) override;
|
||||
void OnConversationTurnStarted() override;
|
||||
|
||||
// Invoked when the current conversation turn has finished.
|
||||
@ -49,11 +49,11 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) AudioInputController
|
||||
private:
|
||||
AudioInputImpl& audio_input();
|
||||
|
||||
mojo::Receiver<mojom::AudioInputController> receiver_{this};
|
||||
mojo::Receiver<chromeos::libassistant::mojom::AudioInputController> receiver_{
|
||||
this};
|
||||
AudioInputProviderImpl audio_input_provider_;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_AUDIO_INPUT_CONTROLLER_H_
|
||||
|
@ -24,13 +24,14 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
using mojom::LidState;
|
||||
using ::chromeos::libassistant::mojom::LidState;
|
||||
using testing::_;
|
||||
using Resolution = assistant_client::ConversationStateListener::Resolution;
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
constexpr char kNormalDeviceId[] = "normal-device-id";
|
||||
constexpr char kHotwordDeviceId[] = "hotword-device-id";
|
||||
@ -592,5 +593,4 @@ TEST_P(AssistantAudioInputControllerTest, DSPTriggerredButSoftwareRejection) {
|
||||
EXPECT_EQ(GetOpenDeviceId(), kHotwordDeviceId);
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -12,8 +12,10 @@
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -22,12 +24,12 @@ namespace {
|
||||
// enum that defines these, and we don't want to hard code this list in the
|
||||
// test.
|
||||
std::vector<int> GetAuthenticationErrorCodes() {
|
||||
const int kMinErrorCode = assistant::GetLowestErrorCode();
|
||||
const int kMaxErrorCode = assistant::GetHighestErrorCode();
|
||||
const int kMinErrorCode = chromeos::assistant::GetLowestErrorCode();
|
||||
const int kMaxErrorCode = chromeos::assistant::GetHighestErrorCode();
|
||||
|
||||
std::vector<int> result;
|
||||
for (int code = kMinErrorCode; code <= kMaxErrorCode; ++code) {
|
||||
if (assistant::IsAuthError(code))
|
||||
if (chromeos::assistant::IsAuthError(code))
|
||||
result.push_back(code);
|
||||
}
|
||||
|
||||
@ -118,7 +120,7 @@ TEST_F(AuthenticationStateObserverTest, ShouldIgnoreNonAuthenticationErrors) {
|
||||
|
||||
// check to ensure these are not authentication errors.
|
||||
for (int code : non_authentication_errors)
|
||||
ASSERT_FALSE(assistant::IsAuthError(code));
|
||||
ASSERT_FALSE(chromeos::assistant::IsAuthError(code));
|
||||
|
||||
// Run the actual unittest
|
||||
for (int code : GetAuthenticationErrorCodes()) {
|
||||
@ -131,5 +133,4 @@ TEST_F(AuthenticationStateObserverTest, ShouldIgnoreNonAuthenticationErrors) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -12,8 +12,7 @@
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/threading/sequenced_task_runner_handle.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace internal {
|
||||
|
||||
@ -163,12 +162,6 @@ auto BindToCurrentSequenceRepeating(Functor&& functor, Args&&... args) {
|
||||
return BindToCurrentSequenceRepeating(callback);
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove when it moved to ash.
|
||||
namespace ash::libassistant {
|
||||
using ::chromeos::libassistant::ToStdFunction;
|
||||
}
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_CALLBACK_UTILS_H_
|
||||
|
@ -9,8 +9,7 @@
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
ChromiumApiDelegate::ChromiumApiDelegate(
|
||||
std::unique_ptr<network::PendingSharedURLLoaderFactory>
|
||||
@ -24,5 +23,4 @@ ChromiumApiDelegate::GetHttpConnectionFactory() {
|
||||
return &http_connection_factory_;
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -14,8 +14,7 @@ namespace network {
|
||||
class PendingSharedURLLoaderFactory;
|
||||
} // namespace network
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class ChromiumHttpConnectionFactory;
|
||||
|
||||
@ -39,7 +38,6 @@ class ChromiumApiDelegate : public assistant_client::ChromeOSApiDelegate {
|
||||
ChromiumHttpConnectionFactory http_connection_factory_;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_CHROMIUM_API_DELEGATE_H_
|
||||
|
@ -32,8 +32,7 @@ using network::SharedURLLoaderFactory;
|
||||
return; \
|
||||
}
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -412,5 +411,4 @@ HttpConnection* ChromiumHttpConnectionFactory::Create(
|
||||
return new ChromiumHttpConnection(url_loader_factory_->Clone(), delegate);
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -27,8 +27,7 @@ class SharedURLLoaderFactory;
|
||||
class PendingSharedURLLoaderFactory;
|
||||
} // namespace network
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// Implements libassistant's HttpConnection.
|
||||
class ChromiumHttpConnection
|
||||
@ -151,7 +150,6 @@ class ChromiumHttpConnectionFactory
|
||||
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_CHROMIUM_HTTP_CONNECTION_H_
|
||||
|
@ -13,8 +13,7 @@
|
||||
#define LIBASSISTANT_V1_NAME "libassistant.so"
|
||||
#define LIBASSISTANT_V2_NAME "libassistant_v2.so"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_DEVICE)
|
||||
const base::FilePath::CharType kAssistantBaseDirPath[] =
|
||||
@ -42,5 +41,4 @@ const base::FilePath::CharType kLibAssistantV2DlcPath[] =
|
||||
FILE_PATH_LITERAL(LIBASSISTANT_V2_NAME);
|
||||
#endif
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -8,8 +8,7 @@
|
||||
#include "base/component_export.h"
|
||||
#include "base/files/file_path.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// A directory to save Assistant config files.
|
||||
COMPONENT_EXPORT(LIBASSISTANT_CONSTANTS)
|
||||
@ -27,7 +26,6 @@ extern const base::FilePath::CharType kLibAssistantV1DlcPath[];
|
||||
COMPONENT_EXPORT(LIBASSISTANT_CONSTANTS)
|
||||
extern const base::FilePath::CharType kLibAssistantV2DlcPath[];
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_CONSTANTS_H_
|
||||
|
@ -22,12 +22,13 @@
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
using assistant::AssistantInteractionMetadata;
|
||||
using assistant::AssistantInteractionType;
|
||||
using assistant::AssistantQuerySource;
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -45,7 +46,7 @@ constexpr base::TimeDelta kStopInteractionDelayTime = base::Milliseconds(500);
|
||||
|
||||
// Helper function to convert |action::Suggestion| to |AssistantSuggestion|.
|
||||
std::vector<assistant::AssistantSuggestion> ToAssistantSuggestion(
|
||||
const std::vector<assistant::action::Suggestion>& suggestions) {
|
||||
const std::vector<chromeos::assistant::action::Suggestion>& suggestions) {
|
||||
std::vector<assistant::AssistantSuggestion> result;
|
||||
for (const auto& suggestion : suggestions) {
|
||||
assistant::AssistantSuggestion assistant_suggestion;
|
||||
@ -61,7 +62,7 @@ std::vector<assistant::AssistantSuggestion> ToAssistantSuggestion(
|
||||
|
||||
// Helper function to convert |action::Notification| to |AssistantNotification|.
|
||||
chromeos::assistant::AssistantNotification ToAssistantNotification(
|
||||
const assistant::action::Notification& notification) {
|
||||
const chromeos::assistant::action::Notification& notification) {
|
||||
chromeos::assistant::AssistantNotification assistant_notification;
|
||||
assistant_notification.title = notification.title;
|
||||
assistant_notification.message = notification.text;
|
||||
@ -201,9 +202,10 @@ class ConversationController::GrpcEventsObserver
|
||||
ConversationController::ConversationController()
|
||||
: receiver_(this),
|
||||
events_observer_(std::make_unique<GrpcEventsObserver>(this)),
|
||||
action_module_(std::make_unique<assistant::action::CrosActionModule>(
|
||||
assistant::features::IsAppSupportEnabled(),
|
||||
assistant::features::IsWaitSchedulingEnabled())),
|
||||
action_module_(
|
||||
std::make_unique<chromeos::assistant::action::CrosActionModule>(
|
||||
assistant::features::IsAppSupportEnabled(),
|
||||
assistant::features::IsWaitSchedulingEnabled())),
|
||||
mojom_task_runner_(base::SequencedTaskRunnerHandle::Get()) {
|
||||
action_module_->AddObserver(this);
|
||||
}
|
||||
@ -483,7 +485,7 @@ void ConversationController::OnShowContextualQueryFallback() {
|
||||
|
||||
// Called from Libassistant thread.
|
||||
void ConversationController::OnShowSuggestions(
|
||||
const std::vector<assistant::action::Suggestion>& suggestions) {
|
||||
const std::vector<chromeos::assistant::action::Suggestion>& suggestions) {
|
||||
ENSURE_MOJOM_THREAD(&ConversationController::OnShowSuggestions, suggestions);
|
||||
|
||||
for (auto& observer : observers_)
|
||||
@ -552,7 +554,7 @@ void ConversationController::OnScheduleWait(int id, int time_ms) {
|
||||
|
||||
// Called from Libassistant thread.
|
||||
void ConversationController::OnShowNotification(
|
||||
const assistant::action::Notification& notification) {
|
||||
const chromeos::assistant::action::Notification& notification) {
|
||||
ENSURE_MOJOM_THREAD(&ConversationController::OnShowNotification,
|
||||
notification);
|
||||
|
||||
@ -580,5 +582,4 @@ void ConversationController::MaybeStopPreviousInteraction() {
|
||||
stop_interaction_closure_->callback().Run();
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -11,8 +11,6 @@
|
||||
#include "base/component_export.h"
|
||||
#include "base/sequence_checker.h"
|
||||
#include "chromeos/ash/services/assistant/public/cpp/conversation_observer.h"
|
||||
// TODO(https://crbug.com/1164001): move to forward declaration
|
||||
#include "chromeos/ash/services/libassistant/grpc/assistant_client.h"
|
||||
#include "chromeos/ash/services/libassistant/grpc/assistant_client_observer.h"
|
||||
#include "chromeos/ash/services/libassistant/public/cpp/assistant_notification.h"
|
||||
#include "chromeos/ash/services/libassistant/public/mojom/authentication_state_observer.mojom.h"
|
||||
@ -23,17 +21,18 @@
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote_set.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace assistant {
|
||||
namespace action {
|
||||
namespace chromeos::assistant::action {
|
||||
class CrosActionModule;
|
||||
} // namespace action
|
||||
} // namespace assistant
|
||||
}
|
||||
|
||||
namespace ash {
|
||||
|
||||
class AssistantClient;
|
||||
|
||||
namespace libassistant {
|
||||
|
||||
class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) ConversationController
|
||||
: public mojom::ConversationController,
|
||||
: public chromeos::libassistant::mojom::ConversationController,
|
||||
public AssistantClientObserver,
|
||||
public chromeos::assistant::action::AssistantActionObserver,
|
||||
public chromeos::assistant::ConversationObserver {
|
||||
@ -48,8 +47,10 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) ConversationController
|
||||
~ConversationController() override;
|
||||
|
||||
void Bind(
|
||||
mojo::PendingReceiver<mojom::ConversationController> receiver,
|
||||
mojo::PendingRemote<mojom::NotificationDelegate> notification_delegate);
|
||||
mojo::PendingReceiver<
|
||||
chromeos::libassistant::mojom::ConversationController> receiver,
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::NotificationDelegate>
|
||||
notification_delegate);
|
||||
|
||||
void AddActionObserver(
|
||||
chromeos::assistant::action::AssistantActionObserver* observer);
|
||||
@ -77,7 +78,8 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) ConversationController
|
||||
void DismissNotification(AssistantNotification notification) override;
|
||||
void SendAssistantFeedback(const AssistantFeedback& feedback) override;
|
||||
void AddRemoteObserver(
|
||||
mojo::PendingRemote<mojom::ConversationObserver> observer) override;
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::ConversationObserver>
|
||||
observer) override;
|
||||
|
||||
// chromeos::assistant::action::AssistantActionObserver:
|
||||
void OnShowHtml(const std::string& html_content,
|
||||
@ -85,14 +87,15 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) ConversationController
|
||||
void OnShowText(const std::string& text) override;
|
||||
void OnShowContextualQueryFallback() override;
|
||||
void OnShowSuggestions(
|
||||
const std::vector<assistant::action::Suggestion>& suggestions) override;
|
||||
const std::vector<chromeos::assistant::action::Suggestion>& suggestions)
|
||||
override;
|
||||
void OnOpenUrl(const std::string& url, bool in_background) override;
|
||||
void OnOpenAndroidApp(
|
||||
const chromeos::assistant::AndroidAppInfo& app_info,
|
||||
const chromeos::assistant::InteractionInfo& interaction) override;
|
||||
void OnScheduleWait(int id, int time_ms) override;
|
||||
void OnShowNotification(
|
||||
const assistant::action::Notification& notification) override;
|
||||
const chromeos::assistant::action::Notification& notification) override;
|
||||
|
||||
// chromeos::assistant::ConversationObserver:
|
||||
void OnInteractionStarted(
|
||||
@ -101,11 +104,12 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) ConversationController
|
||||
void OnInteractionFinished(
|
||||
chromeos::assistant::AssistantInteractionResolution resolution) override;
|
||||
|
||||
const mojo::RemoteSet<mojom::ConversationObserver>* conversation_observers() {
|
||||
const mojo::RemoteSet<chromeos::libassistant::mojom::ConversationObserver>*
|
||||
conversation_observers() {
|
||||
return &observers_;
|
||||
}
|
||||
|
||||
assistant::action::CrosActionModule* action_module() {
|
||||
chromeos::assistant::action::CrosActionModule* action_module() {
|
||||
return action_module_.get();
|
||||
}
|
||||
|
||||
@ -114,11 +118,14 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) ConversationController
|
||||
|
||||
void MaybeStopPreviousInteraction();
|
||||
|
||||
mojo::Receiver<mojom::ConversationController> receiver_;
|
||||
mojo::RemoteSet<mojom::ConversationObserver> observers_;
|
||||
mojo::RemoteSet<mojom::AuthenticationStateObserver>
|
||||
mojo::Receiver<chromeos::libassistant::mojom::ConversationController>
|
||||
receiver_;
|
||||
mojo::RemoteSet<chromeos::libassistant::mojom::ConversationObserver>
|
||||
observers_;
|
||||
mojo::RemoteSet<chromeos::libassistant::mojom::AuthenticationStateObserver>
|
||||
authentication_state_observers_;
|
||||
mojo::Remote<mojom::NotificationDelegate> notification_delegate_;
|
||||
mojo::Remote<chromeos::libassistant::mojom::NotificationDelegate>
|
||||
notification_delegate_;
|
||||
|
||||
// Owned by ServiceController.
|
||||
// Set in `OnAssistantClientCreated()` and unset in
|
||||
@ -130,7 +137,7 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) ConversationController
|
||||
bool requests_are_allowed_ = false;
|
||||
|
||||
std::unique_ptr<GrpcEventsObserver> events_observer_;
|
||||
std::unique_ptr<assistant::action::CrosActionModule> action_module_;
|
||||
std::unique_ptr<chromeos::assistant::action::CrosActionModule> action_module_;
|
||||
|
||||
std::unique_ptr<base::CancelableOnceClosure> stop_interaction_closure_;
|
||||
base::TimeDelta stop_interaction_delay_ = base::Milliseconds(500);
|
||||
@ -140,6 +147,6 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) ConversationController
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_CONVERSATION_CONTROLLER_H_
|
||||
|
@ -10,16 +10,16 @@
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
class AssistantClientMock : public FakeAssistantClient {
|
||||
public:
|
||||
AssistantClientMock(
|
||||
std::unique_ptr<assistant::FakeAssistantManager> assistant_manager,
|
||||
assistant::FakeAssistantManagerInternal* assistant_manager_internal)
|
||||
AssistantClientMock(std::unique_ptr<chromeos::assistant::FakeAssistantManager>
|
||||
assistant_manager,
|
||||
chromeos::assistant::FakeAssistantManagerInternal*
|
||||
assistant_manager_internal)
|
||||
: FakeAssistantClient(std::move(assistant_manager),
|
||||
assistant_manager_internal) {}
|
||||
~AssistantClientMock() override = default;
|
||||
@ -112,5 +112,4 @@ TEST_F(ConversationControllerTest,
|
||||
controller().StartEditReminderInteraction("client-id");
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -17,8 +17,10 @@
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -26,7 +28,7 @@ namespace {
|
||||
class CrosActionModuleHelper {
|
||||
public:
|
||||
explicit CrosActionModuleHelper(
|
||||
assistant::action::CrosActionModule* action_module)
|
||||
chromeos::assistant::action::CrosActionModule* action_module)
|
||||
: action_module_(*action_module) {}
|
||||
CrosActionModuleHelper(const CrosActionModuleHelper&) = delete;
|
||||
CrosActionModuleHelper& operator=(const CrosActionModuleHelper&) = delete;
|
||||
@ -43,7 +45,7 @@ class CrosActionModuleHelper {
|
||||
}
|
||||
|
||||
void ShowSuggestions(
|
||||
const std::vector<assistant::action::Suggestion>& suggestions) {
|
||||
const std::vector<chromeos::assistant::action::Suggestion>& suggestions) {
|
||||
for (auto* observer : action_observers())
|
||||
observer->OnShowSuggestions(suggestions);
|
||||
}
|
||||
@ -54,7 +56,7 @@ class CrosActionModuleHelper {
|
||||
}
|
||||
|
||||
void OpenAndroidApp(const assistant::AndroidAppInfo& app_info) {
|
||||
assistant::InteractionInfo info{};
|
||||
chromeos::assistant::InteractionInfo info{};
|
||||
for (auto* observer : action_observers())
|
||||
observer->OnOpenAndroidApp(app_info, info);
|
||||
}
|
||||
@ -65,12 +67,12 @@ class CrosActionModuleHelper {
|
||||
}
|
||||
|
||||
private:
|
||||
const std::vector<assistant::action::AssistantActionObserver*>&
|
||||
const std::vector<chromeos::assistant::action::AssistantActionObserver*>&
|
||||
action_observers() {
|
||||
return action_module_.GetActionObserversForTesting();
|
||||
}
|
||||
|
||||
const assistant::action::CrosActionModule& action_module_;
|
||||
const chromeos::assistant::action::CrosActionModule& action_module_;
|
||||
};
|
||||
|
||||
class ConversationObserverMock : public mojom::ConversationObserver {
|
||||
@ -132,7 +134,7 @@ class AssistantConversationObserverTest : public ::testing::Test {
|
||||
controller().OnAssistantClientRunning(&service_tester_.assistant_client());
|
||||
|
||||
action_module_helper_ = std::make_unique<CrosActionModuleHelper>(
|
||||
static_cast<assistant::action::CrosActionModule*>(
|
||||
static_cast<chromeos::assistant::action::CrosActionModule*>(
|
||||
service_tester_.assistant_manager_internal().action_module()));
|
||||
}
|
||||
|
||||
@ -218,7 +220,7 @@ TEST_F(AssistantConversationObserverTest, ShouldReceiveOnSuggestionsResponse) {
|
||||
const std::string fake_text = "text";
|
||||
const std::string fake_icon_url = "https://icon-url/";
|
||||
const std::string fake_action_url = "https://action-url/";
|
||||
std::vector<assistant::action::Suggestion> fake_suggestions{
|
||||
std::vector<chromeos::assistant::action::Suggestion> fake_suggestions{
|
||||
{fake_text, fake_icon_url, fake_action_url}};
|
||||
|
||||
EXPECT_CALL(observer_mock(), OnSuggestionsResponse)
|
||||
@ -271,5 +273,4 @@ TEST_F(AssistantConversationObserverTest, ShouldReceiveOnWaitStarted) {
|
||||
observer_mock().FlushForTesting();
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -11,8 +11,10 @@
|
||||
#include "chromeos/ash/services/libassistant/public/mojom/speech_recognition_observer.mojom.h"
|
||||
#include "chromeos/assistant/internal/libassistant/shared_headers.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -140,5 +142,4 @@ void ConversationStateListenerImpl::NotifyInteractionFinished(
|
||||
observer->OnInteractionFinished(resolution);
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -21,8 +21,7 @@ class SpeechRecognitionObserver;
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class AudioInputController;
|
||||
|
||||
@ -31,9 +30,10 @@ class ConversationStateListenerImpl
|
||||
public AssistantClientObserver {
|
||||
public:
|
||||
ConversationStateListenerImpl(
|
||||
mojo::RemoteSet<mojom::SpeechRecognitionObserver>*
|
||||
mojo::RemoteSet<chromeos::libassistant::mojom::SpeechRecognitionObserver>*
|
||||
speech_recognition_observers,
|
||||
const mojo::RemoteSet<mojom::ConversationObserver>*
|
||||
const mojo::RemoteSet<
|
||||
chromeos::libassistant::mojom::ConversationObserver>*
|
||||
conversation_observers,
|
||||
AudioInputController* audio_input_controller);
|
||||
ConversationStateListenerImpl(const ConversationStateListenerImpl&) = delete;
|
||||
@ -58,11 +58,12 @@ class ConversationStateListenerImpl
|
||||
assistant::AssistantInteractionResolution resolution);
|
||||
|
||||
// Owned by |LibassistantService|.
|
||||
mojo::RemoteSet<mojom::SpeechRecognitionObserver>&
|
||||
mojo::RemoteSet<chromeos::libassistant::mojom::SpeechRecognitionObserver>&
|
||||
speech_recognition_observers_;
|
||||
|
||||
// Owned by |ConversationController|.
|
||||
const mojo::RemoteSet<mojom::ConversationObserver>& conversation_observers_;
|
||||
const mojo::RemoteSet<chromeos::libassistant::mojom::ConversationObserver>&
|
||||
conversation_observers_;
|
||||
|
||||
AudioInputController* const audio_input_controller_ = nullptr;
|
||||
|
||||
@ -75,7 +76,6 @@ class ConversationStateListenerImpl
|
||||
base::WeakPtrFactory<ConversationStateListenerImpl> weak_factory_{this};
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_CONVERSATION_STATE_LISTENER_IMPL_H_
|
||||
|
@ -23,8 +23,10 @@ namespace client_op = ::assistant::api::client_op;
|
||||
using chromeos::libassistant::mojom::DeviceSettingsDelegate;
|
||||
using chromeos::libassistant::mojom::GetBrightnessResultPtr;
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
namespace {
|
||||
// A macro which ensures we are running on the main thread.
|
||||
@ -313,12 +315,11 @@ void DeviceSettingsController::OnGetDeviceSettings(
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<assistant::DeviceSetting> result =
|
||||
std::vector<chromeos::assistant::DeviceSetting> result =
|
||||
GetSupportedDeviceSettings(args);
|
||||
|
||||
auto interaction_proto =
|
||||
chromeos::libassistant::CreateGetDeviceSettingInteraction(interaction_id,
|
||||
result);
|
||||
auto interaction_proto = ash::libassistant::CreateGetDeviceSettingInteraction(
|
||||
interaction_id, result);
|
||||
|
||||
::assistant::api::VoicelessOptions options;
|
||||
options.set_is_user_initiated(true);
|
||||
@ -356,5 +357,4 @@ void DeviceSettingsController::AddSetting(std::unique_ptr<Setting> setting) {
|
||||
settings_.push_back(std::move(setting));
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include "base/component_export.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
// TODO(https://crbug.com/1164001): move to forward declaration
|
||||
#include "chromeos/ash/services/libassistant/grpc/assistant_client.h"
|
||||
#include "chromeos/ash/services/libassistant/grpc/assistant_client_observer.h"
|
||||
#include "chromeos/ash/services/libassistant/public/mojom/device_settings_delegate.mojom.h"
|
||||
#include "chromeos/assistant/internal/action/assistant_action_observer.h"
|
||||
@ -35,9 +33,9 @@ struct DeviceSetting;
|
||||
} // namespace assistant
|
||||
} // namespace chromeos
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class AssistantClient;
|
||||
class Setting;
|
||||
|
||||
class DeviceSettingsController
|
||||
@ -49,7 +47,9 @@ class DeviceSettingsController
|
||||
DeviceSettingsController& operator=(DeviceSettingsController&) = delete;
|
||||
~DeviceSettingsController() override;
|
||||
|
||||
void Bind(mojo::PendingRemote<mojom::DeviceSettingsDelegate> delegate);
|
||||
void Bind(
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::DeviceSettingsDelegate>
|
||||
delegate);
|
||||
|
||||
// chromeos::assistant::action::AssistantActionObserver implementation:
|
||||
void OnModifyDeviceSetting(
|
||||
@ -74,12 +74,11 @@ class DeviceSettingsController
|
||||
|
||||
std::vector<std::unique_ptr<Setting>> settings_;
|
||||
AssistantClient* assistant_client_ = nullptr;
|
||||
mojo::Remote<mojom::DeviceSettingsDelegate> remote_;
|
||||
mojo::Remote<chromeos::libassistant::mojom::DeviceSettingsDelegate> remote_;
|
||||
scoped_refptr<base::SequencedTaskRunner> mojom_task_runner_;
|
||||
base::WeakPtrFactory<DeviceSettingsController> weak_factory_{this};
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_DEVICE_SETTINGS_CONTROLLER_H_
|
||||
|
@ -35,8 +35,7 @@ void PrintTo(const DeviceSetting& settings, std::ostream* out) {
|
||||
} // namespace assistant
|
||||
} // namespace chromeos
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -53,6 +52,8 @@ using ::testing::ElementsAre;
|
||||
using ::testing::FloatNear;
|
||||
using ::testing::Return;
|
||||
using ::testing::StrictMock;
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
constexpr char kWiFi[] = "WIFI";
|
||||
constexpr char kBluetooth[] = "BLUETOOTH";
|
||||
@ -279,5 +280,4 @@ TEST_F(AssistantDeviceSettingsControllerTest,
|
||||
ModifySetting(args);
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -12,8 +12,7 @@
|
||||
#include "chromeos/ash/services/libassistant/grpc/assistant_client.h"
|
||||
#include "chromeos/assistant/internal/proto/shared/proto/v2/display_interface.pb.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
DisplayConnection::DisplayConnection(DisplayConnectionObserver* observer,
|
||||
bool feedback_ui_enabled)
|
||||
@ -143,5 +142,4 @@ void DisplayConnection::FillDisplayRequest(
|
||||
MEDIA_SESSION_DETECTION_DISABLED_SCREEN_CONTEXT);
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -8,16 +8,15 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
// TODO(https://crbug.com/1164001): move to forward declaration
|
||||
#include "chromeos/ash/services/libassistant/grpc/assistant_client.h"
|
||||
#include "chromeos/ash/services/libassistant/grpc/external_services/grpc_services_observer.h"
|
||||
#include "chromeos/ash/services/libassistant/public/cpp/android_app_info.h"
|
||||
#include "chromeos/assistant/internal/libassistant/shared_headers.h"
|
||||
#include "chromeos/assistant/internal/proto/assistant/display_connection.pb.h"
|
||||
#include "chromeos/assistant/internal/proto/shared/proto/v2/delegate/event_handler_interface.pb.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class AssistantClient;
|
||||
|
||||
class DisplayConnectionObserver {
|
||||
public:
|
||||
@ -81,7 +80,6 @@ class DisplayConnection
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner_;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_DISPLAY_CONNECTION_H_
|
||||
|
@ -16,8 +16,10 @@
|
||||
#include "chromeos/assistant/internal/libassistant/shared_headers.h"
|
||||
#include "chromeos/assistant/internal/proto/shared/proto/v2/internal_options.pb.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
namespace {
|
||||
// A macro which ensures we are running on the main thread.
|
||||
@ -123,7 +125,7 @@ void DisplayController::OnVerifyAndroidApp(
|
||||
}
|
||||
|
||||
auto interaction_proto =
|
||||
chromeos::libassistant::CreateVerifyProviderResponseInteraction(
|
||||
ash::libassistant::CreateVerifyProviderResponseInteraction(
|
||||
interaction.interaction_id, result_apps_info);
|
||||
|
||||
::assistant::api::VoicelessOptions options;
|
||||
@ -152,5 +154,4 @@ chromeos::assistant::AppStatus DisplayController::GetAndroidAppStatus(
|
||||
return assistant::AppStatus::kUnavailable;
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -28,23 +28,25 @@ class CrosActionModule;
|
||||
} // namespace assistant
|
||||
} // namespace chromeos
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class DisplayConnection;
|
||||
|
||||
class DisplayController
|
||||
: public mojom::DisplayController,
|
||||
: public chromeos::libassistant::mojom::DisplayController,
|
||||
public AssistantClientObserver,
|
||||
public chromeos::assistant::action::AssistantActionObserver {
|
||||
public:
|
||||
explicit DisplayController(mojo::RemoteSet<mojom::SpeechRecognitionObserver>*
|
||||
speech_recognition_observers);
|
||||
explicit DisplayController(
|
||||
mojo::RemoteSet<chromeos::libassistant::mojom::SpeechRecognitionObserver>*
|
||||
speech_recognition_observers);
|
||||
DisplayController(const DisplayController&) = delete;
|
||||
DisplayController& operator=(const DisplayController&) = delete;
|
||||
~DisplayController() override;
|
||||
|
||||
void Bind(mojo::PendingReceiver<mojom::DisplayController> receiver);
|
||||
void Bind(
|
||||
mojo::PendingReceiver<chromeos::libassistant::mojom::DisplayController>
|
||||
receiver);
|
||||
|
||||
void SetActionModule(
|
||||
chromeos::assistant::action::CrosActionModule* action_module);
|
||||
@ -73,12 +75,13 @@ class DisplayController
|
||||
chromeos::assistant::AppStatus GetAndroidAppStatus(
|
||||
const std::string& package_name);
|
||||
|
||||
mojo::Receiver<mojom::DisplayController> receiver_{this};
|
||||
mojo::Receiver<chromeos::libassistant::mojom::DisplayController> receiver_{
|
||||
this};
|
||||
std::unique_ptr<EventObserver> event_observer_;
|
||||
std::unique_ptr<DisplayConnection> display_connection_;
|
||||
|
||||
// Owned by |LibassistantService|.
|
||||
mojo::RemoteSet<mojom::SpeechRecognitionObserver>&
|
||||
mojo::RemoteSet<chromeos::libassistant::mojom::SpeechRecognitionObserver>&
|
||||
speech_recognition_observers_;
|
||||
|
||||
AssistantClient* assistant_client_ = nullptr;
|
||||
@ -95,7 +98,6 @@ class DisplayController
|
||||
base::WeakPtrFactory<DisplayController> weak_factory_{this};
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_DISPLAY_CONTROLLER_H_
|
||||
|
@ -12,13 +12,14 @@
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
using chromeos::assistant::AndroidAppInfo;
|
||||
using chromeos::assistant::InteractionInfo;
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
constexpr int kSampleInteractionId = 123;
|
||||
constexpr char kSampleUserId[] = "user-id";
|
||||
@ -26,9 +27,10 @@ constexpr char kSamplePackageName[] = "app.test";
|
||||
|
||||
class AssistantClientMock : public FakeAssistantClient {
|
||||
public:
|
||||
AssistantClientMock(
|
||||
std::unique_ptr<assistant::FakeAssistantManager> assistant_manager,
|
||||
assistant::FakeAssistantManagerInternal* assistant_manager_internal)
|
||||
AssistantClientMock(std::unique_ptr<chromeos::assistant::FakeAssistantManager>
|
||||
assistant_manager,
|
||||
chromeos::assistant::FakeAssistantManagerInternal*
|
||||
assistant_manager_internal)
|
||||
: FakeAssistantClient(std::move(assistant_manager),
|
||||
assistant_manager_internal) {}
|
||||
~AssistantClientMock() override = default;
|
||||
@ -96,5 +98,4 @@ TEST_F(DisplayControllerTest,
|
||||
controller()->OnVerifyAndroidApp({app_info}, interaction);
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -4,8 +4,7 @@
|
||||
|
||||
#include "chromeos/ash/services/libassistant/fake_auth_provider.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
std::string FakeAuthProvider::GetAuthClientId() {
|
||||
return "kFakeClientId";
|
||||
@ -43,5 +42,4 @@ void FakeAuthProvider::RemoveCredentialKey(const std::string& key_identifier) {}
|
||||
|
||||
void FakeAuthProvider::Reset() {}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -10,8 +10,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// ChromeOS does not use auth manager, so we don't yet need to implement a
|
||||
// real auth provider.
|
||||
@ -45,7 +44,6 @@ class FakeAuthProvider : public assistant_client::AuthProvider {
|
||||
void Reset() override;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_FAKE_AUTH_PROVIDER_H_
|
||||
|
@ -9,8 +9,7 @@
|
||||
#include "chromeos/ash/services/libassistant/util.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
namespace {
|
||||
|
||||
constexpr int kReadFileSizeLimitInBytes = 10 * 1024 * 1024;
|
||||
@ -98,5 +97,4 @@ bool FileProviderImpl::GetResource(uint16_t resource_id, std::string* out) {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -10,8 +10,7 @@
|
||||
#include "base/files/file_path.h"
|
||||
#include "chromeos/assistant/internal/libassistant/shared_headers.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class FileProviderImpl : public assistant_client::FileProvider {
|
||||
public:
|
||||
@ -36,7 +35,6 @@ class FileProviderImpl : public assistant_client::FileProvider {
|
||||
const base::FilePath root_path_;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_FILE_PROVIDER_IMPL_H_
|
||||
|
@ -45,13 +45,6 @@ using ::assistant::api::UpdateAssistantSettingsResponse;
|
||||
using ::assistant::api::events::SpeakerIdEnrollmentEvent;
|
||||
using ::assistant::ui::SettingsUiUpdate;
|
||||
using assistant_client::SpeakerIdEnrollmentUpdate;
|
||||
using ::chromeos::libassistant::AdaptCallback;
|
||||
using ::chromeos::libassistant::BindToCurrentSequence;
|
||||
using ::chromeos::libassistant::BindToCurrentSequenceRepeating;
|
||||
using ::chromeos::libassistant::PopulateInternalOptionsFromProto;
|
||||
using ::chromeos::libassistant::PopulateVoicelessOptionsFromProto;
|
||||
using ::chromeos::libassistant::ToStdFunction;
|
||||
using ::chromeos::libassistant::ToStdFunctionRepeating;
|
||||
|
||||
// A macro which ensures we are running on the calling sequence.
|
||||
#define ENSURE_CALLING_SEQUENCE(method, ...) \
|
||||
@ -111,7 +104,7 @@ OnSpeakerIdEnrollmentEventRequest ConvertToGrpcEventRequest(
|
||||
auto* options = assistant_manager_internal->CreateDefaultInternalOptions();
|
||||
auto proto = chromeos::assistant::CreateInternalOptionsProto(
|
||||
locale, spoken_feedback_enabled);
|
||||
PopulateInternalOptionsFromProto(proto, options);
|
||||
chromeos::libassistant::PopulateInternalOptionsFromProto(proto, options);
|
||||
|
||||
chromeos::assistant::SetDarkModeEnabledForV1(options, dark_mode_enabled);
|
||||
chromeos::assistant::SetTimezoneOverrideForV1(options);
|
||||
@ -468,7 +461,8 @@ void AssistantClientV1::SendVoicelessInteraction(
|
||||
const ::assistant::api::VoicelessOptions& options,
|
||||
base::OnceCallback<void(bool)> on_done) {
|
||||
assistant_client::VoicelessOptions voiceless_options;
|
||||
PopulateVoicelessOptionsFromProto(options, &voiceless_options);
|
||||
chromeos::libassistant::PopulateVoicelessOptionsFromProto(options,
|
||||
&voiceless_options);
|
||||
assistant_manager_internal()->SendVoicelessInteraction(
|
||||
interaction.SerializeAsString(), description, voiceless_options,
|
||||
[callback = std::move(on_done)](bool result) mutable {
|
||||
|
@ -15,8 +15,7 @@ class AssistantManager;
|
||||
class AssistantManagerInternal;
|
||||
} // namespace assistant_client
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// Factory class that creates the main actual Libassistant classes.
|
||||
// Can be replaced with a fake for unittests.
|
||||
@ -32,12 +31,6 @@ class LibassistantFactory {
|
||||
assistant_client::AssistantManager* assistant_manager) = 0;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove when it moved to ash.
|
||||
namespace ash::libassistant {
|
||||
using ::chromeos::libassistant::LibassistantFactory;
|
||||
}
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_FACTORY_H_
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "chromeos/ash/services/libassistant/constants.h"
|
||||
#include "third_party/cros_system_api/dbus/dlcservice/dbus-constants.h"
|
||||
|
||||
namespace chromeos::libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -212,6 +212,10 @@ LibassistantLoaderImpl* LibassistantLoaderImpl::GetInstance() {
|
||||
return instance.get();
|
||||
}
|
||||
|
||||
} // namespace ash::libassistant
|
||||
|
||||
namespace chromeos::libassistant {
|
||||
|
||||
// static
|
||||
void LibassistantLoader::Load(LoadCallback callback) {
|
||||
LibassistantLoaderImpl::GetInstance()->Load(std::move(callback));
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "net/base/backoff_entry.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace chromeos::libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
using EntryPoint = assistant_client::internal_api::LibassistantEntrypoint;
|
||||
|
||||
@ -71,6 +71,11 @@ class COMPONENT_EXPORT(LIBASSISTANT_LOADER) LibassistantLoaderImpl
|
||||
base::WeakPtrFactory<LibassistantLoaderImpl> weak_factory_{this};
|
||||
};
|
||||
|
||||
} // namespace chromeos::libassistant
|
||||
} // namespace ash::libassistant
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove when the migration is finished.
|
||||
namespace chromeos::libassistant {
|
||||
using ::ash::libassistant::LibassistantLoaderImpl;
|
||||
}
|
||||
|
||||
#endif // /CHROMEOS_SERVICES_LIBASSISTANT_PUBLIC_CPP_LIBASSISTANT_LOADER_H_
|
||||
|
@ -13,8 +13,7 @@
|
||||
#include "chromeos/ash/services/assistant/public/cpp/features.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class LibassistantLoaderImplTest : public ::testing::Test {
|
||||
public:
|
||||
@ -52,7 +51,7 @@ TEST_F(LibassistantLoaderImplTest, ShouldRunCallbackWithoutDlcFeature) {
|
||||
|
||||
TEST_F(LibassistantLoaderImplTest, ShouldRunCallbackWithDlcFeature) {
|
||||
feature_list_.InitAndEnableFeature(
|
||||
chromeos::assistant::features::kEnableLibAssistantDlc);
|
||||
assistant::features::kEnableLibAssistantDlc);
|
||||
|
||||
auto* loader = LibassistantLoaderImpl::GetInstance();
|
||||
EXPECT_TRUE(loader);
|
||||
@ -79,5 +78,4 @@ TEST_F(LibassistantLoaderImplTest, ShouldRunCallbackWithDlcFeature) {
|
||||
DlcserviceClient::Shutdown();
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -17,8 +17,7 @@
|
||||
using sandbox::syscall_broker::BrokerFilePermission;
|
||||
using sandbox::syscall_broker::MakeBrokerCommandSet;
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -77,5 +76,4 @@ bool LibassistantPreSandboxHook(
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -7,12 +7,10 @@
|
||||
|
||||
#include "sandbox/policy/linux/sandbox_linux.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
bool LibassistantPreSandboxHook(sandbox::policy::SandboxLinux::Options options);
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_SANDBOX_HOOK_H_
|
||||
|
@ -16,8 +16,10 @@
|
||||
#include "chromeos/ash/services/libassistant/public/mojom/speech_recognition_observer.mojom.h"
|
||||
#include "chromeos/assistant/internal/libassistant/shared_headers.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -32,7 +34,7 @@ class LibassistantFactoryImpl : public LibassistantFactory {
|
||||
// LibassistantFactory implementation:
|
||||
std::unique_ptr<assistant_client::AssistantManager> CreateAssistantManager(
|
||||
const std::string& lib_assistant_config) override {
|
||||
if (!chromeos::assistant::features::IsLibAssistantDlcEnabled()) {
|
||||
if (!assistant::features::IsLibAssistantDlcEnabled()) {
|
||||
return base::WrapUnique(assistant_client::AssistantManager::Create(
|
||||
platform_api_, lib_assistant_config));
|
||||
}
|
||||
@ -45,7 +47,7 @@ class LibassistantFactoryImpl : public LibassistantFactory {
|
||||
|
||||
assistant_client::AssistantManagerInternal* UnwrapAssistantManagerInternal(
|
||||
assistant_client::AssistantManager* assistant_manager) override {
|
||||
if (!chromeos::assistant::features::IsLibAssistantDlcEnabled()) {
|
||||
if (!assistant::features::IsLibAssistantDlcEnabled()) {
|
||||
return assistant_client::UnwrapAssistantManagerInternal(
|
||||
assistant_manager);
|
||||
}
|
||||
@ -160,5 +162,4 @@ void LibassistantService::AddAuthenticationStateObserver(
|
||||
conversation_controller_.AddAuthenticationStateObserver(std::move(observer));
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -26,14 +26,14 @@
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote_set.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) LibassistantService
|
||||
: public mojom::LibassistantService {
|
||||
: public chromeos::libassistant::mojom::LibassistantService {
|
||||
public:
|
||||
explicit LibassistantService(
|
||||
mojo::PendingReceiver<mojom::LibassistantService> receiver,
|
||||
mojo::PendingReceiver<chromeos::libassistant::mojom::LibassistantService>
|
||||
receiver,
|
||||
// Allows to inject a custom instance during unittests.
|
||||
std::unique_ptr<LibassistantFactory> factory = nullptr);
|
||||
LibassistantService(LibassistantService&) = delete;
|
||||
@ -42,25 +42,40 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) LibassistantService
|
||||
|
||||
// mojom::LibassistantService implementation:
|
||||
void Bind(
|
||||
mojo::PendingReceiver<mojom::AudioInputController> audio_input_controller,
|
||||
mojo::PendingReceiver<mojom::ConversationController>
|
||||
mojo::PendingReceiver<chromeos::libassistant::mojom::AudioInputController>
|
||||
audio_input_controller,
|
||||
mojo::PendingReceiver<
|
||||
chromeos::libassistant::mojom::ConversationController>
|
||||
conversation_controller,
|
||||
mojo::PendingReceiver<mojom::DisplayController> display_controller,
|
||||
mojo::PendingReceiver<mojom::MediaController> media_controller,
|
||||
mojo::PendingReceiver<mojom::ServiceController> service_controller,
|
||||
mojo::PendingReceiver<mojom::SettingsController> settings_controller,
|
||||
mojo::PendingReceiver<mojom::SpeakerIdEnrollmentController>
|
||||
mojo::PendingReceiver<chromeos::libassistant::mojom::DisplayController>
|
||||
display_controller,
|
||||
mojo::PendingReceiver<chromeos::libassistant::mojom::MediaController>
|
||||
media_controller,
|
||||
mojo::PendingReceiver<chromeos::libassistant::mojom::ServiceController>
|
||||
service_controller,
|
||||
mojo::PendingReceiver<chromeos::libassistant::mojom::SettingsController>
|
||||
settings_controller,
|
||||
mojo::PendingReceiver<
|
||||
chromeos::libassistant::mojom::SpeakerIdEnrollmentController>
|
||||
speaker_id_enrollment_controller,
|
||||
mojo::PendingReceiver<mojom::TimerController> timer_controller,
|
||||
mojo::PendingRemote<mojom::AudioOutputDelegate> audio_output_delegate,
|
||||
mojo::PendingRemote<mojom::DeviceSettingsDelegate>
|
||||
mojo::PendingReceiver<chromeos::libassistant::mojom::TimerController>
|
||||
timer_controller,
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::AudioOutputDelegate>
|
||||
audio_output_delegate,
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::DeviceSettingsDelegate>
|
||||
device_settings_delegate,
|
||||
mojo::PendingRemote<mojom::MediaDelegate> media_delegate,
|
||||
mojo::PendingRemote<mojom::NotificationDelegate> notification_delegate,
|
||||
mojo::PendingRemote<mojom::PlatformDelegate> platform_delegate,
|
||||
mojo::PendingRemote<mojom::TimerDelegate> timer_delegate) override;
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::MediaDelegate>
|
||||
media_delegate,
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::NotificationDelegate>
|
||||
notification_delegate,
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::PlatformDelegate>
|
||||
platform_delegate,
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::TimerDelegate>
|
||||
timer_delegate) override;
|
||||
void AddSpeechRecognitionObserver(
|
||||
mojo::PendingRemote<mojom::SpeechRecognitionObserver> observer) override;
|
||||
mojo::PendingRemote<
|
||||
chromeos::libassistant::mojom::SpeechRecognitionObserver> observer)
|
||||
override;
|
||||
void AddAuthenticationStateObserver(
|
||||
mojo::PendingRemote<
|
||||
chromeos::libassistant::mojom::AuthenticationStateObserver> observer)
|
||||
@ -73,10 +88,11 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) LibassistantService
|
||||
ServiceController& service_controller() { return service_controller_; }
|
||||
|
||||
private:
|
||||
mojo::Receiver<mojom::LibassistantService> receiver_;
|
||||
mojo::Remote<mojom::PlatformDelegate> platform_delegate_;
|
||||
mojo::Receiver<chromeos::libassistant::mojom::LibassistantService> receiver_;
|
||||
mojo::Remote<chromeos::libassistant::mojom::PlatformDelegate>
|
||||
platform_delegate_;
|
||||
|
||||
mojo::RemoteSet<mojom::SpeechRecognitionObserver>
|
||||
mojo::RemoteSet<chromeos::libassistant::mojom::SpeechRecognitionObserver>
|
||||
speech_recognition_observers_;
|
||||
|
||||
// These controllers are part of the platform api which is called from
|
||||
@ -99,12 +115,6 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) LibassistantService
|
||||
TimerController timer_controller_;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove when it moved to ash.
|
||||
namespace ash::libassistant {
|
||||
using ::chromeos::libassistant::LibassistantService;
|
||||
}
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_LIBASSISTANT_SERVICE_H_
|
||||
|
@ -15,8 +15,7 @@
|
||||
#include "chromeos/assistant/internal/util_headers.h"
|
||||
#include "chromeos/services/assistant/public/shared/utils.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -33,6 +32,8 @@ constexpr char kWebUrlPrefix[] = "http";
|
||||
|
||||
using chromeos::assistant::AndroidAppInfo;
|
||||
using chromeos::assistant::shared::PlayMediaArgs;
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
// A macro which ensures we are running on the mojom thread.
|
||||
#define ENSURE_MOJOM_THREAD(method, ...) \
|
||||
@ -255,5 +256,4 @@ void MediaController::OnAssistantClientRunning(
|
||||
assistant_client->AddMediaActionFallbackEventObserver(events_observer_.get());
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -11,10 +11,9 @@
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class MediaController : public mojom::MediaController,
|
||||
class MediaController : public chromeos::libassistant::mojom::MediaController,
|
||||
public AssistantClientObserver {
|
||||
public:
|
||||
MediaController();
|
||||
@ -22,13 +21,16 @@ class MediaController : public mojom::MediaController,
|
||||
MediaController& operator=(const MediaController&) = delete;
|
||||
~MediaController() override;
|
||||
|
||||
void Bind(mojo::PendingReceiver<mojom::MediaController> receiver,
|
||||
mojo::PendingRemote<mojom::MediaDelegate> delegate);
|
||||
void Bind(mojo::PendingReceiver<
|
||||
chromeos::libassistant::mojom::MediaController> receiver,
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::MediaDelegate>
|
||||
delegate);
|
||||
|
||||
// mojom::MediaController implementation:
|
||||
void ResumeInternalMediaPlayer() override;
|
||||
void PauseInternalMediaPlayer() override;
|
||||
void SetExternalPlaybackState(mojom::MediaStatePtr state) override;
|
||||
void SetExternalPlaybackState(
|
||||
chromeos::libassistant::mojom::MediaStatePtr state) override;
|
||||
|
||||
// AssistantClientObserver implementation:
|
||||
void OnAssistantClientRunning(AssistantClient* assistant_client) override;
|
||||
@ -38,12 +40,12 @@ class MediaController : public mojom::MediaController,
|
||||
|
||||
AssistantClient* assistant_client_ = nullptr;
|
||||
|
||||
mojo::Receiver<mojom::MediaController> receiver_{this};
|
||||
mojo::Remote<mojom::MediaDelegate> delegate_;
|
||||
mojo::Receiver<chromeos::libassistant::mojom::MediaController> receiver_{
|
||||
this};
|
||||
mojo::Remote<chromeos::libassistant::mojom::MediaDelegate> delegate_;
|
||||
std::unique_ptr<GrpcEventsObserver> events_observer_;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_MEDIA_CONTROLLER_H_
|
||||
|
@ -16,8 +16,7 @@
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -25,7 +24,10 @@ using LibassistantPlaybackState = assistant_client::MediaStatus::PlaybackState;
|
||||
using ProtoAndroidAppInfo = chromeos::assistant::shared::AndroidAppInfo;
|
||||
using AndroidAppInfo = chromeos::assistant::AndroidAppInfo;
|
||||
using chromeos::assistant::shared::PlayMediaArgs;
|
||||
using mojom::PlaybackState;
|
||||
using ::chromeos::libassistant::mojom::PlaybackState;
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
#define EXPECT_NO_CALLS(args...) EXPECT_CALL(args).Times(0);
|
||||
|
||||
@ -366,5 +368,4 @@ TEST_F(AssistantMediaControllerTest, ShouldIgnoreInvalidUrls) {
|
||||
play_media_args.SerializeAsString());
|
||||
FlushMojomPipes();
|
||||
}
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -18,8 +18,11 @@ using NetworkStatePropertiesPtr =
|
||||
using ConnectionStateType =
|
||||
chromeos::network_config::mojom::ConnectionStateType;
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
namespace network_config = ::chromeos::network_config;
|
||||
|
||||
NetworkProviderImpl::NetworkProviderImpl()
|
||||
: connection_status_(ConnectionStatus::UNKNOWN) {}
|
||||
@ -62,5 +65,4 @@ assistant_client::MdnsResponder* NetworkProviderImpl::GetMdnsResponder() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -13,12 +13,11 @@
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class COMPONENT_EXPORT(ASSISTANT_SERVICE) NetworkProviderImpl
|
||||
: public assistant_client::NetworkProvider,
|
||||
public network_config::CrosNetworkConfigObserver {
|
||||
public chromeos::network_config::CrosNetworkConfigObserver {
|
||||
public:
|
||||
NetworkProviderImpl();
|
||||
|
||||
@ -27,7 +26,8 @@ class COMPONENT_EXPORT(ASSISTANT_SERVICE) NetworkProviderImpl
|
||||
|
||||
~NetworkProviderImpl() override;
|
||||
|
||||
void Initialize(mojom::PlatformDelegate* platform_delegate);
|
||||
void Initialize(
|
||||
chromeos::libassistant::mojom::PlatformDelegate* platform_delegate);
|
||||
|
||||
// assistant_client::NetworkProvider:
|
||||
ConnectionStatus GetConnectionStatus() override;
|
||||
@ -35,18 +35,17 @@ class COMPONENT_EXPORT(ASSISTANT_SERVICE) NetworkProviderImpl
|
||||
|
||||
// network_config::CrosNetworkConfigObserver:
|
||||
void OnActiveNetworksChanged(
|
||||
std::vector<network_config::mojom::NetworkStatePropertiesPtr> networks)
|
||||
override;
|
||||
std::vector<chromeos::network_config::mojom::NetworkStatePropertiesPtr>
|
||||
networks) override;
|
||||
|
||||
private:
|
||||
ConnectionStatus connection_status_;
|
||||
mojo::Receiver<network_config::mojom::CrosNetworkConfigObserver> receiver_{
|
||||
this};
|
||||
mojo::Remote<network_config::mojom::CrosNetworkConfig>
|
||||
mojo::Receiver<chromeos::network_config::mojom::CrosNetworkConfigObserver>
|
||||
receiver_{this};
|
||||
mojo::Remote<chromeos::network_config::mojom::CrosNetworkConfig>
|
||||
cros_network_config_remote_;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_NETWORK_PROVIDER_IMPL_H_
|
||||
|
@ -13,11 +13,10 @@
|
||||
#include "chromeos/services/network_config/public/mojom/network_types.mojom-forward.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
using network_config::mojom::ConnectionStateType;
|
||||
using network_config::mojom::NetworkStatePropertiesPtr;
|
||||
using ::chromeos::network_config::mojom::ConnectionStateType;
|
||||
using ::chromeos::network_config::mojom::NetworkStatePropertiesPtr;
|
||||
using ConnectionStatus = NetworkProviderImpl::ConnectionStatus;
|
||||
|
||||
class AssistantNetworkProviderImplTest : public ::testing::Test {
|
||||
@ -43,7 +42,7 @@ class AssistantNetworkProviderImplTest : public ::testing::Test {
|
||||
NetworkStatePropertiesPtr CreateNetworkState(
|
||||
ConnectionStateType connection_type) const {
|
||||
NetworkStatePropertiesPtr network_state =
|
||||
network_config::mojom::NetworkStateProperties::New();
|
||||
chromeos::network_config::mojom::NetworkStateProperties::New();
|
||||
network_state->connection_state = connection_type;
|
||||
return network_state;
|
||||
}
|
||||
@ -109,5 +108,4 @@ TEST_F(AssistantNetworkProviderImplTest, IsOfflineIfThereAreNoNetworks) {
|
||||
network_provider_.GetConnectionStatus());
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -11,8 +11,10 @@
|
||||
#include "chromeos/assistant/internal/test_support/fake_assistant_manager_internal.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -50,24 +52,25 @@ class NotificationDelegateMock : public mojom::NotificationDelegate {
|
||||
class CrosActionModuleHelper {
|
||||
public:
|
||||
explicit CrosActionModuleHelper(
|
||||
assistant::action::CrosActionModule* action_module)
|
||||
chromeos::assistant::action::CrosActionModule* action_module)
|
||||
: action_module_(*action_module) {}
|
||||
CrosActionModuleHelper(const CrosActionModuleHelper&) = delete;
|
||||
CrosActionModuleHelper& operator=(const CrosActionModuleHelper&) = delete;
|
||||
~CrosActionModuleHelper() = default;
|
||||
|
||||
void ShowNotification(const assistant::action::Notification& notification) {
|
||||
void ShowNotification(
|
||||
const chromeos::assistant::action::Notification& notification) {
|
||||
for (auto* observer : action_observers())
|
||||
observer->OnShowNotification(notification);
|
||||
}
|
||||
|
||||
private:
|
||||
const std::vector<assistant::action::AssistantActionObserver*>&
|
||||
const std::vector<chromeos::assistant::action::AssistantActionObserver*>&
|
||||
action_observers() {
|
||||
return action_module_.GetActionObserversForTesting();
|
||||
}
|
||||
|
||||
const assistant::action::CrosActionModule& action_module_;
|
||||
const chromeos::assistant::action::CrosActionModule& action_module_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
@ -84,7 +87,7 @@ class NotificationDelegateTest : public ::testing::Test {
|
||||
service_tester_.GetNotificationDelegatePendingReceiver());
|
||||
service_tester_.Start();
|
||||
action_module_helper_ = std::make_unique<CrosActionModuleHelper>(
|
||||
static_cast<assistant::action::CrosActionModule*>(
|
||||
static_cast<chromeos::assistant::action::CrosActionModule*>(
|
||||
service_tester_.assistant_manager_internal().action_module()));
|
||||
|
||||
service_tester_.service()
|
||||
@ -111,7 +114,7 @@ class NotificationDelegateTest : public ::testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(NotificationDelegateTest, ShouldInvokeAddOrUpdateNotification) {
|
||||
assistant::action::Notification input_notification{
|
||||
chromeos::assistant::action::Notification input_notification{
|
||||
/*title=*/"title",
|
||||
/*text=*/"text",
|
||||
/*action_url=*/"https://action-url/",
|
||||
@ -165,5 +168,4 @@ TEST_F(NotificationDelegateTest, ShouldInvokeRemoveNotificationByGroupingKey) {
|
||||
delegate_mock().FlushForTesting();
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -13,8 +13,10 @@
|
||||
#include "chromeos/ash/services/libassistant/system_provider_impl.h"
|
||||
#include "media/audio/audio_device_description.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
PlatformApi::PlatformApi()
|
||||
: audio_output_provider_(std::make_unique<AudioOutputProviderImpl>(
|
||||
@ -85,5 +87,4 @@ void PlatformApi::OnAssistantClientDestroyed() {
|
||||
audio_output_provider_->UnBindAudioDecoderFactory();
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
// TODO(https://crbug.com/1164001): move to forward declaration
|
||||
#include "chromeos/ash/services/libassistant/audio/audio_output_provider_impl.h"
|
||||
#include "chromeos/ash/services/libassistant/grpc/assistant_client_observer.h"
|
||||
#include "chromeos/ash/services/libassistant/network_provider_impl.h"
|
||||
#include "chromeos/ash/services/libassistant/public/mojom/audio_output_delegate.mojom.h"
|
||||
@ -16,9 +14,9 @@
|
||||
#include "chromeos/assistant/internal/libassistant/shared_headers.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class AudioOutputProviderImpl;
|
||||
class FakeAuthProvider;
|
||||
class FileProviderImpl;
|
||||
class NetworkProviderImpl;
|
||||
@ -36,8 +34,9 @@ class PlatformApi : public assistant_client::PlatformApi,
|
||||
~PlatformApi() override;
|
||||
|
||||
void Bind(
|
||||
mojo::PendingRemote<mojom::AudioOutputDelegate> audio_output_delegate,
|
||||
mojom::PlatformDelegate* platform_delegate);
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::AudioOutputDelegate>
|
||||
audio_output_delegate,
|
||||
chromeos::libassistant::mojom::PlatformDelegate* platform_delegate);
|
||||
|
||||
PlatformApi& SetAudioInputProvider(assistant_client::AudioInputProvider*);
|
||||
|
||||
@ -64,7 +63,6 @@ class PlatformApi : public assistant_client::PlatformApi,
|
||||
std::unique_ptr<SystemProviderImpl> system_provider_;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_PLATFORM_API_H_
|
||||
|
@ -13,8 +13,7 @@
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "services/device/public/mojom/wake_lock_provider.mojom.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -104,7 +103,8 @@ void PowerManagerProviderImpl::AddWakeAlarmOnMainThread(
|
||||
DVLOG(1) << __func__;
|
||||
DCHECK(main_thread_task_runner_->RunsTasksInCurrentSequence());
|
||||
|
||||
auto timer = std::make_unique<NativeTimer>(kTag + base::NumberToString(id));
|
||||
auto timer =
|
||||
std::make_unique<chromeos::NativeTimer>(kTag + base::NumberToString(id));
|
||||
// Once the timer is created successfully, start the timer and store
|
||||
// associated data. The stored |callback| will be called in
|
||||
// |OnTimerFiredOnMainThread|.
|
||||
@ -197,5 +197,4 @@ void PowerManagerProviderImpl::OnTimerFiredOnMainThread(AlarmId id) {
|
||||
timers_.erase(id);
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -18,8 +18,7 @@
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "services/device/public/mojom/wake_lock.mojom.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// Implementation of power management features for libassistant.
|
||||
//
|
||||
@ -61,8 +60,8 @@ class COMPONENT_EXPORT(ASSISTANT_SERVICE) PowerManagerProviderImpl
|
||||
}
|
||||
|
||||
private:
|
||||
using CallbackAndTimer =
|
||||
std::pair<assistant_client::Callback0, std::unique_ptr<NativeTimer>>;
|
||||
using CallbackAndTimer = std::pair<assistant_client::Callback0,
|
||||
std::unique_ptr<chromeos::NativeTimer>>;
|
||||
|
||||
// Returns time ticks from boot including time ticks during sleeping.
|
||||
base::TimeTicks GetCurrentBootTime();
|
||||
@ -117,7 +116,6 @@ class COMPONENT_EXPORT(ASSISTANT_SERVICE) PowerManagerProviderImpl
|
||||
base::WeakPtrFactory<PowerManagerProviderImpl> weak_factory_;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_POWER_MANAGER_PROVIDER_IMPL_H_
|
||||
|
@ -11,8 +11,7 @@
|
||||
#include "services/device/public/cpp/test/test_wake_lock_provider.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -54,7 +53,7 @@ class AssistantPowerManagerProviderImplTest : public testing::Test {
|
||||
|
||||
void SetUp() override {
|
||||
chromeos::PowerManagerClient::InitializeFake();
|
||||
FakePowerManagerClient::Get()->set_tick_clock(
|
||||
chromeos::FakePowerManagerClient::Get()->set_tick_clock(
|
||||
task_environment_.GetMockTickClock());
|
||||
power_manager_provider_impl_ = std::make_unique<PowerManagerProviderImpl>();
|
||||
power_manager_provider_impl_->set_tick_clock_for_testing(
|
||||
@ -166,5 +165,4 @@ TEST_F(AssistantPowerManagerProviderImplTest, CheckWakeAlarms) {
|
||||
CheckAddWakeAlarmAndExpiration(kAlarmRelativeTimeMs, kAlarmMaxDelayMs));
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -24,4 +24,9 @@ class COMPONENT_EXPORT(LIBASSISTANT_PUBLIC_LOADER) LibassistantLoader {
|
||||
|
||||
} // namespace chromeos::libassistant
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove when it moved to ash.
|
||||
namespace ash::libassistant {
|
||||
using ::chromeos::libassistant::LibassistantLoader;
|
||||
}
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_PUBLIC_CPP_LIBASSISTANT_LOADER_H_
|
||||
|
@ -19,12 +19,13 @@
|
||||
#include "services/network/public/cpp/cross_thread_pending_shared_url_loader_factory.h"
|
||||
#include "services/network/public/cpp/wrapper_shared_url_loader_factory.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
using mojom::ServiceState;
|
||||
using ::chromeos::libassistant::mojom::ServiceState;
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
// A macro which ensures we are running on the mojom thread.
|
||||
#define ENSURE_MOJOM_THREAD(method, ...) \
|
||||
@ -344,5 +345,4 @@ void ServiceController::CreateChromiumApiDelegate(
|
||||
CreatePendingURLLoaderFactory(std::move(url_loader_factory_remote)));
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -19,8 +19,7 @@
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote_set.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class ChromiumApiDelegate;
|
||||
class LibassistantFactory;
|
||||
@ -28,7 +27,7 @@ class LibassistantFactory;
|
||||
// Component managing the lifecycle of Libassistant,
|
||||
// exposing methods to start/stop and configure Libassistant.
|
||||
class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) ServiceController
|
||||
: public mojom::ServiceController,
|
||||
: public chromeos::libassistant::mojom::ServiceController,
|
||||
public ServicesStatusObserver {
|
||||
public:
|
||||
explicit ServiceController(LibassistantFactory* factory);
|
||||
@ -36,18 +35,22 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) ServiceController
|
||||
ServiceController& operator=(ServiceController&) = delete;
|
||||
~ServiceController() override;
|
||||
|
||||
void Bind(mojo::PendingReceiver<mojom::ServiceController> receiver,
|
||||
mojom::SettingsController* settings_controller);
|
||||
void Bind(
|
||||
mojo::PendingReceiver<chromeos::libassistant::mojom::ServiceController>
|
||||
receiver,
|
||||
chromeos::libassistant::mojom::SettingsController* settings_controller);
|
||||
|
||||
// mojom::ServiceController implementation:
|
||||
void Initialize(mojom::BootupConfigPtr libassistant_config,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>
|
||||
url_loader_factory) override;
|
||||
void Initialize(
|
||||
chromeos::libassistant::mojom::BootupConfigPtr libassistant_config,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory> url_loader_factory)
|
||||
override;
|
||||
void Start() override;
|
||||
void Stop() override;
|
||||
void ResetAllDataAndStop() override;
|
||||
void AddAndFireStateObserver(
|
||||
mojo::PendingRemote<mojom::StateObserver> observer) override;
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::StateObserver>
|
||||
observer) override;
|
||||
|
||||
// ServicesStatusObserver implementation:
|
||||
void OnServicesStatusChanged(ServicesStatus status) override;
|
||||
@ -71,25 +74,30 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) ServiceController
|
||||
// Will be invoked when Libassistant services are started.
|
||||
void OnServicesBootingUp();
|
||||
|
||||
void SetStateAndInformObservers(mojom::ServiceState new_state);
|
||||
void SetStateAndInformObservers(
|
||||
chromeos::libassistant::mojom::ServiceState new_state);
|
||||
|
||||
void CreateAndRegisterChromiumApiDelegate(
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory> url_loader_factory);
|
||||
void CreateChromiumApiDelegate(
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory> url_loader_factory);
|
||||
|
||||
mojom::ServiceState state_ = mojom::ServiceState::kStopped;
|
||||
chromeos::libassistant::mojom::ServiceState state_ =
|
||||
chromeos::libassistant::mojom::ServiceState::kStopped;
|
||||
|
||||
// Called during |Initialize| to apply boot configuration.
|
||||
mojom::SettingsController* settings_controller_ = nullptr;
|
||||
chromeos::libassistant::mojom::SettingsController* settings_controller_ =
|
||||
nullptr;
|
||||
|
||||
LibassistantFactory& libassistant_factory_;
|
||||
|
||||
std::unique_ptr<AssistantClient> assistant_client_;
|
||||
std::unique_ptr<ChromiumApiDelegate> chromium_api_delegate_;
|
||||
|
||||
mojo::Receiver<mojom::ServiceController> receiver_{this};
|
||||
mojo::RemoteSet<mojom::StateObserver> state_observers_;
|
||||
mojo::Receiver<chromeos::libassistant::mojom::ServiceController> receiver_{
|
||||
this};
|
||||
mojo::RemoteSet<chromeos::libassistant::mojom::StateObserver>
|
||||
state_observers_;
|
||||
base::ObserverList<AssistantClientObserver> assistant_client_observers_;
|
||||
|
||||
base::WeakPtrFactory<ServiceController> weak_factory_{this};
|
||||
@ -101,7 +109,6 @@ using ScopedAssistantClientObserver = base::ScopedObservation<
|
||||
&ServiceController::AddAndFireAssistantClientObserver,
|
||||
&ServiceController::RemoveAssistantClientObserver>;
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_SERVICE_CONTROLLER_H_
|
||||
|
@ -26,12 +26,14 @@
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
namespace {
|
||||
|
||||
using mojom::ServiceState;
|
||||
using ::chromeos::libassistant::mojom::ServiceState;
|
||||
using ::testing::StrictMock;
|
||||
|
||||
#define EXPECT_NO_CALLS(args...) EXPECT_CALL(args).Times(0)
|
||||
@ -233,8 +235,9 @@ class AssistantServiceControllerTest : public testing::Test {
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace ash::libassistant
|
||||
|
||||
namespace mojom {
|
||||
namespace chromeos::libassistant::mojom {
|
||||
|
||||
void PrintTo(const ServiceState state, std::ostream* stream) {
|
||||
switch (state) {
|
||||
@ -251,7 +254,9 @@ void PrintTo(const ServiceState state, std::ostream* stream) {
|
||||
*stream << "INVALID ServiceState (" << static_cast<int>(state) << ")";
|
||||
}
|
||||
|
||||
} // namespace mojom
|
||||
} // namespace chromeos::libassistant::mojom
|
||||
|
||||
namespace ash::libassistant {
|
||||
|
||||
TEST_F(AssistantServiceControllerTest, StateShouldStartAsStopped) {
|
||||
Initialize();
|
||||
@ -663,5 +668,4 @@ TEST_F(AssistantServiceControllerTest,
|
||||
Initialize(std::move(bootup_config));
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -22,17 +22,11 @@
|
||||
#include "chromeos/assistant/internal/proto/shared/proto/v2/display_interface.pb.h"
|
||||
#include "third_party/icu/source/common/unicode/locid.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace assistant {
|
||||
using ::ash::assistant::AssistantDevice;
|
||||
using ::ash::assistant::AssistantDeviceSettings;
|
||||
using ::ash::assistant::AssistantDeviceSettingsUpdate;
|
||||
using ::ash::assistant::SettingsUiUpdate;
|
||||
} // namespace assistant
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
namespace libassistant {
|
||||
namespace {
|
||||
|
||||
// Each authentication token exists of a [gaia_id, access_token] tuple.
|
||||
@ -413,5 +407,4 @@ void SettingsController::OnDestroyingAssistantClient(
|
||||
spoken_feedback_enabled_.reset();
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -14,22 +14,25 @@
|
||||
#include "chromeos/ash/services/libassistant/public/mojom/settings_controller.mojom.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class SettingsController : public AssistantClientObserver,
|
||||
public mojom::SettingsController {
|
||||
class SettingsController
|
||||
: public AssistantClientObserver,
|
||||
public chromeos::libassistant::mojom::SettingsController {
|
||||
public:
|
||||
SettingsController();
|
||||
SettingsController(const SettingsController&) = delete;
|
||||
SettingsController& operator=(const SettingsController&) = delete;
|
||||
~SettingsController() override;
|
||||
|
||||
void Bind(mojo::PendingReceiver<mojom::SettingsController> receiver);
|
||||
void Bind(
|
||||
mojo::PendingReceiver<chromeos::libassistant::mojom::SettingsController>
|
||||
receiver);
|
||||
|
||||
// mojom::SettingsController implementation:
|
||||
void SetAuthenticationTokens(
|
||||
std::vector<mojom::AuthenticationTokenPtr> tokens) override;
|
||||
std::vector<chromeos::libassistant::mojom::AuthenticationTokenPtr> tokens)
|
||||
override;
|
||||
void SetListeningEnabled(bool value) override;
|
||||
void SetLocale(const std::string& value) override;
|
||||
void SetSpokenFeedbackEnabled(bool value) override;
|
||||
@ -53,7 +56,9 @@ class SettingsController : public AssistantClientObserver,
|
||||
// must be updated.
|
||||
void UpdateListeningEnabled(absl::optional<bool> listening_enabled);
|
||||
void UpdateAuthenticationTokens(
|
||||
const absl::optional<std::vector<mojom::AuthenticationTokenPtr>>& tokens);
|
||||
const absl::optional<
|
||||
std::vector<chromeos::libassistant::mojom::AuthenticationTokenPtr>>&
|
||||
tokens);
|
||||
void UpdateInternalOptions(const absl::optional<std::string>& locale,
|
||||
absl::optional<bool> spoken_feedback_enabled,
|
||||
absl::optional<bool> dark_mode_enabled);
|
||||
@ -78,13 +83,14 @@ class SettingsController : public AssistantClientObserver,
|
||||
absl::optional<bool> dark_mode_enabled_;
|
||||
absl::optional<bool> listening_enabled_;
|
||||
absl::optional<std::string> locale_;
|
||||
absl::optional<std::vector<mojom::AuthenticationTokenPtr>>
|
||||
absl::optional<
|
||||
std::vector<chromeos::libassistant::mojom::AuthenticationTokenPtr>>
|
||||
authentication_tokens_;
|
||||
|
||||
mojo::Receiver<mojom::SettingsController> receiver_{this};
|
||||
mojo::Receiver<chromeos::libassistant::mojom::SettingsController> receiver_{
|
||||
this};
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_SETTINGS_CONTROLLER_H_
|
||||
|
@ -13,8 +13,7 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/icu/source/common/unicode/locid.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -22,6 +21,8 @@ namespace {
|
||||
#define IGNORE_CALLS(args...) EXPECT_CALL(args).Times(testing::AnyNumber());
|
||||
// The auth tokens are pairs of <user, token>
|
||||
using AuthTokens = std::vector<std::pair<std::string, std::string>>;
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
std::vector<mojom::AuthenticationTokenPtr> ToVector(
|
||||
mojom::AuthenticationTokenPtr token) {
|
||||
@ -32,9 +33,10 @@ std::vector<mojom::AuthenticationTokenPtr> ToVector(
|
||||
|
||||
class AssistantClientMock : public FakeAssistantClient {
|
||||
public:
|
||||
AssistantClientMock(
|
||||
std::unique_ptr<assistant::FakeAssistantManager> assistant_manager,
|
||||
assistant::FakeAssistantManagerInternal* assistant_manager_internal)
|
||||
AssistantClientMock(std::unique_ptr<chromeos::assistant::FakeAssistantManager>
|
||||
assistant_manager,
|
||||
chromeos::assistant::FakeAssistantManagerInternal*
|
||||
assistant_manager_internal)
|
||||
: FakeAssistantClient(std::move(assistant_manager),
|
||||
assistant_manager_internal) {}
|
||||
~AssistantClientMock() override = default;
|
||||
@ -101,9 +103,9 @@ class AssistantSettingsControllerTest : public testing::Test {
|
||||
assistant_manager_internal_ = nullptr;
|
||||
|
||||
auto assistant_manager =
|
||||
std::make_unique<assistant::FakeAssistantManager>();
|
||||
assistant_manager_internal_ = std::make_unique<
|
||||
testing::StrictMock<assistant::FakeAssistantManagerInternal>>();
|
||||
std::make_unique<chromeos::assistant::FakeAssistantManager>();
|
||||
assistant_manager_internal_ = std::make_unique<testing::StrictMock<
|
||||
chromeos::assistant::FakeAssistantManagerInternal>>();
|
||||
assistant_client_ = std::make_unique<AssistantClientMock>(
|
||||
std::move(assistant_manager), assistant_manager_internal_.get());
|
||||
}
|
||||
@ -114,7 +116,7 @@ class AssistantSettingsControllerTest : public testing::Test {
|
||||
base::test::SingleThreadTaskEnvironment environment_;
|
||||
|
||||
SettingsController controller_;
|
||||
std::unique_ptr<assistant::FakeAssistantManagerInternal>
|
||||
std::unique_ptr<chromeos::assistant::FakeAssistantManagerInternal>
|
||||
assistant_manager_internal_;
|
||||
std::unique_ptr<AssistantClientMock> assistant_client_;
|
||||
};
|
||||
@ -431,5 +433,4 @@ TEST_F(AssistantSettingsControllerTest,
|
||||
DestroyLibassistant();
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -14,10 +14,11 @@
|
||||
#include "chromeos/assistant/internal/proto/shared/proto/v2/speaker_id_enrollment_interface.pb.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
using ::assistant::api::OnSpeakerIdEnrollmentEventRequest;
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// GetStatusWaiter
|
||||
@ -228,5 +229,4 @@ void SpeakerIdEnrollmentController::OnDestroyingAssistantClient(
|
||||
pending_response_waiters_.AbortAll();
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -6,35 +6,37 @@
|
||||
#define CHROMEOS_ASH_SERVICES_LIBASSISTANT_SPEAKER_ID_ENROLLMENT_CONTROLLER_H_
|
||||
|
||||
#include "chromeos/ash/services/libassistant/abortable_task_list.h"
|
||||
// TODO(https://crbug.com/1164001): move to forward declaration
|
||||
#include "chromeos/ash/services/libassistant/grpc/assistant_client.h"
|
||||
#include "chromeos/ash/services/libassistant/grpc/assistant_client_observer.h"
|
||||
#include "chromeos/ash/services/libassistant/public/mojom/audio_input_controller.mojom-forward.h"
|
||||
#include "chromeos/ash/services/libassistant/public/mojom/speaker_id_enrollment_controller.mojom.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class AssistantClient;
|
||||
|
||||
class SpeakerIdEnrollmentController
|
||||
: public mojom::SpeakerIdEnrollmentController,
|
||||
: public chromeos::libassistant::mojom::SpeakerIdEnrollmentController,
|
||||
public AssistantClientObserver {
|
||||
public:
|
||||
explicit SpeakerIdEnrollmentController(
|
||||
mojom::AudioInputController* audio_input);
|
||||
chromeos::libassistant::mojom::AudioInputController* audio_input);
|
||||
SpeakerIdEnrollmentController(const SpeakerIdEnrollmentController&) = delete;
|
||||
SpeakerIdEnrollmentController& operator=(
|
||||
const SpeakerIdEnrollmentController&) = delete;
|
||||
~SpeakerIdEnrollmentController() override;
|
||||
|
||||
void Bind(mojo::PendingReceiver<mojom::SpeakerIdEnrollmentController>
|
||||
void Bind(mojo::PendingReceiver<
|
||||
chromeos::libassistant::mojom::SpeakerIdEnrollmentController>
|
||||
pending_receiver);
|
||||
|
||||
// mojom::SpeakerIdEnrollmentController implementation:
|
||||
void StartSpeakerIdEnrollment(
|
||||
const std::string& user_gaia_id,
|
||||
bool skip_cloud_enrollment,
|
||||
::mojo::PendingRemote<mojom::SpeakerIdEnrollmentClient> client) override;
|
||||
::mojo::PendingRemote<
|
||||
chromeos::libassistant::mojom::SpeakerIdEnrollmentClient> client)
|
||||
override;
|
||||
void StopSpeakerIdEnrollment() override;
|
||||
void GetSpeakerIdEnrollmentStatus(
|
||||
const std::string& user_gaia_id,
|
||||
@ -48,8 +50,9 @@ class SpeakerIdEnrollmentController
|
||||
class EnrollmentSession;
|
||||
class GetStatusWaiter;
|
||||
|
||||
mojo::Receiver<mojom::SpeakerIdEnrollmentController> receiver_{this};
|
||||
mojom::AudioInputController* const audio_input_;
|
||||
mojo::Receiver<chromeos::libassistant::mojom::SpeakerIdEnrollmentController>
|
||||
receiver_{this};
|
||||
chromeos::libassistant::mojom::AudioInputController* const audio_input_;
|
||||
|
||||
std::unique_ptr<EnrollmentSession> active_enrollment_session_;
|
||||
// Contains all pending callbacks for GetSpeakerIdEnrollmentStatus requests.
|
||||
@ -58,7 +61,6 @@ class SpeakerIdEnrollmentController
|
||||
AssistantClient* assistant_client_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_SPEAKER_ID_ENROLLMENT_CONTROLLER_H_
|
||||
|
@ -12,8 +12,7 @@
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
using assistant_client::SpeakerIdEnrollmentStatus;
|
||||
@ -23,6 +22,8 @@ using GetSpeakerIdEnrollmentStatusCallback =
|
||||
SpeakerIdEnrollmentController::GetSpeakerIdEnrollmentStatusCallback;
|
||||
using ::testing::NiceMock;
|
||||
using ::testing::StrictMock;
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
class SpeakerIdEnrollmentClientMock : public mojom::SpeakerIdEnrollmentClient {
|
||||
public:
|
||||
@ -66,7 +67,8 @@ class AssistantSpeakerIdEnrollmentControllerTest : public ::testing::Test {
|
||||
|
||||
LibassistantServiceTester& service_tester() { return service_tester_; }
|
||||
|
||||
assistant::FakeAssistantManagerInternal& assistant_manager_internal() {
|
||||
chromeos::assistant::FakeAssistantManagerInternal&
|
||||
assistant_manager_internal() {
|
||||
return service_tester().assistant_manager_internal();
|
||||
}
|
||||
|
||||
@ -240,5 +242,4 @@ TEST_F(AssistantSpeakerIdEnrollmentControllerTest,
|
||||
FlushForTesting();
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -14,8 +14,7 @@
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -23,6 +22,8 @@ using RecognitionState =
|
||||
assistant_client::ConversationStateListener::RecognitionState;
|
||||
using RecognitionResult =
|
||||
assistant_client::ConversationStateListener::RecognitionResult;
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
std::string CreateDisplayAssistantEvent(float speech_level) {
|
||||
::assistant::display::AssistantEvent result;
|
||||
@ -142,5 +143,4 @@ TEST_F(AssistantSpeechRecognitionObserverTest,
|
||||
RecognitionState::FINAL_RESULT, recognition_result);
|
||||
observer_mock().FlushForTesting();
|
||||
}
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -11,8 +11,7 @@
|
||||
#include "base/system/sys_info.h"
|
||||
#include "chromeos/ash/services/libassistant/power_manager_provider_impl.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
SystemProviderImpl::SystemProviderImpl(
|
||||
std::unique_ptr<PowerManagerProviderImpl> power_manager_provider)
|
||||
@ -73,5 +72,4 @@ void SystemProviderImpl::FlushForTesting() {
|
||||
battery_monitor_.FlushForTesting(); // IN-TEST
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -16,8 +16,7 @@
|
||||
#include "services/device/public/mojom/battery_monitor.mojom.h"
|
||||
#include "services/device/public/mojom/battery_status.mojom.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class PowerManagerProviderImpl;
|
||||
|
||||
@ -56,7 +55,6 @@ class SystemProviderImpl : public assistant_client::SystemProvider {
|
||||
device::mojom::BatteryStatusPtr current_battery_status_;
|
||||
};
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_SYSTEM_PROVIDER_IMPL_H_
|
||||
|
@ -14,8 +14,7 @@
|
||||
#include "services/device/public/mojom/battery_monitor.mojom.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class FakeBatteryMonitor : device::mojom::BatteryMonitor {
|
||||
public:
|
||||
@ -106,5 +105,4 @@ TEST_F(AssistantSystemProviderImplTest, GetBatteryStateReturnsLastState) {
|
||||
EXPECT_EQ(state.charge_percentage, 100);
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -13,8 +13,10 @@
|
||||
#include "chromeos/ash/services/libassistant/public/cpp/assistant_timer.h"
|
||||
#include "chromeos/assistant/internal/proto/shared/proto/v2/delegate/event_handler_interface.pb.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// TimerListener
|
||||
@ -141,5 +143,4 @@ void TimerController::OnDestroyingAssistantClient(
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -13,10 +13,9 @@
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
class TimerController : public mojom::TimerController,
|
||||
class TimerController : public chromeos::libassistant::mojom::TimerController,
|
||||
public AssistantClientObserver {
|
||||
public:
|
||||
TimerController();
|
||||
@ -24,8 +23,10 @@ class TimerController : public mojom::TimerController,
|
||||
TimerController& operator=(const TimerController&) = delete;
|
||||
~TimerController() override;
|
||||
|
||||
void Bind(mojo::PendingReceiver<mojom::TimerController> receiver,
|
||||
mojo::PendingRemote<mojom::TimerDelegate> delegate);
|
||||
void Bind(mojo::PendingReceiver<
|
||||
chromeos::libassistant::mojom::TimerController> receiver,
|
||||
mojo::PendingRemote<chromeos::libassistant::mojom::TimerDelegate>
|
||||
delegate);
|
||||
|
||||
// mojom::TimerController implementation:
|
||||
void AddTimeToTimer(const std::string& id,
|
||||
@ -48,10 +49,11 @@ class TimerController : public mojom::TimerController,
|
||||
// in OnDestroyingAssistantClient().
|
||||
AssistantClient* assistant_client_ = nullptr;
|
||||
|
||||
mojo::Receiver<mojom::TimerController> receiver_{this};
|
||||
mojo::Remote<mojom::TimerDelegate> delegate_;
|
||||
mojo::Receiver<chromeos::libassistant::mojom::TimerController> receiver_{
|
||||
this};
|
||||
mojo::Remote<chromeos::libassistant::mojom::TimerDelegate> delegate_;
|
||||
};
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_TIMER_CONTROLLER_H_
|
||||
|
@ -14,13 +14,14 @@
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
using ::chromeos::assistant::AssistantTimerState;
|
||||
using ::testing::Invoke;
|
||||
// TODO(https://crbug.com/1164001): remove after migrating to ash.
|
||||
namespace mojom = ::chromeos::libassistant::mojom;
|
||||
|
||||
// Adds an AlarmTimerEvent of the given |type| to |events|.
|
||||
void AddAlarmTimerEvent(std::vector<assistant_client::AlarmTimerEvent>* events,
|
||||
@ -77,7 +78,7 @@ class AssistantTimerControllerTest : public ::testing::Test {
|
||||
|
||||
void Init() {
|
||||
auto assistant_manager =
|
||||
std::make_unique<assistant::FakeAssistantManager>();
|
||||
std::make_unique<chromeos::assistant::FakeAssistantManager>();
|
||||
auto* assistant_manager_internal =
|
||||
&assistant_manager->assistant_manager_internal();
|
||||
assistant_client_ = std::make_unique<FakeAssistantClient>(
|
||||
@ -102,8 +103,8 @@ class AssistantTimerControllerTest : public ::testing::Test {
|
||||
|
||||
TimerController& controller() { return controller_; }
|
||||
|
||||
assistant::FakeAlarmTimerManager& fake_alarm_timer_manager() {
|
||||
return *static_cast<assistant::FakeAlarmTimerManager*>(
|
||||
chromeos::assistant::FakeAlarmTimerManager& fake_alarm_timer_manager() {
|
||||
return *static_cast<chromeos::assistant::FakeAlarmTimerManager*>(
|
||||
assistant_client_->assistant_manager_internal()
|
||||
->GetAlarmTimerManager());
|
||||
}
|
||||
@ -185,5 +186,4 @@ TEST_F(AssistantTimerControllerTest, ShouldNotCrashAfterStoppingLibassistant) {
|
||||
controller().ResumeTimer("timer-id");
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -33,8 +33,7 @@ using chromeos::assistant::shared::ResponseCode;
|
||||
using chromeos::assistant::shared::SettingInfo;
|
||||
using chromeos::assistant::shared::VerifyProviderClientOpResult;
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -181,16 +180,18 @@ std::string CreateLibAssistantConfig(
|
||||
absl::optional<std::string> version = chromeos::version_loader::GetVersion(
|
||||
chromeos::version_loader::VERSION_FULL);
|
||||
device.SetKey("embedder_build_info", Value(version.value_or("0.0.0.0")));
|
||||
device.SetKey("model_id", Value(assistant::kModelId));
|
||||
device.SetKey("model_id", Value(chromeos::assistant::kModelId));
|
||||
device.SetKey("model_revision", Value(1));
|
||||
config.SetKey("device", std::move(device));
|
||||
|
||||
// Enables Libassistant gRPC server for V2.
|
||||
if (chromeos::assistant::features::IsLibAssistantV2Enabled()) {
|
||||
if (assistant::features::IsLibAssistantV2Enabled()) {
|
||||
const bool is_chromeos_device = base::SysInfo::IsRunningOnChromeOS();
|
||||
const std::string server_addresses =
|
||||
assistant::GetLibassistantServiceAddress(is_chromeos_device) + "," +
|
||||
assistant::GetHttpConnectionServiceAddress(is_chromeos_device);
|
||||
chromeos::assistant::GetLibassistantServiceAddress(is_chromeos_device) +
|
||||
"," +
|
||||
chromeos::assistant::GetHttpConnectionServiceAddress(
|
||||
is_chromeos_device);
|
||||
|
||||
Value libas_server(Type::DICTIONARY);
|
||||
libas_server.SetKey("libas_server_address", Value(server_addresses));
|
||||
@ -324,7 +325,7 @@ Interaction CreateVerifyProviderResponseInteraction(
|
||||
return V1InteractionBuilder()
|
||||
.SetInResponseTo(interaction_id)
|
||||
.SetStatusCodeFromEntityFound(any_provider_available)
|
||||
.AddResult(assistant::kResultKeyVerifyProvider, result_proto)
|
||||
.AddResult(chromeos::assistant::kResultKeyVerifyProvider, result_proto)
|
||||
.Proto();
|
||||
}
|
||||
|
||||
@ -341,7 +342,8 @@ Interaction CreateGetDeviceSettingInteraction(
|
||||
return V1InteractionBuilder()
|
||||
.SetInResponseTo(interaction_id)
|
||||
.SetStatusCode(ResponseCode::OK)
|
||||
.AddResult(/*key=*/assistant::kResultKeyGetDeviceSettings, result_proto)
|
||||
.AddResult(/*key=*/chromeos::assistant::kResultKeyGetDeviceSettings,
|
||||
result_proto)
|
||||
.Proto();
|
||||
}
|
||||
|
||||
@ -350,12 +352,12 @@ Interaction CreateNotificationRequestInteraction(
|
||||
const std::string& consistent_token,
|
||||
const std::string& opaque_token,
|
||||
const int action_index) {
|
||||
auto request_param = assistant::CreateNotificationRequestParam(
|
||||
auto request_param = chromeos::assistant::CreateNotificationRequestParam(
|
||||
notification_id, consistent_token, opaque_token, action_index);
|
||||
|
||||
return V1InteractionBuilder()
|
||||
.SetClientInputName(assistant::kClientInputRequestNotification)
|
||||
.AddClientInputParams(assistant::kNotificationRequestParamsKey,
|
||||
.SetClientInputName(chromeos::assistant::kClientInputRequestNotification)
|
||||
.AddClientInputParams(chromeos::assistant::kNotificationRequestParamsKey,
|
||||
request_param)
|
||||
.Proto();
|
||||
}
|
||||
@ -365,22 +367,23 @@ Interaction CreateNotificationDismissedInteraction(
|
||||
const std::string& consistent_token,
|
||||
const std::string& opaque_token,
|
||||
const std::vector<std::string>& grouping_keys) {
|
||||
auto dismiss_param = assistant::CreateNotificationDismissedParam(
|
||||
auto dismiss_param = chromeos::assistant::CreateNotificationDismissedParam(
|
||||
notification_id, consistent_token, opaque_token, grouping_keys);
|
||||
|
||||
return V1InteractionBuilder()
|
||||
.SetClientInputName(assistant::kClientInputDismissNotification)
|
||||
.AddClientInputParams(assistant::kNotificationDismissParamsKey,
|
||||
.SetClientInputName(chromeos::assistant::kClientInputDismissNotification)
|
||||
.AddClientInputParams(chromeos::assistant::kNotificationDismissParamsKey,
|
||||
dismiss_param)
|
||||
.Proto();
|
||||
}
|
||||
|
||||
Interaction CreateEditReminderInteraction(const std::string& reminder_id) {
|
||||
auto intent_input = assistant::CreateEditReminderParam(reminder_id);
|
||||
auto intent_input = chromeos::assistant::CreateEditReminderParam(reminder_id);
|
||||
|
||||
return V1InteractionBuilder()
|
||||
.SetClientInputName(assistant::kClientInputEditReminder)
|
||||
.AddClientInputParams(assistant::kEditReminderParamsKey, intent_input)
|
||||
.SetClientInputName(chromeos::assistant::kClientInputEditReminder)
|
||||
.AddClientInputParams(chromeos::assistant::kEditReminderParamsKey,
|
||||
intent_input)
|
||||
.Proto();
|
||||
}
|
||||
|
||||
@ -396,25 +399,25 @@ Interaction CreateSendFeedbackInteraction(
|
||||
bool assistant_debug_info_allowed,
|
||||
const std::string& feedback_description,
|
||||
const std::string& screenshot_png) {
|
||||
auto feedback_arg = assistant::CreateFeedbackParam(
|
||||
auto feedback_arg = chromeos::assistant::CreateFeedbackParam(
|
||||
assistant_debug_info_allowed, feedback_description, screenshot_png);
|
||||
|
||||
return V1InteractionBuilder()
|
||||
.SetClientInputName(assistant::kClientInputText)
|
||||
.AddClientInputParams(
|
||||
assistant::kTextParamsKey,
|
||||
assistant::CreateTextParam(assistant::kFeedbackText))
|
||||
.AddClientInputParams(assistant::kFeedbackParamsKey, feedback_arg)
|
||||
.SetClientInputName(chromeos::assistant::kClientInputText)
|
||||
.AddClientInputParams(chromeos::assistant::kTextParamsKey,
|
||||
chromeos::assistant::CreateTextParam(
|
||||
chromeos::assistant::kFeedbackText))
|
||||
.AddClientInputParams(chromeos::assistant::kFeedbackParamsKey,
|
||||
feedback_arg)
|
||||
.Proto();
|
||||
}
|
||||
|
||||
Interaction CreateTextQueryInteraction(const std::string& query) {
|
||||
return V1InteractionBuilder()
|
||||
.SetClientInputName(assistant::kClientInputText)
|
||||
.AddClientInputParams(assistant::kTextParamsKey,
|
||||
assistant::CreateTextParam(query))
|
||||
.SetClientInputName(chromeos::assistant::kClientInputText)
|
||||
.AddClientInputParams(chromeos::assistant::kTextParamsKey,
|
||||
chromeos::assistant::CreateTextParam(query))
|
||||
.Proto();
|
||||
}
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
@ -26,8 +26,7 @@ struct DeviceSetting;
|
||||
} // namespace assistant
|
||||
} // namespace chromeos
|
||||
|
||||
namespace chromeos {
|
||||
namespace libassistant {
|
||||
namespace ash::libassistant {
|
||||
|
||||
// Creates the configuration for libassistant.
|
||||
std::string CreateLibAssistantConfig(
|
||||
@ -74,7 +73,6 @@ base::FilePath GetBaseAssistantDir();
|
||||
::assistant::api::Interaction CreateTextQueryInteraction(
|
||||
const std::string& query);
|
||||
|
||||
} // namespace libassistant
|
||||
} // namespace chromeos
|
||||
} // namespace ash::libassistant
|
||||
|
||||
#endif // CHROMEOS_ASH_SERVICES_LIBASSISTANT_UTIL_H_
|
||||
|
@ -173,7 +173,7 @@ int UtilityMain(MainFunctionParams parameters) {
|
||||
#if BUILDFLAG(ENABLE_CROS_LIBASSISTANT)
|
||||
case sandbox::mojom::Sandbox::kLibassistant:
|
||||
pre_sandbox_hook =
|
||||
base::BindOnce(&chromeos::libassistant::LibassistantPreSandboxHook);
|
||||
base::BindOnce(&ash::libassistant::LibassistantPreSandboxHook);
|
||||
break;
|
||||
#endif // BUILDFLAG(ENABLE_CROS_LIBASSISTANT)
|
||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
|
Reference in New Issue
Block a user