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( ...@@ -166,7 +166,7 @@ void AssistantInteractionController::OnInteractionStarted(
// this, we temporarily pend an empty text query to commit until we can do // this, we temporarily pend an empty text query to commit until we can do
// development to expose something more meaningful. // development to expose something more meaningful.
if (assistant_interaction_model_.pending_query().type() == if (assistant_interaction_model_.pending_query().type() ==
AssistantQueryType::kEmpty) { AssistantQueryType::kNull) {
assistant_interaction_model_.SetPendingQuery( assistant_interaction_model_.SetPendingQuery(
std::make_unique<AssistantTextQuery>()); std::make_unique<AssistantTextQuery>());
} }
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
namespace ash { namespace ash {
AssistantInteractionModel::AssistantInteractionModel() AssistantInteractionModel::AssistantInteractionModel()
: committed_query_(std::make_unique<AssistantEmptyQuery>()), : committed_query_(std::make_unique<AssistantNullQuery>()),
pending_query_(std::make_unique<AssistantEmptyQuery>()) {} pending_query_(std::make_unique<AssistantNullQuery>()) {}
AssistantInteractionModel::~AssistantInteractionModel() = default; AssistantInteractionModel::~AssistantInteractionModel() = default;
...@@ -70,35 +70,35 @@ void AssistantInteractionModel::SetMicState(MicState mic_state) { ...@@ -70,35 +70,35 @@ void AssistantInteractionModel::SetMicState(MicState mic_state) {
} }
void AssistantInteractionModel::ClearCommittedQuery() { void AssistantInteractionModel::ClearCommittedQuery() {
if (committed_query_->type() == AssistantQueryType::kEmpty) if (committed_query_->type() == AssistantQueryType::kNull)
return; return;
committed_query_ = std::make_unique<AssistantEmptyQuery>(); committed_query_ = std::make_unique<AssistantNullQuery>();
NotifyCommittedQueryCleared(); NotifyCommittedQueryCleared();
} }
void AssistantInteractionModel::SetPendingQuery( void AssistantInteractionModel::SetPendingQuery(
std::unique_ptr<AssistantQuery> pending_query) { std::unique_ptr<AssistantQuery> pending_query) {
DCHECK(pending_query->type() != AssistantQueryType::kEmpty); DCHECK(pending_query->type() != AssistantQueryType::kNull);
pending_query_ = std::move(pending_query); pending_query_ = std::move(pending_query);
NotifyPendingQueryChanged(); NotifyPendingQueryChanged();
} }
void AssistantInteractionModel::CommitPendingQuery() { void AssistantInteractionModel::CommitPendingQuery() {
DCHECK_NE(pending_query_->type(), AssistantQueryType::kEmpty); DCHECK_NE(pending_query_->type(), AssistantQueryType::kNull);
committed_query_ = std::move(pending_query_); committed_query_ = std::move(pending_query_);
pending_query_ = std::make_unique<AssistantEmptyQuery>(); pending_query_ = std::make_unique<AssistantNullQuery>();
NotifyCommittedQueryChanged(); NotifyCommittedQueryChanged();
NotifyPendingQueryCleared(); NotifyPendingQueryCleared();
} }
void AssistantInteractionModel::ClearPendingQuery() { void AssistantInteractionModel::ClearPendingQuery() {
if (pending_query_->type() == AssistantQueryType::kEmpty) if (pending_query_->type() == AssistantQueryType::kNull)
return; return;
pending_query_ = std::make_unique<AssistantEmptyQuery>(); pending_query_ = std::make_unique<AssistantNullQuery>();
NotifyPendingQueryCleared(); NotifyPendingQueryCleared();
} }
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
namespace ash { namespace ash {
// AssistantEmptyQuery --------------------------------------------------------- // AssistantNullQuery ----------------------------------------------------------
bool AssistantEmptyQuery::Empty() const { bool AssistantNullQuery::Empty() const {
return true; return true;
} }
......
...@@ -13,10 +13,9 @@ namespace ash { ...@@ -13,10 +13,9 @@ namespace ash {
// AssistantQueryType ---------------------------------------------------------- // AssistantQueryType ----------------------------------------------------------
// TODO(dmblack): Rename kEmpty to kNull.
// Defines possible types of an Assistant query. // Defines possible types of an Assistant query.
enum class AssistantQueryType { enum class AssistantQueryType {
kEmpty, // See AssistantEmptyQuery. kNull, // See AssistantNullQuery.
kText, // See AssistantTextQuery. kText, // See AssistantTextQuery.
kVoice, // See AssistantVoiceQuery. kVoice, // See AssistantVoiceQuery.
}; };
...@@ -43,21 +42,20 @@ class AssistantQuery { ...@@ -43,21 +42,20 @@ class AssistantQuery {
DISALLOW_COPY_AND_ASSIGN(AssistantQuery); DISALLOW_COPY_AND_ASSIGN(AssistantQuery);
}; };
// AssistantEmptyQuery --------------------------------------------------------- // AssistantNullQuery ----------------------------------------------------------
// TODO(dmblack): Rename to AssistantNullQuery. // An null Assistant query used to signify the absence of an Assistant query.
// An empty Assistant query used to signify the absence of an Assistant query. class AssistantNullQuery : public AssistantQuery {
class AssistantEmptyQuery : public AssistantQuery {
public: public:
AssistantEmptyQuery() : AssistantQuery(AssistantQueryType::kEmpty) {} AssistantNullQuery() : AssistantQuery(AssistantQueryType::kNull) {}
~AssistantEmptyQuery() override = default; ~AssistantNullQuery() override = default;
// AssistantQuery: // AssistantQuery:
bool Empty() const override; bool Empty() const override;
private: private:
DISALLOW_COPY_AND_ASSIGN(AssistantEmptyQuery); DISALLOW_COPY_AND_ASSIGN(AssistantNullQuery);
}; };
// AssistantTextQuery ---------------------------------------------------------- // AssistantTextQuery ----------------------------------------------------------
......
...@@ -128,8 +128,8 @@ void AssistantMiniView::OnResponseChanged(const AssistantResponse& response) { ...@@ -128,8 +128,8 @@ void AssistantMiniView::OnResponseChanged(const AssistantResponse& response) {
voice_query.low_confidence_speech(); voice_query.low_confidence_speech();
break; break;
} }
case AssistantQueryType::kEmpty: case AssistantQueryType::kNull:
// It shouldn't be possible to commit a query of type kEmpty. // It shouldn't be possible to commit a query of type kNull.
NOTREACHED(); NOTREACHED();
break; break;
} }
......
...@@ -87,7 +87,7 @@ void AssistantQueryView::SetQuery(const AssistantQuery& query) { ...@@ -87,7 +87,7 @@ void AssistantQueryView::SetQuery(const AssistantQuery& query) {
voice_query.low_confidence_speech()); voice_query.low_confidence_speech());
break; break;
} }
case AssistantQueryType::kEmpty: case AssistantQueryType::kNull:
SetText(std::string()); SetText(std::string());
break; 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