Commit 59751319 authored by Zhuoyu Qian's avatar Zhuoyu Qian Committed by Commit Bot

Rename AssistantEmptyQuery to AssistantNullQuery and kEmpty to kNull

As the comment in assistant_query.h by dmblack@,
rename AssistantQueryType::kEmpty to kNull and rename AssistantEmptyQuery
to AssistantNullQuery.
Signed-off-by: default avatarZhuoyu Qian <zhuoyu.qian@samsung.com>
Change-Id: Ic4948122bef5a90b7e3bbeae13655bc36223f971
Reviewed-on: https://chromium-review.googlesource.com/1170709Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582804}
parent 2c9eae2c
......@@ -166,7 +166,7 @@ void AssistantInteractionController::OnInteractionStarted(
// this, we temporarily pend an empty text query to commit until we can do
// development to expose something more meaningful.
if (assistant_interaction_model_.pending_query().type() ==
AssistantQueryType::kEmpty) {
AssistantQueryType::kNull) {
assistant_interaction_model_.SetPendingQuery(
std::make_unique<AssistantTextQuery>());
}
......
......@@ -11,8 +11,8 @@
namespace ash {
AssistantInteractionModel::AssistantInteractionModel()
: committed_query_(std::make_unique<AssistantEmptyQuery>()),
pending_query_(std::make_unique<AssistantEmptyQuery>()) {}
: committed_query_(std::make_unique<AssistantNullQuery>()),
pending_query_(std::make_unique<AssistantNullQuery>()) {}
AssistantInteractionModel::~AssistantInteractionModel() = default;
......@@ -70,35 +70,35 @@ void AssistantInteractionModel::SetMicState(MicState mic_state) {
}
void AssistantInteractionModel::ClearCommittedQuery() {
if (committed_query_->type() == AssistantQueryType::kEmpty)
if (committed_query_->type() == AssistantQueryType::kNull)
return;
committed_query_ = std::make_unique<AssistantEmptyQuery>();
committed_query_ = std::make_unique<AssistantNullQuery>();
NotifyCommittedQueryCleared();
}
void AssistantInteractionModel::SetPendingQuery(
std::unique_ptr<AssistantQuery> pending_query) {
DCHECK(pending_query->type() != AssistantQueryType::kEmpty);
DCHECK(pending_query->type() != AssistantQueryType::kNull);
pending_query_ = std::move(pending_query);
NotifyPendingQueryChanged();
}
void AssistantInteractionModel::CommitPendingQuery() {
DCHECK_NE(pending_query_->type(), AssistantQueryType::kEmpty);
DCHECK_NE(pending_query_->type(), AssistantQueryType::kNull);
committed_query_ = std::move(pending_query_);
pending_query_ = std::make_unique<AssistantEmptyQuery>();
pending_query_ = std::make_unique<AssistantNullQuery>();
NotifyCommittedQueryChanged();
NotifyPendingQueryCleared();
}
void AssistantInteractionModel::ClearPendingQuery() {
if (pending_query_->type() == AssistantQueryType::kEmpty)
if (pending_query_->type() == AssistantQueryType::kNull)
return;
pending_query_ = std::make_unique<AssistantEmptyQuery>();
pending_query_ = std::make_unique<AssistantNullQuery>();
NotifyPendingQueryCleared();
}
......
......@@ -6,9 +6,9 @@
namespace ash {
// AssistantEmptyQuery ---------------------------------------------------------
// AssistantNullQuery ----------------------------------------------------------
bool AssistantEmptyQuery::Empty() const {
bool AssistantNullQuery::Empty() const {
return true;
}
......
......@@ -13,10 +13,9 @@ namespace ash {
// AssistantQueryType ----------------------------------------------------------
// TODO(dmblack): Rename kEmpty to kNull.
// Defines possible types of an Assistant query.
enum class AssistantQueryType {
kEmpty, // See AssistantEmptyQuery.
kNull, // See AssistantNullQuery.
kText, // See AssistantTextQuery.
kVoice, // See AssistantVoiceQuery.
};
......@@ -43,21 +42,20 @@ class AssistantQuery {
DISALLOW_COPY_AND_ASSIGN(AssistantQuery);
};
// AssistantEmptyQuery ---------------------------------------------------------
// AssistantNullQuery ----------------------------------------------------------
// TODO(dmblack): Rename to AssistantNullQuery.
// An empty Assistant query used to signify the absence of an Assistant query.
class AssistantEmptyQuery : public AssistantQuery {
// An null Assistant query used to signify the absence of an Assistant query.
class AssistantNullQuery : public AssistantQuery {
public:
AssistantEmptyQuery() : AssistantQuery(AssistantQueryType::kEmpty) {}
AssistantNullQuery() : AssistantQuery(AssistantQueryType::kNull) {}
~AssistantEmptyQuery() override = default;
~AssistantNullQuery() override = default;
// AssistantQuery:
bool Empty() const override;
private:
DISALLOW_COPY_AND_ASSIGN(AssistantEmptyQuery);
DISALLOW_COPY_AND_ASSIGN(AssistantNullQuery);
};
// AssistantTextQuery ----------------------------------------------------------
......
......@@ -128,8 +128,8 @@ void AssistantMiniView::OnResponseChanged(const AssistantResponse& response) {
voice_query.low_confidence_speech();
break;
}
case AssistantQueryType::kEmpty:
// It shouldn't be possible to commit a query of type kEmpty.
case AssistantQueryType::kNull:
// It shouldn't be possible to commit a query of type kNull.
NOTREACHED();
break;
}
......
......@@ -87,7 +87,7 @@ void AssistantQueryView::SetQuery(const AssistantQuery& query) {
voice_query.low_confidence_speech());
break;
}
case AssistantQueryType::kEmpty:
case AssistantQueryType::kNull:
SetText(std::string());
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment