Remove kTranslateMessageUI flag from chrome_translate_client because it is already default enabled. (TranslateMessages)
Bug: 364728321 Change-Id: I224aa1fd978cdb7e53865e8c209e44a63ec4cc6a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5854295 Commit-Queue: Sana Akbani <sanaakbani@google.com> Reviewed-by: Trevor Perrier <perrier@chromium.org> Reviewed-by: Anthony Cui <cuianthony@chromium.org> Cr-Commit-Position: refs/heads/main@{#1354934}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
bee21103a3
commit
874ab5e3c0
chrome/browser/translate
components/translate/content/android
@ -222,11 +222,7 @@ bool ChromeTranslateClient::ShowTranslateUI(
|
||||
// and iOS (in ios/chrome/browser/translate/chrome_ios_translate_client.mm).
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
DCHECK(!TranslateService::IsTranslateBubbleEnabled());
|
||||
|
||||
if (base::FeatureList::IsEnabled(translate::kTranslateMessageUI)) {
|
||||
// Message UI.
|
||||
|
||||
// Get the TranslationType from associated manager's language state.
|
||||
translate::TranslationType translate_type =
|
||||
GetLanguageState().translation_type();
|
||||
// Use the automatic translation Snackbar if the current translation is an
|
||||
@ -245,8 +241,7 @@ bool ChromeTranslateClient::ShowTranslateUI(
|
||||
auto_translate_snackbar_controller_->ShowSnackbar(target_language);
|
||||
}
|
||||
} else {
|
||||
// Snackbar disabled or not an automatic translation. If not an automatic
|
||||
// translation, use TranslateMessage.
|
||||
// Not an automatic translation. Use TranslateMessage instead.
|
||||
if (!translate_message_) {
|
||||
translate_message_ = std::make_unique<translate::TranslateMessage>(
|
||||
web_contents(), translate_manager_->GetWeakPtr(),
|
||||
@ -255,7 +250,6 @@ bool ChromeTranslateClient::ShowTranslateUI(
|
||||
translate_message_->ShowTranslateStep(step, source_language,
|
||||
target_language);
|
||||
}
|
||||
}
|
||||
translate_manager_->GetActiveTranslateMetricsLogger()->LogUIChange(true);
|
||||
#else
|
||||
DCHECK(TranslateService::IsTranslateBubbleEnabled());
|
||||
|
@ -45,6 +45,8 @@ namespace translate {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int kDismissalDurationSeconds = 10;
|
||||
|
||||
// Default implementation of the TranslateMessage::Bridge interface, which just
|
||||
// calls the appropriate Java methods in each case.
|
||||
class BridgeImpl : public TranslateMessage::Bridge {
|
||||
@ -109,14 +111,6 @@ class BridgeImpl : public TranslateMessage::Bridge {
|
||||
|
||||
BridgeImpl::~BridgeImpl() = default;
|
||||
|
||||
// Returns the auto-dismiss timer duration in seconds for the translate message,
|
||||
// which defaults to 10s and can be overridden by a Feature param.
|
||||
int GetDismissalDurationSeconds() {
|
||||
constexpr base::FeatureParam<int> kDismissalDuration(
|
||||
&kTranslateMessageUI, "dismissal_duration_sec", 10);
|
||||
return kDismissalDuration.Get();
|
||||
}
|
||||
|
||||
base::android::ScopedJavaLocalRef<jstring> GetDefaultMessageDescription(
|
||||
JNIEnv* env,
|
||||
const std::u16string& source_language_display_name,
|
||||
@ -129,13 +123,6 @@ base::android::ScopedJavaLocalRef<jstring> GetDefaultMessageDescription(
|
||||
|
||||
} // namespace
|
||||
|
||||
// Features
|
||||
BASE_FEATURE(kTranslateMessageUI,
|
||||
"TranslateMessageUI",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
// Params
|
||||
const char kTranslateMessageUISnackbarParam[] = "use_snackbar";
|
||||
|
||||
TranslateMessage::Bridge::~Bridge() = default;
|
||||
|
||||
TranslateMessage::TranslateMessage(
|
||||
@ -184,7 +171,7 @@ void TranslateMessage::ShowTranslateStep(TranslateStep step,
|
||||
|
||||
if (state_ == State::kDismissed) {
|
||||
if (!bridge_->CreateTranslateMessage(env, web_contents_, this,
|
||||
GetDismissalDurationSeconds())) {
|
||||
kDismissalDurationSeconds)) {
|
||||
// The |bridge_| failed to create the Java TranslateMessage, such as when
|
||||
// the activity is being destroyed, so there is no message to show.
|
||||
return;
|
||||
|
@ -28,9 +28,6 @@ class TranslateManager;
|
||||
class TranslateUIDelegate;
|
||||
class TranslateUILanguagesManager;
|
||||
|
||||
BASE_DECLARE_FEATURE(kTranslateMessageUI);
|
||||
extern const char kTranslateMessageUISnackbarParam[];
|
||||
|
||||
class TranslateMessage {
|
||||
public:
|
||||
TranslateMessage(content::WebContents* web_contents,
|
||||
|
Reference in New Issue
Block a user