Commit 8539472b authored by Xiaohui Chen's avatar Xiaohui Chen Committed by Commit Bot

assistant: refactor ToTriggerSource(..)

Move the method to chromium code to ease future development.

Bug: None
Change-Id: Ifcff11c6a638ef6f57c05e3619ce7ba518ee8a2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2289050Reviewed-by: default avatarJeroen Dhollander <jeroendh@chromium.org>
Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#787877}
parent 40ee14e2
......@@ -149,6 +149,33 @@ void UpdateInternalOptions(
});
}
const char* ToTriggerSource(AssistantEntryPoint entry_point) {
switch (entry_point) {
case AssistantEntryPoint::kUnspecified:
return kEntryPointUnspecified;
case AssistantEntryPoint::kDeepLink:
return kEntryPointDeepLink;
case AssistantEntryPoint::kHotkey:
return kEntryPointHotkey;
case AssistantEntryPoint::kHotword:
return kEntryPointHotword;
case AssistantEntryPoint::kLongPressLauncher:
return kEntryPointLongPressLauncher;
case AssistantEntryPoint::kSetup:
return kEntryPointSetup;
case AssistantEntryPoint::kStylus:
return kEntryPointStylus;
case AssistantEntryPoint::kLauncherSearchResult:
return kEntryPointLauncherSearchResult;
case AssistantEntryPoint::kLauncherSearchBoxIcon:
return kEntryPointLauncherSearchBoxIcon;
case AssistantEntryPoint::kProactiveSuggestions:
return kEntryPointProactiveSuggestions;
case AssistantEntryPoint::kLauncherChip:
return kEntryPointLauncherChip;
}
}
} // namespace
AssistantManagerServiceImpl::AssistantManagerServiceImpl(
......@@ -1288,7 +1315,7 @@ void AssistantManagerServiceImpl::ResumeTimer(const std::string& id) {
void AssistantManagerServiceImpl::NotifyEntryIntoAssistantUi(
AssistantEntryPoint entry_point) {
base::AutoLock lock(last_trigger_source_lock_);
last_trigger_source_ = ToTriggerSource(static_cast<int>(entry_point));
last_trigger_source_ = ToTriggerSource(entry_point);
}
std::string AssistantManagerServiceImpl::ConsumeLastTriggerSource() {
......
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