Commit c4a980d1 authored by Li Lin's avatar Li Lin Committed by Commit Bot

Extends Quick Answers to other English locale.

Bug: b/152883420
Test: Unit tests
Change-Id: Ia2f77ed7f5557dd25bd4fd355319ff93e4df3ae6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2129998Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Li Lin <llin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755132}
parent 2a10344e
...@@ -89,7 +89,12 @@ void QuickAnswersClient::OnAssistantContextEnabled(bool enabled) { ...@@ -89,7 +89,12 @@ void QuickAnswersClient::OnAssistantContextEnabled(bool enabled) {
} }
void QuickAnswersClient::OnLocaleChanged(const std::string& locale) { void QuickAnswersClient::OnLocaleChanged(const std::string& locale) {
const std::string kAllowedLocales[] = {ULOC_US}; // String literals used in some cases in the array because their
// constant equivalents don't exist in:
// third_party/icu/source/common/unicode/uloc.h
const std::string kAllowedLocales[] = {ULOC_CANADA, ULOC_UK, ULOC_US,
"en_AU", "en_IN", "en_NZ"};
const std::string kRuntimeLocale = icu::Locale::getDefault().getName(); const std::string kRuntimeLocale = icu::Locale::getDefault().getName();
locale_supported_ = (base::Contains(kAllowedLocales, locale) || locale_supported_ = (base::Contains(kAllowedLocales, locale) ||
base::Contains(kAllowedLocales, kRuntimeLocale)); base::Contains(kAllowedLocales, kRuntimeLocale));
...@@ -124,6 +129,7 @@ void QuickAnswersClient::OnQuickAnswerClick(ResultType result_type) { ...@@ -124,6 +129,7 @@ void QuickAnswersClient::OnQuickAnswerClick(ResultType result_type) {
void QuickAnswersClient::NotifyEligibilityChanged() { void QuickAnswersClient::NotifyEligibilityChanged() {
DCHECK(delegate_); DCHECK(delegate_);
bool is_eligible = bool is_eligible =
(chromeos::features::IsQuickAnswersEnabled() && assistant_state_ && (chromeos::features::IsQuickAnswersEnabled() && assistant_state_ &&
assistant_enabled_ && locale_supported_ && assistant_context_enabled_ && assistant_enabled_ && locale_supported_ && assistant_context_enabled_ &&
......
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